commit b96cf702ee9f33439bc4c93ba47bf8329c64f02a Author: forge-bot Date: Sat Jul 18 11:24:15 2026 +0000 feat: acquire-core full legacy C corpus (~2066 files, build-verified) + generator + inventory diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..717475d --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +build/ +bin/ +*.o +*.a diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..cbf650e --- /dev/null +++ b/Makefile @@ -0,0 +1,113 @@ +# ========================================================================== +# acquire-core-full / TxCore Makefile (생성기 산출물) +# +# .pgc --ecpg--> .c --gcc--> build/*.o --ar--> libtxcore.a --ld--> bin/* +# +# ~1000개 .c/.pgc 를 build/*.o 로 컴파일하는 것이 빌드 검증의 핵심. +# 와일드카드로 전체 소스를 수집하고, 대표 데모 바이너리 몇 개를 링크한다. +# ========================================================================== +CC := gcc +ECPG := ecpg +AR := ar +PG_INCDIR := $(shell pg_config --includedir 2>/dev/null) + +INCLUDES := -Iframework/txcore/include \ + -Iframework/txcore/dbio \ + -Iapp/include \ + -Iapp/shared/include \ + -I$(PG_INCDIR) + +# 고정길이 관용구 경고만 억제 (-Werror 없음) +CFLAGS := -g -O2 -Wall -Wextra -Wno-unused-parameter \ + -Wno-stringop-truncation -Wno-format-truncation \ + -Wno-unused-variable -Wno-unused-but-set-variable $(INCLUDES) +ECPGFLAGS := -Iframework/txcore/include -Iframework/txcore/dbio \ + -Iapp/include -Iapp/shared/include +LDLIBS := -lecpg -lpq + +BUILD := build +BIN := bin + +# ---- 소스 수집 (와일드카드) ---------------------------------------------- +ONLINE_PGC := $(wildcard app/online/*.pgc) +BATCH_PGC := $(wildcard app/batch/*.pgc) +DBIO_PGC := $(wildcard app/dbio/*.pgc) +COMMON_C := $(wildcard app/common/*.c) +SHARED_C := $(wildcard app/shared/common/*.c) + +PGC_ALL := $(ONLINE_PGC) $(BATCH_PGC) $(DBIO_PGC) +GEN_C := $(PGC_ALL:.pgc=.c) + +PGC_OBJ := $(patsubst %,$(BUILD)/%.o,$(basename $(notdir $(PGC_ALL)))) +COMMON_OBJ := $(patsubst %,$(BUILD)/%.o,$(basename $(notdir $(COMMON_C)))) +SHARED_OBJ := $(patsubst %,$(BUILD)/%.o,$(basename $(notdir $(SHARED_C)))) +ALL_OBJ := $(PGC_OBJ) $(COMMON_OBJ) $(SHARED_OBJ) + +LIBTXCORE := $(BUILD)/libtxcore.a + +DEMO_BINS := $(BIN)/demo_mg_server $(BIN)/demo_ac_server $(BIN)/demo_rc_server $(BIN)/demo_st_server $(BIN)/demo_rc_batch $(BIN)/demo_cl_batch + +.SECONDARY: +.PHONY: all clean dirs gen objs demos + +all: dirs $(LIBTXCORE) objs demos + @echo "==> 빌드 완료" + @echo "오브젝트: $(words $(ALL_OBJ)) 개" + +dirs: + @mkdir -p $(BUILD) $(BIN) + +gen: $(GEN_C) +objs: $(ALL_OBJ) +demos: $(DEMO_BINS) + +# ---- ecpg: .pgc -> .c (디렉토리별) --------------------------------------- +app/online/%.c: app/online/%.pgc + $(ECPG) $(ECPGFLAGS) -o $@ $< +app/batch/%.c: app/batch/%.pgc + $(ECPG) $(ECPGFLAGS) -o $@ $< +app/dbio/%.c: app/dbio/%.pgc + $(ECPG) $(ECPGFLAGS) -o $@ $< + +# ---- 컴파일: build/.o (gen 선행 보장) -------------------------- +$(BUILD)/%.o: app/online/%.c | gen + $(CC) $(CFLAGS) -c $< -o $@ +$(BUILD)/%.o: app/batch/%.c | gen + $(CC) $(CFLAGS) -c $< -o $@ +$(BUILD)/%.o: app/dbio/%.c | gen + $(CC) $(CFLAGS) -c $< -o $@ +$(BUILD)/%.o: app/common/%.c + $(CC) $(CFLAGS) -c $< -o $@ +$(BUILD)/%.o: app/shared/common/%.c + $(CC) $(CFLAGS) -c $< -o $@ + +# ---- TxCore 정적 라이브러리 ---------------------------------------------- +$(BUILD)/txcore.o: framework/txcore/src/txcore.c + $(CC) $(CFLAGS) -c $< -o $@ +$(LIBTXCORE): $(BUILD)/txcore.o + $(AR) rcs $@ $^ + +# ---- 대표 데모 바이너리 (링크 검증) -------------------------------------- +$(BIN)/demo_mg_server: $(BUILD)/demo_mg_main.o $(BUILD)/mg_ol_0001.o $(BUILD)/mg_dbio_main.o $(SHARED_OBJ) $(LIBTXCORE) + $(CC) $(CFLAGS) -o $@ $(BUILD)/demo_mg_main.o $(BUILD)/mg_ol_0001.o $(BUILD)/mg_dbio_main.o $(SHARED_OBJ) -L$(BUILD) -ltxcore $(LDLIBS) + +$(BIN)/demo_ac_server: $(BUILD)/demo_ac_main.o $(BUILD)/ac_ol_0001.o $(BUILD)/ac_dbio_main.o $(SHARED_OBJ) $(LIBTXCORE) + $(CC) $(CFLAGS) -o $@ $(BUILD)/demo_ac_main.o $(BUILD)/ac_ol_0001.o $(BUILD)/ac_dbio_main.o $(SHARED_OBJ) -L$(BUILD) -ltxcore $(LDLIBS) + +$(BIN)/demo_rc_server: $(BUILD)/demo_rc_main.o $(BUILD)/rc_ol_0001.o $(BUILD)/rc_dbio_main.o $(SHARED_OBJ) $(LIBTXCORE) + $(CC) $(CFLAGS) -o $@ $(BUILD)/demo_rc_main.o $(BUILD)/rc_ol_0001.o $(BUILD)/rc_dbio_main.o $(SHARED_OBJ) -L$(BUILD) -ltxcore $(LDLIBS) + +$(BIN)/demo_st_server: $(BUILD)/demo_st_main.o $(BUILD)/st_ol_0001.o $(BUILD)/st_dbio_main.o $(SHARED_OBJ) $(LIBTXCORE) + $(CC) $(CFLAGS) -o $@ $(BUILD)/demo_st_main.o $(BUILD)/st_ol_0001.o $(BUILD)/st_dbio_main.o $(SHARED_OBJ) -L$(BUILD) -ltxcore $(LDLIBS) + +$(BIN)/demo_rc_batch: $(BUILD)/rc_bt_0001.o $(BUILD)/rc_dbio_main.o $(SHARED_OBJ) $(LIBTXCORE) + $(CC) $(CFLAGS) -o $@ $(BUILD)/rc_bt_0001.o $(BUILD)/rc_dbio_main.o $(SHARED_OBJ) -L$(BUILD) -ltxcore $(LDLIBS) + +$(BIN)/demo_cl_batch: $(BUILD)/cl_bt_0001.o $(BUILD)/cl_dbio_main.o $(SHARED_OBJ) $(LIBTXCORE) + $(CC) $(CFLAGS) -o $@ $(BUILD)/cl_bt_0001.o $(BUILD)/cl_dbio_main.o $(SHARED_OBJ) -L$(BUILD) -ltxcore $(LDLIBS) + +# ========================================================================== +clean: + rm -rf $(BUILD) $(BIN) + rm -f $(GEN_C) + diff --git a/app/batch/ac_bt_0001.c b/app/batch/ac_bt_0001.c new file mode 100644 index 0000000..914f440 --- /dev/null +++ b/app/batch/ac_bt_0001.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/ac_bt_0001.pgc" +/* @tier easy @module ac @transform acquire-batch */ +/* + * ac_bt_0001.pgc - 매입 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: ac_bt_0001 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "ac_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/ac_bt_0001.pgc" + + +static int run_ac_bt_0001(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/ac_bt_0001.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/ac_bt_0001.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/ac_bt_0001.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/ac_bt_0001.pgc" + long h_amount ; + +#line 28 "app/batch/ac_bt_0001.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/ac_bt_0001.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_ac_bt_0001 cursor for select key , merch_id , amount from ac_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/ac_bt_0001.pgc" + +#line 42 "app/batch/ac_bt_0001.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_ac_bt_0001 cursor for select key , merch_id , amount from ac_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/ac_bt_0001.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_ac_bt_0001"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[ac_bt_0001] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_ac_bt_0001", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/ac_bt_0001.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_ac_bt_0001"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, AC_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, AC_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = ac_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[ac_bt_0001] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_ac_bt_0001", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/ac_bt_0001.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[ac_bt_0001] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 매입 배치 결과 [ac_bt_0001] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[ac_bt_0001] 배치 시작 date=%s", biz_date); + + rc = ac_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[ac_bt_0001] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_ac_bt_0001(biz_date); + + ac_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[ac_bt_0001] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/ac_bt_0001.pgc b/app/batch/ac_bt_0001.pgc new file mode 100644 index 0000000..e753bf3 --- /dev/null +++ b/app/batch/ac_bt_0001.pgc @@ -0,0 +1,138 @@ +/* @tier easy @module ac @transform acquire-batch */ +/* + * ac_bt_0001.pgc - 매입 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: ac_bt_0001 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "ac_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_ac_bt_0001(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_ac_bt_0001 CURSOR FOR + SELECT key, merch_id, amount + FROM ac_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_ac_bt_0001; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_ac_bt_0001"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[ac_bt_0001] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_ac_bt_0001 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_ac_bt_0001"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, AC_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, AC_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = ac_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[ac_bt_0001] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_ac_bt_0001; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[ac_bt_0001] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 매입 배치 결과 [ac_bt_0001] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[ac_bt_0001] 배치 시작 date=%s", biz_date); + + rc = ac_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[ac_bt_0001] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_ac_bt_0001(biz_date); + + ac_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[ac_bt_0001] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/ac_bt_0002.c b/app/batch/ac_bt_0002.c new file mode 100644 index 0000000..0dc1688 --- /dev/null +++ b/app/batch/ac_bt_0002.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/ac_bt_0002.pgc" +/* @tier medium @module ac @transform acquire-batch */ +/* + * ac_bt_0002.pgc - 매입 배치 (커서 순회 + 상태전이) [tier=medium] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: ac_bt_0002 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "ac_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/ac_bt_0002.pgc" + + +static int run_ac_bt_0002(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/ac_bt_0002.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/ac_bt_0002.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/ac_bt_0002.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/ac_bt_0002.pgc" + long h_amount ; + +#line 28 "app/batch/ac_bt_0002.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/ac_bt_0002.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_ac_bt_0002 cursor for select key , merch_id , amount from ac_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/ac_bt_0002.pgc" + +#line 42 "app/batch/ac_bt_0002.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_ac_bt_0002 cursor for select key , merch_id , amount from ac_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/ac_bt_0002.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_ac_bt_0002"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[ac_bt_0002] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_ac_bt_0002", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/ac_bt_0002.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_ac_bt_0002"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, AC_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, AC_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = ac_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[ac_bt_0002] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_ac_bt_0002", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/ac_bt_0002.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[ac_bt_0002] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 매입 배치 결과 [ac_bt_0002] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[ac_bt_0002] 배치 시작 date=%s", biz_date); + + rc = ac_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[ac_bt_0002] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_ac_bt_0002(biz_date); + + ac_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[ac_bt_0002] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/ac_bt_0002.pgc b/app/batch/ac_bt_0002.pgc new file mode 100644 index 0000000..ae365be --- /dev/null +++ b/app/batch/ac_bt_0002.pgc @@ -0,0 +1,138 @@ +/* @tier medium @module ac @transform acquire-batch */ +/* + * ac_bt_0002.pgc - 매입 배치 (커서 순회 + 상태전이) [tier=medium] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: ac_bt_0002 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "ac_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_ac_bt_0002(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_ac_bt_0002 CURSOR FOR + SELECT key, merch_id, amount + FROM ac_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_ac_bt_0002; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_ac_bt_0002"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[ac_bt_0002] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_ac_bt_0002 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_ac_bt_0002"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, AC_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, AC_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = ac_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[ac_bt_0002] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_ac_bt_0002; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[ac_bt_0002] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 매입 배치 결과 [ac_bt_0002] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[ac_bt_0002] 배치 시작 date=%s", biz_date); + + rc = ac_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[ac_bt_0002] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_ac_bt_0002(biz_date); + + ac_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[ac_bt_0002] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/ac_bt_0003.c b/app/batch/ac_bt_0003.c new file mode 100644 index 0000000..f9d5e00 --- /dev/null +++ b/app/batch/ac_bt_0003.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/ac_bt_0003.pgc" +/* @tier easy @module ac @transform acquire-batch */ +/* + * ac_bt_0003.pgc - 매입 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: ac_bt_0003 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "ac_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/ac_bt_0003.pgc" + + +static int run_ac_bt_0003(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/ac_bt_0003.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/ac_bt_0003.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/ac_bt_0003.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/ac_bt_0003.pgc" + long h_amount ; + +#line 28 "app/batch/ac_bt_0003.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/ac_bt_0003.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_ac_bt_0003 cursor for select key , merch_id , amount from ac_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/ac_bt_0003.pgc" + +#line 42 "app/batch/ac_bt_0003.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_ac_bt_0003 cursor for select key , merch_id , amount from ac_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/ac_bt_0003.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_ac_bt_0003"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[ac_bt_0003] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_ac_bt_0003", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/ac_bt_0003.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_ac_bt_0003"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, AC_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, AC_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = ac_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[ac_bt_0003] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_ac_bt_0003", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/ac_bt_0003.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[ac_bt_0003] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 매입 배치 결과 [ac_bt_0003] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[ac_bt_0003] 배치 시작 date=%s", biz_date); + + rc = ac_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[ac_bt_0003] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_ac_bt_0003(biz_date); + + ac_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[ac_bt_0003] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/ac_bt_0003.pgc b/app/batch/ac_bt_0003.pgc new file mode 100644 index 0000000..db09cba --- /dev/null +++ b/app/batch/ac_bt_0003.pgc @@ -0,0 +1,138 @@ +/* @tier easy @module ac @transform acquire-batch */ +/* + * ac_bt_0003.pgc - 매입 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: ac_bt_0003 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "ac_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_ac_bt_0003(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_ac_bt_0003 CURSOR FOR + SELECT key, merch_id, amount + FROM ac_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_ac_bt_0003; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_ac_bt_0003"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[ac_bt_0003] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_ac_bt_0003 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_ac_bt_0003"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, AC_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, AC_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = ac_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[ac_bt_0003] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_ac_bt_0003; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[ac_bt_0003] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 매입 배치 결과 [ac_bt_0003] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[ac_bt_0003] 배치 시작 date=%s", biz_date); + + rc = ac_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[ac_bt_0003] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_ac_bt_0003(biz_date); + + ac_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[ac_bt_0003] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/ac_bt_0004.c b/app/batch/ac_bt_0004.c new file mode 100644 index 0000000..90b942b --- /dev/null +++ b/app/batch/ac_bt_0004.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/ac_bt_0004.pgc" +/* @tier medium @module ac @transform acquire-batch */ +/* + * ac_bt_0004.pgc - 매입 배치 (커서 순회 + 상태전이) [tier=medium] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: ac_bt_0004 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "ac_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/ac_bt_0004.pgc" + + +static int run_ac_bt_0004(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/ac_bt_0004.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/ac_bt_0004.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/ac_bt_0004.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/ac_bt_0004.pgc" + long h_amount ; + +#line 28 "app/batch/ac_bt_0004.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/ac_bt_0004.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_ac_bt_0004 cursor for select key , merch_id , amount from ac_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/ac_bt_0004.pgc" + +#line 42 "app/batch/ac_bt_0004.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_ac_bt_0004 cursor for select key , merch_id , amount from ac_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/ac_bt_0004.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_ac_bt_0004"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[ac_bt_0004] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_ac_bt_0004", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/ac_bt_0004.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_ac_bt_0004"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, AC_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, AC_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = ac_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[ac_bt_0004] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_ac_bt_0004", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/ac_bt_0004.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[ac_bt_0004] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 매입 배치 결과 [ac_bt_0004] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[ac_bt_0004] 배치 시작 date=%s", biz_date); + + rc = ac_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[ac_bt_0004] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_ac_bt_0004(biz_date); + + ac_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[ac_bt_0004] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/ac_bt_0004.pgc b/app/batch/ac_bt_0004.pgc new file mode 100644 index 0000000..2ee8194 --- /dev/null +++ b/app/batch/ac_bt_0004.pgc @@ -0,0 +1,138 @@ +/* @tier medium @module ac @transform acquire-batch */ +/* + * ac_bt_0004.pgc - 매입 배치 (커서 순회 + 상태전이) [tier=medium] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: ac_bt_0004 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "ac_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_ac_bt_0004(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_ac_bt_0004 CURSOR FOR + SELECT key, merch_id, amount + FROM ac_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_ac_bt_0004; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_ac_bt_0004"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[ac_bt_0004] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_ac_bt_0004 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_ac_bt_0004"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, AC_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, AC_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = ac_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[ac_bt_0004] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_ac_bt_0004; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[ac_bt_0004] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 매입 배치 결과 [ac_bt_0004] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[ac_bt_0004] 배치 시작 date=%s", biz_date); + + rc = ac_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[ac_bt_0004] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_ac_bt_0004(biz_date); + + ac_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[ac_bt_0004] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/ac_bt_0005.c b/app/batch/ac_bt_0005.c new file mode 100644 index 0000000..91fe7e5 --- /dev/null +++ b/app/batch/ac_bt_0005.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/ac_bt_0005.pgc" +/* @tier easy @module ac @transform acquire-batch */ +/* + * ac_bt_0005.pgc - 매입 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: ac_bt_0005 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "ac_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/ac_bt_0005.pgc" + + +static int run_ac_bt_0005(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/ac_bt_0005.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/ac_bt_0005.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/ac_bt_0005.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/ac_bt_0005.pgc" + long h_amount ; + +#line 28 "app/batch/ac_bt_0005.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/ac_bt_0005.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_ac_bt_0005 cursor for select key , merch_id , amount from ac_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/ac_bt_0005.pgc" + +#line 42 "app/batch/ac_bt_0005.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_ac_bt_0005 cursor for select key , merch_id , amount from ac_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/ac_bt_0005.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_ac_bt_0005"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[ac_bt_0005] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_ac_bt_0005", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/ac_bt_0005.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_ac_bt_0005"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, AC_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, AC_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = ac_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[ac_bt_0005] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_ac_bt_0005", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/ac_bt_0005.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[ac_bt_0005] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 매입 배치 결과 [ac_bt_0005] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[ac_bt_0005] 배치 시작 date=%s", biz_date); + + rc = ac_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[ac_bt_0005] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_ac_bt_0005(biz_date); + + ac_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[ac_bt_0005] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/ac_bt_0005.pgc b/app/batch/ac_bt_0005.pgc new file mode 100644 index 0000000..d26104a --- /dev/null +++ b/app/batch/ac_bt_0005.pgc @@ -0,0 +1,138 @@ +/* @tier easy @module ac @transform acquire-batch */ +/* + * ac_bt_0005.pgc - 매입 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: ac_bt_0005 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "ac_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_ac_bt_0005(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_ac_bt_0005 CURSOR FOR + SELECT key, merch_id, amount + FROM ac_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_ac_bt_0005; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_ac_bt_0005"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[ac_bt_0005] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_ac_bt_0005 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_ac_bt_0005"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, AC_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, AC_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = ac_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[ac_bt_0005] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_ac_bt_0005; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[ac_bt_0005] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 매입 배치 결과 [ac_bt_0005] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[ac_bt_0005] 배치 시작 date=%s", biz_date); + + rc = ac_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[ac_bt_0005] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_ac_bt_0005(biz_date); + + ac_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[ac_bt_0005] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/ac_bt_0006.c b/app/batch/ac_bt_0006.c new file mode 100644 index 0000000..0dc9f8d --- /dev/null +++ b/app/batch/ac_bt_0006.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/ac_bt_0006.pgc" +/* @tier hard @module ac @transform acquire-batch */ +/* + * ac_bt_0006.pgc - 매입 배치 (커서 순회 + 상태전이) [tier=hard] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: ac_bt_0006 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "ac_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/ac_bt_0006.pgc" + + +static int run_ac_bt_0006(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/ac_bt_0006.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/ac_bt_0006.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/ac_bt_0006.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/ac_bt_0006.pgc" + long h_amount ; + +#line 28 "app/batch/ac_bt_0006.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/ac_bt_0006.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_ac_bt_0006 cursor for select key , merch_id , amount from ac_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/ac_bt_0006.pgc" + +#line 42 "app/batch/ac_bt_0006.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_ac_bt_0006 cursor for select key , merch_id , amount from ac_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/ac_bt_0006.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_ac_bt_0006"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[ac_bt_0006] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_ac_bt_0006", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/ac_bt_0006.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_ac_bt_0006"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, AC_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, AC_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = ac_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[ac_bt_0006] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_ac_bt_0006", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/ac_bt_0006.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[ac_bt_0006] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 매입 배치 결과 [ac_bt_0006] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[ac_bt_0006] 배치 시작 date=%s", biz_date); + + rc = ac_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[ac_bt_0006] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_ac_bt_0006(biz_date); + + ac_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[ac_bt_0006] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/ac_bt_0006.pgc b/app/batch/ac_bt_0006.pgc new file mode 100644 index 0000000..521b584 --- /dev/null +++ b/app/batch/ac_bt_0006.pgc @@ -0,0 +1,138 @@ +/* @tier hard @module ac @transform acquire-batch */ +/* + * ac_bt_0006.pgc - 매입 배치 (커서 순회 + 상태전이) [tier=hard] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: ac_bt_0006 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "ac_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_ac_bt_0006(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_ac_bt_0006 CURSOR FOR + SELECT key, merch_id, amount + FROM ac_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_ac_bt_0006; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_ac_bt_0006"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[ac_bt_0006] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_ac_bt_0006 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_ac_bt_0006"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, AC_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, AC_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = ac_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[ac_bt_0006] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_ac_bt_0006; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[ac_bt_0006] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 매입 배치 결과 [ac_bt_0006] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[ac_bt_0006] 배치 시작 date=%s", biz_date); + + rc = ac_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[ac_bt_0006] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_ac_bt_0006(biz_date); + + ac_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[ac_bt_0006] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/ac_bt_0007.c b/app/batch/ac_bt_0007.c new file mode 100644 index 0000000..3bb8513 --- /dev/null +++ b/app/batch/ac_bt_0007.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/ac_bt_0007.pgc" +/* @tier easy @module ac @transform acquire-batch */ +/* + * ac_bt_0007.pgc - 매입 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: ac_bt_0007 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "ac_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/ac_bt_0007.pgc" + + +static int run_ac_bt_0007(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/ac_bt_0007.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/ac_bt_0007.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/ac_bt_0007.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/ac_bt_0007.pgc" + long h_amount ; + +#line 28 "app/batch/ac_bt_0007.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/ac_bt_0007.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_ac_bt_0007 cursor for select key , merch_id , amount from ac_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/ac_bt_0007.pgc" + +#line 42 "app/batch/ac_bt_0007.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_ac_bt_0007 cursor for select key , merch_id , amount from ac_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/ac_bt_0007.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_ac_bt_0007"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[ac_bt_0007] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_ac_bt_0007", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/ac_bt_0007.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_ac_bt_0007"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, AC_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, AC_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = ac_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[ac_bt_0007] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_ac_bt_0007", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/ac_bt_0007.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[ac_bt_0007] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 매입 배치 결과 [ac_bt_0007] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[ac_bt_0007] 배치 시작 date=%s", biz_date); + + rc = ac_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[ac_bt_0007] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_ac_bt_0007(biz_date); + + ac_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[ac_bt_0007] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/ac_bt_0007.pgc b/app/batch/ac_bt_0007.pgc new file mode 100644 index 0000000..009b09e --- /dev/null +++ b/app/batch/ac_bt_0007.pgc @@ -0,0 +1,138 @@ +/* @tier easy @module ac @transform acquire-batch */ +/* + * ac_bt_0007.pgc - 매입 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: ac_bt_0007 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "ac_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_ac_bt_0007(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_ac_bt_0007 CURSOR FOR + SELECT key, merch_id, amount + FROM ac_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_ac_bt_0007; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_ac_bt_0007"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[ac_bt_0007] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_ac_bt_0007 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_ac_bt_0007"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, AC_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, AC_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = ac_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[ac_bt_0007] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_ac_bt_0007; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[ac_bt_0007] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 매입 배치 결과 [ac_bt_0007] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[ac_bt_0007] 배치 시작 date=%s", biz_date); + + rc = ac_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[ac_bt_0007] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_ac_bt_0007(biz_date); + + ac_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[ac_bt_0007] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/ac_bt_0008.c b/app/batch/ac_bt_0008.c new file mode 100644 index 0000000..7ccaf60 --- /dev/null +++ b/app/batch/ac_bt_0008.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/ac_bt_0008.pgc" +/* @tier hard @module ac @transform acquire-batch */ +/* + * ac_bt_0008.pgc - 매입 배치 (커서 순회 + 상태전이) [tier=hard] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: ac_bt_0008 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "ac_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/ac_bt_0008.pgc" + + +static int run_ac_bt_0008(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/ac_bt_0008.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/ac_bt_0008.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/ac_bt_0008.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/ac_bt_0008.pgc" + long h_amount ; + +#line 28 "app/batch/ac_bt_0008.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/ac_bt_0008.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_ac_bt_0008 cursor for select key , merch_id , amount from ac_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/ac_bt_0008.pgc" + +#line 42 "app/batch/ac_bt_0008.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_ac_bt_0008 cursor for select key , merch_id , amount from ac_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/ac_bt_0008.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_ac_bt_0008"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[ac_bt_0008] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_ac_bt_0008", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/ac_bt_0008.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_ac_bt_0008"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, AC_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, AC_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = ac_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[ac_bt_0008] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_ac_bt_0008", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/ac_bt_0008.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[ac_bt_0008] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 매입 배치 결과 [ac_bt_0008] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[ac_bt_0008] 배치 시작 date=%s", biz_date); + + rc = ac_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[ac_bt_0008] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_ac_bt_0008(biz_date); + + ac_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[ac_bt_0008] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/ac_bt_0008.pgc b/app/batch/ac_bt_0008.pgc new file mode 100644 index 0000000..ef09cda --- /dev/null +++ b/app/batch/ac_bt_0008.pgc @@ -0,0 +1,138 @@ +/* @tier hard @module ac @transform acquire-batch */ +/* + * ac_bt_0008.pgc - 매입 배치 (커서 순회 + 상태전이) [tier=hard] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: ac_bt_0008 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "ac_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_ac_bt_0008(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_ac_bt_0008 CURSOR FOR + SELECT key, merch_id, amount + FROM ac_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_ac_bt_0008; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_ac_bt_0008"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[ac_bt_0008] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_ac_bt_0008 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_ac_bt_0008"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, AC_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, AC_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = ac_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[ac_bt_0008] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_ac_bt_0008; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[ac_bt_0008] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 매입 배치 결과 [ac_bt_0008] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[ac_bt_0008] 배치 시작 date=%s", biz_date); + + rc = ac_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[ac_bt_0008] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_ac_bt_0008(biz_date); + + ac_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[ac_bt_0008] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/ac_bt_0009.c b/app/batch/ac_bt_0009.c new file mode 100644 index 0000000..f122387 --- /dev/null +++ b/app/batch/ac_bt_0009.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/ac_bt_0009.pgc" +/* @tier easy @module ac @transform acquire-batch */ +/* + * ac_bt_0009.pgc - 매입 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: ac_bt_0009 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "ac_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/ac_bt_0009.pgc" + + +static int run_ac_bt_0009(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/ac_bt_0009.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/ac_bt_0009.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/ac_bt_0009.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/ac_bt_0009.pgc" + long h_amount ; + +#line 28 "app/batch/ac_bt_0009.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/ac_bt_0009.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_ac_bt_0009 cursor for select key , merch_id , amount from ac_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/ac_bt_0009.pgc" + +#line 42 "app/batch/ac_bt_0009.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_ac_bt_0009 cursor for select key , merch_id , amount from ac_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/ac_bt_0009.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_ac_bt_0009"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[ac_bt_0009] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_ac_bt_0009", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/ac_bt_0009.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_ac_bt_0009"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, AC_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, AC_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = ac_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[ac_bt_0009] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_ac_bt_0009", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/ac_bt_0009.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[ac_bt_0009] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 매입 배치 결과 [ac_bt_0009] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[ac_bt_0009] 배치 시작 date=%s", biz_date); + + rc = ac_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[ac_bt_0009] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_ac_bt_0009(biz_date); + + ac_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[ac_bt_0009] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/ac_bt_0009.pgc b/app/batch/ac_bt_0009.pgc new file mode 100644 index 0000000..7a6ad35 --- /dev/null +++ b/app/batch/ac_bt_0009.pgc @@ -0,0 +1,138 @@ +/* @tier easy @module ac @transform acquire-batch */ +/* + * ac_bt_0009.pgc - 매입 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: ac_bt_0009 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "ac_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_ac_bt_0009(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_ac_bt_0009 CURSOR FOR + SELECT key, merch_id, amount + FROM ac_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_ac_bt_0009; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_ac_bt_0009"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[ac_bt_0009] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_ac_bt_0009 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_ac_bt_0009"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, AC_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, AC_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = ac_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[ac_bt_0009] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_ac_bt_0009; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[ac_bt_0009] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 매입 배치 결과 [ac_bt_0009] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[ac_bt_0009] 배치 시작 date=%s", biz_date); + + rc = ac_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[ac_bt_0009] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_ac_bt_0009(biz_date); + + ac_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[ac_bt_0009] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/ac_bt_0010.c b/app/batch/ac_bt_0010.c new file mode 100644 index 0000000..7dfbc5e --- /dev/null +++ b/app/batch/ac_bt_0010.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/ac_bt_0010.pgc" +/* @tier easy @module ac @transform acquire-batch */ +/* + * ac_bt_0010.pgc - 매입 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: ac_bt_0010 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "ac_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/ac_bt_0010.pgc" + + +static int run_ac_bt_0010(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/ac_bt_0010.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/ac_bt_0010.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/ac_bt_0010.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/ac_bt_0010.pgc" + long h_amount ; + +#line 28 "app/batch/ac_bt_0010.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/ac_bt_0010.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_ac_bt_0010 cursor for select key , merch_id , amount from ac_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/ac_bt_0010.pgc" + +#line 42 "app/batch/ac_bt_0010.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_ac_bt_0010 cursor for select key , merch_id , amount from ac_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/ac_bt_0010.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_ac_bt_0010"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[ac_bt_0010] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_ac_bt_0010", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/ac_bt_0010.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_ac_bt_0010"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, AC_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, AC_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = ac_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[ac_bt_0010] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_ac_bt_0010", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/ac_bt_0010.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[ac_bt_0010] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 매입 배치 결과 [ac_bt_0010] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[ac_bt_0010] 배치 시작 date=%s", biz_date); + + rc = ac_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[ac_bt_0010] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_ac_bt_0010(biz_date); + + ac_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[ac_bt_0010] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/ac_bt_0010.pgc b/app/batch/ac_bt_0010.pgc new file mode 100644 index 0000000..8a36e4e --- /dev/null +++ b/app/batch/ac_bt_0010.pgc @@ -0,0 +1,138 @@ +/* @tier easy @module ac @transform acquire-batch */ +/* + * ac_bt_0010.pgc - 매입 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: ac_bt_0010 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "ac_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_ac_bt_0010(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_ac_bt_0010 CURSOR FOR + SELECT key, merch_id, amount + FROM ac_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_ac_bt_0010; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_ac_bt_0010"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[ac_bt_0010] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_ac_bt_0010 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_ac_bt_0010"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, AC_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, AC_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = ac_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[ac_bt_0010] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_ac_bt_0010; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[ac_bt_0010] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 매입 배치 결과 [ac_bt_0010] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[ac_bt_0010] 배치 시작 date=%s", biz_date); + + rc = ac_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[ac_bt_0010] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_ac_bt_0010(biz_date); + + ac_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[ac_bt_0010] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/ac_bt_0011.c b/app/batch/ac_bt_0011.c new file mode 100644 index 0000000..f08f8ef --- /dev/null +++ b/app/batch/ac_bt_0011.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/ac_bt_0011.pgc" +/* @tier medium @module ac @transform acquire-batch */ +/* + * ac_bt_0011.pgc - 매입 배치 (커서 순회 + 상태전이) [tier=medium] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: ac_bt_0011 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "ac_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/ac_bt_0011.pgc" + + +static int run_ac_bt_0011(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/ac_bt_0011.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/ac_bt_0011.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/ac_bt_0011.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/ac_bt_0011.pgc" + long h_amount ; + +#line 28 "app/batch/ac_bt_0011.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/ac_bt_0011.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_ac_bt_0011 cursor for select key , merch_id , amount from ac_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/ac_bt_0011.pgc" + +#line 42 "app/batch/ac_bt_0011.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_ac_bt_0011 cursor for select key , merch_id , amount from ac_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/ac_bt_0011.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_ac_bt_0011"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[ac_bt_0011] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_ac_bt_0011", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/ac_bt_0011.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_ac_bt_0011"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, AC_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, AC_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = ac_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[ac_bt_0011] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_ac_bt_0011", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/ac_bt_0011.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[ac_bt_0011] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 매입 배치 결과 [ac_bt_0011] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[ac_bt_0011] 배치 시작 date=%s", biz_date); + + rc = ac_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[ac_bt_0011] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_ac_bt_0011(biz_date); + + ac_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[ac_bt_0011] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/ac_bt_0011.pgc b/app/batch/ac_bt_0011.pgc new file mode 100644 index 0000000..57aba2b --- /dev/null +++ b/app/batch/ac_bt_0011.pgc @@ -0,0 +1,138 @@ +/* @tier medium @module ac @transform acquire-batch */ +/* + * ac_bt_0011.pgc - 매입 배치 (커서 순회 + 상태전이) [tier=medium] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: ac_bt_0011 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "ac_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_ac_bt_0011(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_ac_bt_0011 CURSOR FOR + SELECT key, merch_id, amount + FROM ac_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_ac_bt_0011; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_ac_bt_0011"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[ac_bt_0011] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_ac_bt_0011 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_ac_bt_0011"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, AC_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, AC_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = ac_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[ac_bt_0011] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_ac_bt_0011; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[ac_bt_0011] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 매입 배치 결과 [ac_bt_0011] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[ac_bt_0011] 배치 시작 date=%s", biz_date); + + rc = ac_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[ac_bt_0011] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_ac_bt_0011(biz_date); + + ac_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[ac_bt_0011] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/ac_bt_0012.c b/app/batch/ac_bt_0012.c new file mode 100644 index 0000000..70e57f0 --- /dev/null +++ b/app/batch/ac_bt_0012.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/ac_bt_0012.pgc" +/* @tier easy @module ac @transform acquire-batch */ +/* + * ac_bt_0012.pgc - 매입 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: ac_bt_0012 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "ac_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/ac_bt_0012.pgc" + + +static int run_ac_bt_0012(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/ac_bt_0012.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/ac_bt_0012.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/ac_bt_0012.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/ac_bt_0012.pgc" + long h_amount ; + +#line 28 "app/batch/ac_bt_0012.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/ac_bt_0012.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_ac_bt_0012 cursor for select key , merch_id , amount from ac_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/ac_bt_0012.pgc" + +#line 42 "app/batch/ac_bt_0012.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_ac_bt_0012 cursor for select key , merch_id , amount from ac_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/ac_bt_0012.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_ac_bt_0012"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[ac_bt_0012] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_ac_bt_0012", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/ac_bt_0012.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_ac_bt_0012"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, AC_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, AC_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = ac_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[ac_bt_0012] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_ac_bt_0012", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/ac_bt_0012.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[ac_bt_0012] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 매입 배치 결과 [ac_bt_0012] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[ac_bt_0012] 배치 시작 date=%s", biz_date); + + rc = ac_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[ac_bt_0012] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_ac_bt_0012(biz_date); + + ac_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[ac_bt_0012] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/ac_bt_0012.pgc b/app/batch/ac_bt_0012.pgc new file mode 100644 index 0000000..7f50576 --- /dev/null +++ b/app/batch/ac_bt_0012.pgc @@ -0,0 +1,138 @@ +/* @tier easy @module ac @transform acquire-batch */ +/* + * ac_bt_0012.pgc - 매입 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: ac_bt_0012 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "ac_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_ac_bt_0012(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_ac_bt_0012 CURSOR FOR + SELECT key, merch_id, amount + FROM ac_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_ac_bt_0012; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_ac_bt_0012"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[ac_bt_0012] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_ac_bt_0012 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_ac_bt_0012"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, AC_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, AC_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = ac_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[ac_bt_0012] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_ac_bt_0012; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[ac_bt_0012] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 매입 배치 결과 [ac_bt_0012] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[ac_bt_0012] 배치 시작 date=%s", biz_date); + + rc = ac_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[ac_bt_0012] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_ac_bt_0012(biz_date); + + ac_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[ac_bt_0012] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/ac_bt_0013.c b/app/batch/ac_bt_0013.c new file mode 100644 index 0000000..d3263d0 --- /dev/null +++ b/app/batch/ac_bt_0013.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/ac_bt_0013.pgc" +/* @tier medium @module ac @transform acquire-batch */ +/* + * ac_bt_0013.pgc - 매입 배치 (커서 순회 + 상태전이) [tier=medium] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: ac_bt_0013 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "ac_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/ac_bt_0013.pgc" + + +static int run_ac_bt_0013(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/ac_bt_0013.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/ac_bt_0013.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/ac_bt_0013.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/ac_bt_0013.pgc" + long h_amount ; + +#line 28 "app/batch/ac_bt_0013.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/ac_bt_0013.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_ac_bt_0013 cursor for select key , merch_id , amount from ac_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/ac_bt_0013.pgc" + +#line 42 "app/batch/ac_bt_0013.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_ac_bt_0013 cursor for select key , merch_id , amount from ac_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/ac_bt_0013.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_ac_bt_0013"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[ac_bt_0013] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_ac_bt_0013", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/ac_bt_0013.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_ac_bt_0013"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, AC_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, AC_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = ac_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[ac_bt_0013] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_ac_bt_0013", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/ac_bt_0013.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[ac_bt_0013] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 매입 배치 결과 [ac_bt_0013] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[ac_bt_0013] 배치 시작 date=%s", biz_date); + + rc = ac_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[ac_bt_0013] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_ac_bt_0013(biz_date); + + ac_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[ac_bt_0013] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/ac_bt_0013.pgc b/app/batch/ac_bt_0013.pgc new file mode 100644 index 0000000..b0efac8 --- /dev/null +++ b/app/batch/ac_bt_0013.pgc @@ -0,0 +1,138 @@ +/* @tier medium @module ac @transform acquire-batch */ +/* + * ac_bt_0013.pgc - 매입 배치 (커서 순회 + 상태전이) [tier=medium] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: ac_bt_0013 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "ac_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_ac_bt_0013(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_ac_bt_0013 CURSOR FOR + SELECT key, merch_id, amount + FROM ac_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_ac_bt_0013; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_ac_bt_0013"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[ac_bt_0013] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_ac_bt_0013 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_ac_bt_0013"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, AC_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, AC_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = ac_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[ac_bt_0013] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_ac_bt_0013; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[ac_bt_0013] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 매입 배치 결과 [ac_bt_0013] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[ac_bt_0013] 배치 시작 date=%s", biz_date); + + rc = ac_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[ac_bt_0013] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_ac_bt_0013(biz_date); + + ac_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[ac_bt_0013] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/ac_bt_0014.c b/app/batch/ac_bt_0014.c new file mode 100644 index 0000000..0d7bfd4 --- /dev/null +++ b/app/batch/ac_bt_0014.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/ac_bt_0014.pgc" +/* @tier easy @module ac @transform acquire-batch */ +/* + * ac_bt_0014.pgc - 매입 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: ac_bt_0014 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "ac_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/ac_bt_0014.pgc" + + +static int run_ac_bt_0014(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/ac_bt_0014.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/ac_bt_0014.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/ac_bt_0014.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/ac_bt_0014.pgc" + long h_amount ; + +#line 28 "app/batch/ac_bt_0014.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/ac_bt_0014.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_ac_bt_0014 cursor for select key , merch_id , amount from ac_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/ac_bt_0014.pgc" + +#line 42 "app/batch/ac_bt_0014.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_ac_bt_0014 cursor for select key , merch_id , amount from ac_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/ac_bt_0014.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_ac_bt_0014"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[ac_bt_0014] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_ac_bt_0014", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/ac_bt_0014.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_ac_bt_0014"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, AC_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, AC_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = ac_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[ac_bt_0014] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_ac_bt_0014", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/ac_bt_0014.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[ac_bt_0014] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 매입 배치 결과 [ac_bt_0014] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[ac_bt_0014] 배치 시작 date=%s", biz_date); + + rc = ac_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[ac_bt_0014] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_ac_bt_0014(biz_date); + + ac_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[ac_bt_0014] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/ac_bt_0014.pgc b/app/batch/ac_bt_0014.pgc new file mode 100644 index 0000000..ff9894f --- /dev/null +++ b/app/batch/ac_bt_0014.pgc @@ -0,0 +1,138 @@ +/* @tier easy @module ac @transform acquire-batch */ +/* + * ac_bt_0014.pgc - 매입 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: ac_bt_0014 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "ac_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_ac_bt_0014(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_ac_bt_0014 CURSOR FOR + SELECT key, merch_id, amount + FROM ac_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_ac_bt_0014; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_ac_bt_0014"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[ac_bt_0014] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_ac_bt_0014 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_ac_bt_0014"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, AC_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, AC_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = ac_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[ac_bt_0014] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_ac_bt_0014; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[ac_bt_0014] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 매입 배치 결과 [ac_bt_0014] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[ac_bt_0014] 배치 시작 date=%s", biz_date); + + rc = ac_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[ac_bt_0014] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_ac_bt_0014(biz_date); + + ac_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[ac_bt_0014] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/ac_bt_0015.c b/app/batch/ac_bt_0015.c new file mode 100644 index 0000000..55a392d --- /dev/null +++ b/app/batch/ac_bt_0015.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/ac_bt_0015.pgc" +/* @tier medium @module ac @transform acquire-batch */ +/* + * ac_bt_0015.pgc - 매입 배치 (커서 순회 + 상태전이) [tier=medium] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: ac_bt_0015 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "ac_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/ac_bt_0015.pgc" + + +static int run_ac_bt_0015(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/ac_bt_0015.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/ac_bt_0015.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/ac_bt_0015.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/ac_bt_0015.pgc" + long h_amount ; + +#line 28 "app/batch/ac_bt_0015.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/ac_bt_0015.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_ac_bt_0015 cursor for select key , merch_id , amount from ac_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/ac_bt_0015.pgc" + +#line 42 "app/batch/ac_bt_0015.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_ac_bt_0015 cursor for select key , merch_id , amount from ac_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/ac_bt_0015.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_ac_bt_0015"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[ac_bt_0015] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_ac_bt_0015", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/ac_bt_0015.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_ac_bt_0015"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, AC_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, AC_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = ac_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[ac_bt_0015] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_ac_bt_0015", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/ac_bt_0015.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[ac_bt_0015] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 매입 배치 결과 [ac_bt_0015] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[ac_bt_0015] 배치 시작 date=%s", biz_date); + + rc = ac_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[ac_bt_0015] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_ac_bt_0015(biz_date); + + ac_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[ac_bt_0015] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/ac_bt_0015.pgc b/app/batch/ac_bt_0015.pgc new file mode 100644 index 0000000..84b4a33 --- /dev/null +++ b/app/batch/ac_bt_0015.pgc @@ -0,0 +1,138 @@ +/* @tier medium @module ac @transform acquire-batch */ +/* + * ac_bt_0015.pgc - 매입 배치 (커서 순회 + 상태전이) [tier=medium] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: ac_bt_0015 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "ac_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_ac_bt_0015(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_ac_bt_0015 CURSOR FOR + SELECT key, merch_id, amount + FROM ac_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_ac_bt_0015; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_ac_bt_0015"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[ac_bt_0015] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_ac_bt_0015 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_ac_bt_0015"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, AC_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, AC_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = ac_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[ac_bt_0015] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_ac_bt_0015; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[ac_bt_0015] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 매입 배치 결과 [ac_bt_0015] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[ac_bt_0015] 배치 시작 date=%s", biz_date); + + rc = ac_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[ac_bt_0015] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_ac_bt_0015(biz_date); + + ac_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[ac_bt_0015] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/ac_bt_0016.c b/app/batch/ac_bt_0016.c new file mode 100644 index 0000000..4de7d1c --- /dev/null +++ b/app/batch/ac_bt_0016.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/ac_bt_0016.pgc" +/* @tier easy @module ac @transform acquire-batch */ +/* + * ac_bt_0016.pgc - 매입 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: ac_bt_0016 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "ac_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/ac_bt_0016.pgc" + + +static int run_ac_bt_0016(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/ac_bt_0016.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/ac_bt_0016.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/ac_bt_0016.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/ac_bt_0016.pgc" + long h_amount ; + +#line 28 "app/batch/ac_bt_0016.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/ac_bt_0016.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_ac_bt_0016 cursor for select key , merch_id , amount from ac_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/ac_bt_0016.pgc" + +#line 42 "app/batch/ac_bt_0016.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_ac_bt_0016 cursor for select key , merch_id , amount from ac_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/ac_bt_0016.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_ac_bt_0016"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[ac_bt_0016] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_ac_bt_0016", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/ac_bt_0016.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_ac_bt_0016"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, AC_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, AC_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = ac_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[ac_bt_0016] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_ac_bt_0016", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/ac_bt_0016.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[ac_bt_0016] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 매입 배치 결과 [ac_bt_0016] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[ac_bt_0016] 배치 시작 date=%s", biz_date); + + rc = ac_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[ac_bt_0016] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_ac_bt_0016(biz_date); + + ac_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[ac_bt_0016] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/ac_bt_0016.pgc b/app/batch/ac_bt_0016.pgc new file mode 100644 index 0000000..2489854 --- /dev/null +++ b/app/batch/ac_bt_0016.pgc @@ -0,0 +1,138 @@ +/* @tier easy @module ac @transform acquire-batch */ +/* + * ac_bt_0016.pgc - 매입 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: ac_bt_0016 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "ac_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_ac_bt_0016(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_ac_bt_0016 CURSOR FOR + SELECT key, merch_id, amount + FROM ac_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_ac_bt_0016; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_ac_bt_0016"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[ac_bt_0016] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_ac_bt_0016 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_ac_bt_0016"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, AC_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, AC_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = ac_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[ac_bt_0016] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_ac_bt_0016; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[ac_bt_0016] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 매입 배치 결과 [ac_bt_0016] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[ac_bt_0016] 배치 시작 date=%s", biz_date); + + rc = ac_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[ac_bt_0016] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_ac_bt_0016(biz_date); + + ac_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[ac_bt_0016] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/ac_bt_0017.c b/app/batch/ac_bt_0017.c new file mode 100644 index 0000000..b2624d0 --- /dev/null +++ b/app/batch/ac_bt_0017.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/ac_bt_0017.pgc" +/* @tier hard @module ac @transform acquire-batch */ +/* + * ac_bt_0017.pgc - 매입 배치 (커서 순회 + 상태전이) [tier=hard] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: ac_bt_0017 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "ac_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/ac_bt_0017.pgc" + + +static int run_ac_bt_0017(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/ac_bt_0017.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/ac_bt_0017.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/ac_bt_0017.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/ac_bt_0017.pgc" + long h_amount ; + +#line 28 "app/batch/ac_bt_0017.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/ac_bt_0017.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_ac_bt_0017 cursor for select key , merch_id , amount from ac_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/ac_bt_0017.pgc" + +#line 42 "app/batch/ac_bt_0017.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_ac_bt_0017 cursor for select key , merch_id , amount from ac_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/ac_bt_0017.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_ac_bt_0017"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[ac_bt_0017] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_ac_bt_0017", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/ac_bt_0017.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_ac_bt_0017"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, AC_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, AC_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = ac_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[ac_bt_0017] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_ac_bt_0017", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/ac_bt_0017.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[ac_bt_0017] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 매입 배치 결과 [ac_bt_0017] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[ac_bt_0017] 배치 시작 date=%s", biz_date); + + rc = ac_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[ac_bt_0017] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_ac_bt_0017(biz_date); + + ac_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[ac_bt_0017] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/ac_bt_0017.pgc b/app/batch/ac_bt_0017.pgc new file mode 100644 index 0000000..8faac49 --- /dev/null +++ b/app/batch/ac_bt_0017.pgc @@ -0,0 +1,138 @@ +/* @tier hard @module ac @transform acquire-batch */ +/* + * ac_bt_0017.pgc - 매입 배치 (커서 순회 + 상태전이) [tier=hard] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: ac_bt_0017 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "ac_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_ac_bt_0017(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_ac_bt_0017 CURSOR FOR + SELECT key, merch_id, amount + FROM ac_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_ac_bt_0017; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_ac_bt_0017"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[ac_bt_0017] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_ac_bt_0017 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_ac_bt_0017"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, AC_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, AC_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = ac_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[ac_bt_0017] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_ac_bt_0017; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[ac_bt_0017] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 매입 배치 결과 [ac_bt_0017] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[ac_bt_0017] 배치 시작 date=%s", biz_date); + + rc = ac_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[ac_bt_0017] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_ac_bt_0017(biz_date); + + ac_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[ac_bt_0017] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/au_bt_0001.c b/app/batch/au_bt_0001.c new file mode 100644 index 0000000..db872f0 --- /dev/null +++ b/app/batch/au_bt_0001.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/au_bt_0001.pgc" +/* @tier easy @module au @transform authorization-batch */ +/* + * au_bt_0001.pgc - 승인한도 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: au_bt_0001 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "au_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/au_bt_0001.pgc" + + +static int run_au_bt_0001(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/au_bt_0001.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/au_bt_0001.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/au_bt_0001.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/au_bt_0001.pgc" + long h_amount ; + +#line 28 "app/batch/au_bt_0001.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/au_bt_0001.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_au_bt_0001 cursor for select key , merch_id , amount from au_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/au_bt_0001.pgc" + +#line 42 "app/batch/au_bt_0001.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_au_bt_0001 cursor for select key , merch_id , amount from au_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/au_bt_0001.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_au_bt_0001"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[au_bt_0001] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_au_bt_0001", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/au_bt_0001.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_au_bt_0001"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, AU_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, AU_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = au_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[au_bt_0001] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_au_bt_0001", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/au_bt_0001.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[au_bt_0001] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 승인한도 배치 결과 [au_bt_0001] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[au_bt_0001] 배치 시작 date=%s", biz_date); + + rc = au_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[au_bt_0001] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_au_bt_0001(biz_date); + + au_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[au_bt_0001] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/au_bt_0001.pgc b/app/batch/au_bt_0001.pgc new file mode 100644 index 0000000..9a931fe --- /dev/null +++ b/app/batch/au_bt_0001.pgc @@ -0,0 +1,138 @@ +/* @tier easy @module au @transform authorization-batch */ +/* + * au_bt_0001.pgc - 승인한도 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: au_bt_0001 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "au_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_au_bt_0001(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_au_bt_0001 CURSOR FOR + SELECT key, merch_id, amount + FROM au_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_au_bt_0001; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_au_bt_0001"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[au_bt_0001] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_au_bt_0001 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_au_bt_0001"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, AU_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, AU_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = au_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[au_bt_0001] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_au_bt_0001; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[au_bt_0001] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 승인한도 배치 결과 [au_bt_0001] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[au_bt_0001] 배치 시작 date=%s", biz_date); + + rc = au_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[au_bt_0001] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_au_bt_0001(biz_date); + + au_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[au_bt_0001] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/au_bt_0002.c b/app/batch/au_bt_0002.c new file mode 100644 index 0000000..b7c1fd4 --- /dev/null +++ b/app/batch/au_bt_0002.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/au_bt_0002.pgc" +/* @tier medium @module au @transform authorization-batch */ +/* + * au_bt_0002.pgc - 승인한도 배치 (커서 순회 + 상태전이) [tier=medium] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: au_bt_0002 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "au_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/au_bt_0002.pgc" + + +static int run_au_bt_0002(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/au_bt_0002.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/au_bt_0002.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/au_bt_0002.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/au_bt_0002.pgc" + long h_amount ; + +#line 28 "app/batch/au_bt_0002.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/au_bt_0002.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_au_bt_0002 cursor for select key , merch_id , amount from au_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/au_bt_0002.pgc" + +#line 42 "app/batch/au_bt_0002.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_au_bt_0002 cursor for select key , merch_id , amount from au_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/au_bt_0002.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_au_bt_0002"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[au_bt_0002] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_au_bt_0002", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/au_bt_0002.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_au_bt_0002"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, AU_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, AU_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = au_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[au_bt_0002] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_au_bt_0002", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/au_bt_0002.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[au_bt_0002] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 승인한도 배치 결과 [au_bt_0002] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[au_bt_0002] 배치 시작 date=%s", biz_date); + + rc = au_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[au_bt_0002] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_au_bt_0002(biz_date); + + au_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[au_bt_0002] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/au_bt_0002.pgc b/app/batch/au_bt_0002.pgc new file mode 100644 index 0000000..55882eb --- /dev/null +++ b/app/batch/au_bt_0002.pgc @@ -0,0 +1,138 @@ +/* @tier medium @module au @transform authorization-batch */ +/* + * au_bt_0002.pgc - 승인한도 배치 (커서 순회 + 상태전이) [tier=medium] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: au_bt_0002 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "au_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_au_bt_0002(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_au_bt_0002 CURSOR FOR + SELECT key, merch_id, amount + FROM au_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_au_bt_0002; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_au_bt_0002"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[au_bt_0002] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_au_bt_0002 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_au_bt_0002"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, AU_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, AU_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = au_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[au_bt_0002] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_au_bt_0002; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[au_bt_0002] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 승인한도 배치 결과 [au_bt_0002] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[au_bt_0002] 배치 시작 date=%s", biz_date); + + rc = au_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[au_bt_0002] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_au_bt_0002(biz_date); + + au_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[au_bt_0002] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/au_bt_0003.c b/app/batch/au_bt_0003.c new file mode 100644 index 0000000..60d9efa --- /dev/null +++ b/app/batch/au_bt_0003.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/au_bt_0003.pgc" +/* @tier easy @module au @transform authorization-batch */ +/* + * au_bt_0003.pgc - 승인한도 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: au_bt_0003 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "au_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/au_bt_0003.pgc" + + +static int run_au_bt_0003(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/au_bt_0003.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/au_bt_0003.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/au_bt_0003.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/au_bt_0003.pgc" + long h_amount ; + +#line 28 "app/batch/au_bt_0003.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/au_bt_0003.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_au_bt_0003 cursor for select key , merch_id , amount from au_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/au_bt_0003.pgc" + +#line 42 "app/batch/au_bt_0003.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_au_bt_0003 cursor for select key , merch_id , amount from au_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/au_bt_0003.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_au_bt_0003"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[au_bt_0003] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_au_bt_0003", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/au_bt_0003.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_au_bt_0003"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, AU_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, AU_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = au_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[au_bt_0003] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_au_bt_0003", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/au_bt_0003.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[au_bt_0003] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 승인한도 배치 결과 [au_bt_0003] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[au_bt_0003] 배치 시작 date=%s", biz_date); + + rc = au_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[au_bt_0003] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_au_bt_0003(biz_date); + + au_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[au_bt_0003] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/au_bt_0003.pgc b/app/batch/au_bt_0003.pgc new file mode 100644 index 0000000..c4d823d --- /dev/null +++ b/app/batch/au_bt_0003.pgc @@ -0,0 +1,138 @@ +/* @tier easy @module au @transform authorization-batch */ +/* + * au_bt_0003.pgc - 승인한도 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: au_bt_0003 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "au_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_au_bt_0003(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_au_bt_0003 CURSOR FOR + SELECT key, merch_id, amount + FROM au_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_au_bt_0003; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_au_bt_0003"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[au_bt_0003] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_au_bt_0003 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_au_bt_0003"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, AU_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, AU_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = au_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[au_bt_0003] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_au_bt_0003; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[au_bt_0003] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 승인한도 배치 결과 [au_bt_0003] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[au_bt_0003] 배치 시작 date=%s", biz_date); + + rc = au_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[au_bt_0003] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_au_bt_0003(biz_date); + + au_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[au_bt_0003] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/au_bt_0004.c b/app/batch/au_bt_0004.c new file mode 100644 index 0000000..3ad3882 --- /dev/null +++ b/app/batch/au_bt_0004.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/au_bt_0004.pgc" +/* @tier medium @module au @transform authorization-batch */ +/* + * au_bt_0004.pgc - 승인한도 배치 (커서 순회 + 상태전이) [tier=medium] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: au_bt_0004 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "au_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/au_bt_0004.pgc" + + +static int run_au_bt_0004(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/au_bt_0004.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/au_bt_0004.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/au_bt_0004.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/au_bt_0004.pgc" + long h_amount ; + +#line 28 "app/batch/au_bt_0004.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/au_bt_0004.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_au_bt_0004 cursor for select key , merch_id , amount from au_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/au_bt_0004.pgc" + +#line 42 "app/batch/au_bt_0004.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_au_bt_0004 cursor for select key , merch_id , amount from au_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/au_bt_0004.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_au_bt_0004"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[au_bt_0004] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_au_bt_0004", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/au_bt_0004.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_au_bt_0004"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, AU_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, AU_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = au_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[au_bt_0004] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_au_bt_0004", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/au_bt_0004.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[au_bt_0004] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 승인한도 배치 결과 [au_bt_0004] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[au_bt_0004] 배치 시작 date=%s", biz_date); + + rc = au_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[au_bt_0004] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_au_bt_0004(biz_date); + + au_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[au_bt_0004] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/au_bt_0004.pgc b/app/batch/au_bt_0004.pgc new file mode 100644 index 0000000..3f7aeee --- /dev/null +++ b/app/batch/au_bt_0004.pgc @@ -0,0 +1,138 @@ +/* @tier medium @module au @transform authorization-batch */ +/* + * au_bt_0004.pgc - 승인한도 배치 (커서 순회 + 상태전이) [tier=medium] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: au_bt_0004 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "au_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_au_bt_0004(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_au_bt_0004 CURSOR FOR + SELECT key, merch_id, amount + FROM au_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_au_bt_0004; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_au_bt_0004"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[au_bt_0004] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_au_bt_0004 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_au_bt_0004"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, AU_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, AU_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = au_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[au_bt_0004] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_au_bt_0004; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[au_bt_0004] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 승인한도 배치 결과 [au_bt_0004] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[au_bt_0004] 배치 시작 date=%s", biz_date); + + rc = au_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[au_bt_0004] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_au_bt_0004(biz_date); + + au_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[au_bt_0004] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/au_bt_0005.c b/app/batch/au_bt_0005.c new file mode 100644 index 0000000..5ae0ae7 --- /dev/null +++ b/app/batch/au_bt_0005.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/au_bt_0005.pgc" +/* @tier easy @module au @transform authorization-batch */ +/* + * au_bt_0005.pgc - 승인한도 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: au_bt_0005 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "au_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/au_bt_0005.pgc" + + +static int run_au_bt_0005(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/au_bt_0005.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/au_bt_0005.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/au_bt_0005.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/au_bt_0005.pgc" + long h_amount ; + +#line 28 "app/batch/au_bt_0005.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/au_bt_0005.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_au_bt_0005 cursor for select key , merch_id , amount from au_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/au_bt_0005.pgc" + +#line 42 "app/batch/au_bt_0005.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_au_bt_0005 cursor for select key , merch_id , amount from au_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/au_bt_0005.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_au_bt_0005"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[au_bt_0005] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_au_bt_0005", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/au_bt_0005.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_au_bt_0005"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, AU_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, AU_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = au_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[au_bt_0005] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_au_bt_0005", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/au_bt_0005.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[au_bt_0005] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 승인한도 배치 결과 [au_bt_0005] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[au_bt_0005] 배치 시작 date=%s", biz_date); + + rc = au_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[au_bt_0005] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_au_bt_0005(biz_date); + + au_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[au_bt_0005] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/au_bt_0005.pgc b/app/batch/au_bt_0005.pgc new file mode 100644 index 0000000..53937c8 --- /dev/null +++ b/app/batch/au_bt_0005.pgc @@ -0,0 +1,138 @@ +/* @tier easy @module au @transform authorization-batch */ +/* + * au_bt_0005.pgc - 승인한도 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: au_bt_0005 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "au_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_au_bt_0005(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_au_bt_0005 CURSOR FOR + SELECT key, merch_id, amount + FROM au_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_au_bt_0005; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_au_bt_0005"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[au_bt_0005] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_au_bt_0005 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_au_bt_0005"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, AU_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, AU_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = au_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[au_bt_0005] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_au_bt_0005; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[au_bt_0005] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 승인한도 배치 결과 [au_bt_0005] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[au_bt_0005] 배치 시작 date=%s", biz_date); + + rc = au_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[au_bt_0005] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_au_bt_0005(biz_date); + + au_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[au_bt_0005] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/au_bt_0006.c b/app/batch/au_bt_0006.c new file mode 100644 index 0000000..b0ab237 --- /dev/null +++ b/app/batch/au_bt_0006.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/au_bt_0006.pgc" +/* @tier medium @module au @transform authorization-batch */ +/* + * au_bt_0006.pgc - 승인한도 배치 (커서 순회 + 상태전이) [tier=medium] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: au_bt_0006 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "au_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/au_bt_0006.pgc" + + +static int run_au_bt_0006(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/au_bt_0006.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/au_bt_0006.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/au_bt_0006.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/au_bt_0006.pgc" + long h_amount ; + +#line 28 "app/batch/au_bt_0006.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/au_bt_0006.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_au_bt_0006 cursor for select key , merch_id , amount from au_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/au_bt_0006.pgc" + +#line 42 "app/batch/au_bt_0006.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_au_bt_0006 cursor for select key , merch_id , amount from au_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/au_bt_0006.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_au_bt_0006"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[au_bt_0006] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_au_bt_0006", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/au_bt_0006.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_au_bt_0006"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, AU_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, AU_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = au_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[au_bt_0006] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_au_bt_0006", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/au_bt_0006.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[au_bt_0006] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 승인한도 배치 결과 [au_bt_0006] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[au_bt_0006] 배치 시작 date=%s", biz_date); + + rc = au_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[au_bt_0006] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_au_bt_0006(biz_date); + + au_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[au_bt_0006] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/au_bt_0006.pgc b/app/batch/au_bt_0006.pgc new file mode 100644 index 0000000..ab854a6 --- /dev/null +++ b/app/batch/au_bt_0006.pgc @@ -0,0 +1,138 @@ +/* @tier medium @module au @transform authorization-batch */ +/* + * au_bt_0006.pgc - 승인한도 배치 (커서 순회 + 상태전이) [tier=medium] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: au_bt_0006 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "au_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_au_bt_0006(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_au_bt_0006 CURSOR FOR + SELECT key, merch_id, amount + FROM au_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_au_bt_0006; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_au_bt_0006"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[au_bt_0006] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_au_bt_0006 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_au_bt_0006"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, AU_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, AU_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = au_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[au_bt_0006] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_au_bt_0006; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[au_bt_0006] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 승인한도 배치 결과 [au_bt_0006] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[au_bt_0006] 배치 시작 date=%s", biz_date); + + rc = au_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[au_bt_0006] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_au_bt_0006(biz_date); + + au_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[au_bt_0006] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/au_bt_0007.c b/app/batch/au_bt_0007.c new file mode 100644 index 0000000..8c08933 --- /dev/null +++ b/app/batch/au_bt_0007.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/au_bt_0007.pgc" +/* @tier easy @module au @transform authorization-batch */ +/* + * au_bt_0007.pgc - 승인한도 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: au_bt_0007 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "au_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/au_bt_0007.pgc" + + +static int run_au_bt_0007(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/au_bt_0007.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/au_bt_0007.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/au_bt_0007.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/au_bt_0007.pgc" + long h_amount ; + +#line 28 "app/batch/au_bt_0007.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/au_bt_0007.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_au_bt_0007 cursor for select key , merch_id , amount from au_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/au_bt_0007.pgc" + +#line 42 "app/batch/au_bt_0007.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_au_bt_0007 cursor for select key , merch_id , amount from au_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/au_bt_0007.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_au_bt_0007"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[au_bt_0007] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_au_bt_0007", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/au_bt_0007.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_au_bt_0007"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, AU_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, AU_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = au_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[au_bt_0007] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_au_bt_0007", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/au_bt_0007.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[au_bt_0007] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 승인한도 배치 결과 [au_bt_0007] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[au_bt_0007] 배치 시작 date=%s", biz_date); + + rc = au_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[au_bt_0007] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_au_bt_0007(biz_date); + + au_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[au_bt_0007] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/au_bt_0007.pgc b/app/batch/au_bt_0007.pgc new file mode 100644 index 0000000..232e769 --- /dev/null +++ b/app/batch/au_bt_0007.pgc @@ -0,0 +1,138 @@ +/* @tier easy @module au @transform authorization-batch */ +/* + * au_bt_0007.pgc - 승인한도 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: au_bt_0007 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "au_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_au_bt_0007(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_au_bt_0007 CURSOR FOR + SELECT key, merch_id, amount + FROM au_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_au_bt_0007; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_au_bt_0007"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[au_bt_0007] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_au_bt_0007 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_au_bt_0007"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, AU_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, AU_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = au_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[au_bt_0007] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_au_bt_0007; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[au_bt_0007] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 승인한도 배치 결과 [au_bt_0007] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[au_bt_0007] 배치 시작 date=%s", biz_date); + + rc = au_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[au_bt_0007] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_au_bt_0007(biz_date); + + au_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[au_bt_0007] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/au_bt_0008.c b/app/batch/au_bt_0008.c new file mode 100644 index 0000000..e890ae7 --- /dev/null +++ b/app/batch/au_bt_0008.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/au_bt_0008.pgc" +/* @tier hard @module au @transform authorization-batch */ +/* + * au_bt_0008.pgc - 승인한도 배치 (커서 순회 + 상태전이) [tier=hard] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: au_bt_0008 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "au_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/au_bt_0008.pgc" + + +static int run_au_bt_0008(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/au_bt_0008.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/au_bt_0008.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/au_bt_0008.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/au_bt_0008.pgc" + long h_amount ; + +#line 28 "app/batch/au_bt_0008.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/au_bt_0008.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_au_bt_0008 cursor for select key , merch_id , amount from au_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/au_bt_0008.pgc" + +#line 42 "app/batch/au_bt_0008.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_au_bt_0008 cursor for select key , merch_id , amount from au_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/au_bt_0008.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_au_bt_0008"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[au_bt_0008] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_au_bt_0008", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/au_bt_0008.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_au_bt_0008"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, AU_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, AU_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = au_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[au_bt_0008] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_au_bt_0008", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/au_bt_0008.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[au_bt_0008] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 승인한도 배치 결과 [au_bt_0008] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[au_bt_0008] 배치 시작 date=%s", biz_date); + + rc = au_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[au_bt_0008] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_au_bt_0008(biz_date); + + au_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[au_bt_0008] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/au_bt_0008.pgc b/app/batch/au_bt_0008.pgc new file mode 100644 index 0000000..4a1e8e9 --- /dev/null +++ b/app/batch/au_bt_0008.pgc @@ -0,0 +1,138 @@ +/* @tier hard @module au @transform authorization-batch */ +/* + * au_bt_0008.pgc - 승인한도 배치 (커서 순회 + 상태전이) [tier=hard] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: au_bt_0008 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "au_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_au_bt_0008(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_au_bt_0008 CURSOR FOR + SELECT key, merch_id, amount + FROM au_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_au_bt_0008; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_au_bt_0008"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[au_bt_0008] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_au_bt_0008 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_au_bt_0008"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, AU_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, AU_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = au_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[au_bt_0008] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_au_bt_0008; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[au_bt_0008] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 승인한도 배치 결과 [au_bt_0008] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[au_bt_0008] 배치 시작 date=%s", biz_date); + + rc = au_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[au_bt_0008] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_au_bt_0008(biz_date); + + au_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[au_bt_0008] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/au_bt_0009.c b/app/batch/au_bt_0009.c new file mode 100644 index 0000000..8b44fce --- /dev/null +++ b/app/batch/au_bt_0009.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/au_bt_0009.pgc" +/* @tier easy @module au @transform authorization-batch */ +/* + * au_bt_0009.pgc - 승인한도 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: au_bt_0009 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "au_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/au_bt_0009.pgc" + + +static int run_au_bt_0009(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/au_bt_0009.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/au_bt_0009.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/au_bt_0009.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/au_bt_0009.pgc" + long h_amount ; + +#line 28 "app/batch/au_bt_0009.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/au_bt_0009.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_au_bt_0009 cursor for select key , merch_id , amount from au_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/au_bt_0009.pgc" + +#line 42 "app/batch/au_bt_0009.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_au_bt_0009 cursor for select key , merch_id , amount from au_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/au_bt_0009.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_au_bt_0009"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[au_bt_0009] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_au_bt_0009", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/au_bt_0009.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_au_bt_0009"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, AU_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, AU_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = au_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[au_bt_0009] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_au_bt_0009", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/au_bt_0009.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[au_bt_0009] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 승인한도 배치 결과 [au_bt_0009] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[au_bt_0009] 배치 시작 date=%s", biz_date); + + rc = au_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[au_bt_0009] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_au_bt_0009(biz_date); + + au_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[au_bt_0009] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/au_bt_0009.pgc b/app/batch/au_bt_0009.pgc new file mode 100644 index 0000000..cf77c64 --- /dev/null +++ b/app/batch/au_bt_0009.pgc @@ -0,0 +1,138 @@ +/* @tier easy @module au @transform authorization-batch */ +/* + * au_bt_0009.pgc - 승인한도 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: au_bt_0009 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "au_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_au_bt_0009(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_au_bt_0009 CURSOR FOR + SELECT key, merch_id, amount + FROM au_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_au_bt_0009; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_au_bt_0009"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[au_bt_0009] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_au_bt_0009 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_au_bt_0009"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, AU_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, AU_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = au_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[au_bt_0009] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_au_bt_0009; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[au_bt_0009] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 승인한도 배치 결과 [au_bt_0009] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[au_bt_0009] 배치 시작 date=%s", biz_date); + + rc = au_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[au_bt_0009] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_au_bt_0009(biz_date); + + au_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[au_bt_0009] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/au_bt_0010.c b/app/batch/au_bt_0010.c new file mode 100644 index 0000000..5d65823 --- /dev/null +++ b/app/batch/au_bt_0010.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/au_bt_0010.pgc" +/* @tier easy @module au @transform authorization-batch */ +/* + * au_bt_0010.pgc - 승인한도 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: au_bt_0010 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "au_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/au_bt_0010.pgc" + + +static int run_au_bt_0010(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/au_bt_0010.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/au_bt_0010.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/au_bt_0010.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/au_bt_0010.pgc" + long h_amount ; + +#line 28 "app/batch/au_bt_0010.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/au_bt_0010.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_au_bt_0010 cursor for select key , merch_id , amount from au_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/au_bt_0010.pgc" + +#line 42 "app/batch/au_bt_0010.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_au_bt_0010 cursor for select key , merch_id , amount from au_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/au_bt_0010.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_au_bt_0010"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[au_bt_0010] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_au_bt_0010", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/au_bt_0010.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_au_bt_0010"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, AU_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, AU_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = au_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[au_bt_0010] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_au_bt_0010", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/au_bt_0010.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[au_bt_0010] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 승인한도 배치 결과 [au_bt_0010] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[au_bt_0010] 배치 시작 date=%s", biz_date); + + rc = au_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[au_bt_0010] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_au_bt_0010(biz_date); + + au_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[au_bt_0010] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/au_bt_0010.pgc b/app/batch/au_bt_0010.pgc new file mode 100644 index 0000000..301ce5f --- /dev/null +++ b/app/batch/au_bt_0010.pgc @@ -0,0 +1,138 @@ +/* @tier easy @module au @transform authorization-batch */ +/* + * au_bt_0010.pgc - 승인한도 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: au_bt_0010 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "au_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_au_bt_0010(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_au_bt_0010 CURSOR FOR + SELECT key, merch_id, amount + FROM au_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_au_bt_0010; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_au_bt_0010"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[au_bt_0010] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_au_bt_0010 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_au_bt_0010"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, AU_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, AU_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = au_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[au_bt_0010] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_au_bt_0010; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[au_bt_0010] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 승인한도 배치 결과 [au_bt_0010] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[au_bt_0010] 배치 시작 date=%s", biz_date); + + rc = au_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[au_bt_0010] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_au_bt_0010(biz_date); + + au_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[au_bt_0010] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/au_bt_0011.c b/app/batch/au_bt_0011.c new file mode 100644 index 0000000..3d27052 --- /dev/null +++ b/app/batch/au_bt_0011.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/au_bt_0011.pgc" +/* @tier medium @module au @transform authorization-batch */ +/* + * au_bt_0011.pgc - 승인한도 배치 (커서 순회 + 상태전이) [tier=medium] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: au_bt_0011 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "au_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/au_bt_0011.pgc" + + +static int run_au_bt_0011(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/au_bt_0011.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/au_bt_0011.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/au_bt_0011.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/au_bt_0011.pgc" + long h_amount ; + +#line 28 "app/batch/au_bt_0011.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/au_bt_0011.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_au_bt_0011 cursor for select key , merch_id , amount from au_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/au_bt_0011.pgc" + +#line 42 "app/batch/au_bt_0011.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_au_bt_0011 cursor for select key , merch_id , amount from au_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/au_bt_0011.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_au_bt_0011"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[au_bt_0011] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_au_bt_0011", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/au_bt_0011.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_au_bt_0011"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, AU_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, AU_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = au_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[au_bt_0011] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_au_bt_0011", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/au_bt_0011.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[au_bt_0011] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 승인한도 배치 결과 [au_bt_0011] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[au_bt_0011] 배치 시작 date=%s", biz_date); + + rc = au_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[au_bt_0011] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_au_bt_0011(biz_date); + + au_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[au_bt_0011] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/au_bt_0011.pgc b/app/batch/au_bt_0011.pgc new file mode 100644 index 0000000..80bda60 --- /dev/null +++ b/app/batch/au_bt_0011.pgc @@ -0,0 +1,138 @@ +/* @tier medium @module au @transform authorization-batch */ +/* + * au_bt_0011.pgc - 승인한도 배치 (커서 순회 + 상태전이) [tier=medium] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: au_bt_0011 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "au_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_au_bt_0011(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_au_bt_0011 CURSOR FOR + SELECT key, merch_id, amount + FROM au_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_au_bt_0011; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_au_bt_0011"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[au_bt_0011] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_au_bt_0011 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_au_bt_0011"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, AU_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, AU_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = au_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[au_bt_0011] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_au_bt_0011; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[au_bt_0011] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 승인한도 배치 결과 [au_bt_0011] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[au_bt_0011] 배치 시작 date=%s", biz_date); + + rc = au_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[au_bt_0011] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_au_bt_0011(biz_date); + + au_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[au_bt_0011] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/au_bt_0012.c b/app/batch/au_bt_0012.c new file mode 100644 index 0000000..d6ea300 --- /dev/null +++ b/app/batch/au_bt_0012.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/au_bt_0012.pgc" +/* @tier easy @module au @transform authorization-batch */ +/* + * au_bt_0012.pgc - 승인한도 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: au_bt_0012 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "au_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/au_bt_0012.pgc" + + +static int run_au_bt_0012(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/au_bt_0012.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/au_bt_0012.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/au_bt_0012.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/au_bt_0012.pgc" + long h_amount ; + +#line 28 "app/batch/au_bt_0012.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/au_bt_0012.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_au_bt_0012 cursor for select key , merch_id , amount from au_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/au_bt_0012.pgc" + +#line 42 "app/batch/au_bt_0012.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_au_bt_0012 cursor for select key , merch_id , amount from au_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/au_bt_0012.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_au_bt_0012"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[au_bt_0012] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_au_bt_0012", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/au_bt_0012.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_au_bt_0012"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, AU_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, AU_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = au_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[au_bt_0012] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_au_bt_0012", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/au_bt_0012.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[au_bt_0012] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 승인한도 배치 결과 [au_bt_0012] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[au_bt_0012] 배치 시작 date=%s", biz_date); + + rc = au_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[au_bt_0012] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_au_bt_0012(biz_date); + + au_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[au_bt_0012] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/au_bt_0012.pgc b/app/batch/au_bt_0012.pgc new file mode 100644 index 0000000..7fc41ae --- /dev/null +++ b/app/batch/au_bt_0012.pgc @@ -0,0 +1,138 @@ +/* @tier easy @module au @transform authorization-batch */ +/* + * au_bt_0012.pgc - 승인한도 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: au_bt_0012 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "au_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_au_bt_0012(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_au_bt_0012 CURSOR FOR + SELECT key, merch_id, amount + FROM au_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_au_bt_0012; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_au_bt_0012"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[au_bt_0012] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_au_bt_0012 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_au_bt_0012"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, AU_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, AU_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = au_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[au_bt_0012] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_au_bt_0012; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[au_bt_0012] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 승인한도 배치 결과 [au_bt_0012] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[au_bt_0012] 배치 시작 date=%s", biz_date); + + rc = au_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[au_bt_0012] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_au_bt_0012(biz_date); + + au_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[au_bt_0012] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/au_bt_0013.c b/app/batch/au_bt_0013.c new file mode 100644 index 0000000..0006da4 --- /dev/null +++ b/app/batch/au_bt_0013.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/au_bt_0013.pgc" +/* @tier medium @module au @transform authorization-batch */ +/* + * au_bt_0013.pgc - 승인한도 배치 (커서 순회 + 상태전이) [tier=medium] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: au_bt_0013 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "au_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/au_bt_0013.pgc" + + +static int run_au_bt_0013(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/au_bt_0013.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/au_bt_0013.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/au_bt_0013.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/au_bt_0013.pgc" + long h_amount ; + +#line 28 "app/batch/au_bt_0013.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/au_bt_0013.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_au_bt_0013 cursor for select key , merch_id , amount from au_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/au_bt_0013.pgc" + +#line 42 "app/batch/au_bt_0013.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_au_bt_0013 cursor for select key , merch_id , amount from au_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/au_bt_0013.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_au_bt_0013"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[au_bt_0013] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_au_bt_0013", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/au_bt_0013.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_au_bt_0013"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, AU_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, AU_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = au_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[au_bt_0013] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_au_bt_0013", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/au_bt_0013.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[au_bt_0013] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 승인한도 배치 결과 [au_bt_0013] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[au_bt_0013] 배치 시작 date=%s", biz_date); + + rc = au_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[au_bt_0013] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_au_bt_0013(biz_date); + + au_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[au_bt_0013] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/au_bt_0013.pgc b/app/batch/au_bt_0013.pgc new file mode 100644 index 0000000..34c40c0 --- /dev/null +++ b/app/batch/au_bt_0013.pgc @@ -0,0 +1,138 @@ +/* @tier medium @module au @transform authorization-batch */ +/* + * au_bt_0013.pgc - 승인한도 배치 (커서 순회 + 상태전이) [tier=medium] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: au_bt_0013 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "au_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_au_bt_0013(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_au_bt_0013 CURSOR FOR + SELECT key, merch_id, amount + FROM au_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_au_bt_0013; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_au_bt_0013"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[au_bt_0013] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_au_bt_0013 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_au_bt_0013"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, AU_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, AU_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = au_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[au_bt_0013] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_au_bt_0013; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[au_bt_0013] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 승인한도 배치 결과 [au_bt_0013] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[au_bt_0013] 배치 시작 date=%s", biz_date); + + rc = au_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[au_bt_0013] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_au_bt_0013(biz_date); + + au_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[au_bt_0013] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/au_bt_0014.c b/app/batch/au_bt_0014.c new file mode 100644 index 0000000..9633630 --- /dev/null +++ b/app/batch/au_bt_0014.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/au_bt_0014.pgc" +/* @tier easy @module au @transform authorization-batch */ +/* + * au_bt_0014.pgc - 승인한도 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: au_bt_0014 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "au_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/au_bt_0014.pgc" + + +static int run_au_bt_0014(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/au_bt_0014.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/au_bt_0014.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/au_bt_0014.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/au_bt_0014.pgc" + long h_amount ; + +#line 28 "app/batch/au_bt_0014.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/au_bt_0014.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_au_bt_0014 cursor for select key , merch_id , amount from au_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/au_bt_0014.pgc" + +#line 42 "app/batch/au_bt_0014.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_au_bt_0014 cursor for select key , merch_id , amount from au_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/au_bt_0014.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_au_bt_0014"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[au_bt_0014] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_au_bt_0014", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/au_bt_0014.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_au_bt_0014"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, AU_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, AU_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = au_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[au_bt_0014] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_au_bt_0014", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/au_bt_0014.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[au_bt_0014] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 승인한도 배치 결과 [au_bt_0014] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[au_bt_0014] 배치 시작 date=%s", biz_date); + + rc = au_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[au_bt_0014] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_au_bt_0014(biz_date); + + au_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[au_bt_0014] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/au_bt_0014.pgc b/app/batch/au_bt_0014.pgc new file mode 100644 index 0000000..13cc4c0 --- /dev/null +++ b/app/batch/au_bt_0014.pgc @@ -0,0 +1,138 @@ +/* @tier easy @module au @transform authorization-batch */ +/* + * au_bt_0014.pgc - 승인한도 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: au_bt_0014 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "au_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_au_bt_0014(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_au_bt_0014 CURSOR FOR + SELECT key, merch_id, amount + FROM au_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_au_bt_0014; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_au_bt_0014"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[au_bt_0014] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_au_bt_0014 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_au_bt_0014"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, AU_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, AU_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = au_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[au_bt_0014] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_au_bt_0014; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[au_bt_0014] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 승인한도 배치 결과 [au_bt_0014] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[au_bt_0014] 배치 시작 date=%s", biz_date); + + rc = au_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[au_bt_0014] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_au_bt_0014(biz_date); + + au_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[au_bt_0014] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/au_bt_0015.c b/app/batch/au_bt_0015.c new file mode 100644 index 0000000..910b359 --- /dev/null +++ b/app/batch/au_bt_0015.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/au_bt_0015.pgc" +/* @tier medium @module au @transform authorization-batch */ +/* + * au_bt_0015.pgc - 승인한도 배치 (커서 순회 + 상태전이) [tier=medium] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: au_bt_0015 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "au_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/au_bt_0015.pgc" + + +static int run_au_bt_0015(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/au_bt_0015.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/au_bt_0015.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/au_bt_0015.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/au_bt_0015.pgc" + long h_amount ; + +#line 28 "app/batch/au_bt_0015.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/au_bt_0015.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_au_bt_0015 cursor for select key , merch_id , amount from au_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/au_bt_0015.pgc" + +#line 42 "app/batch/au_bt_0015.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_au_bt_0015 cursor for select key , merch_id , amount from au_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/au_bt_0015.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_au_bt_0015"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[au_bt_0015] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_au_bt_0015", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/au_bt_0015.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_au_bt_0015"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, AU_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, AU_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = au_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[au_bt_0015] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_au_bt_0015", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/au_bt_0015.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[au_bt_0015] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 승인한도 배치 결과 [au_bt_0015] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[au_bt_0015] 배치 시작 date=%s", biz_date); + + rc = au_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[au_bt_0015] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_au_bt_0015(biz_date); + + au_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[au_bt_0015] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/au_bt_0015.pgc b/app/batch/au_bt_0015.pgc new file mode 100644 index 0000000..c9f530c --- /dev/null +++ b/app/batch/au_bt_0015.pgc @@ -0,0 +1,138 @@ +/* @tier medium @module au @transform authorization-batch */ +/* + * au_bt_0015.pgc - 승인한도 배치 (커서 순회 + 상태전이) [tier=medium] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: au_bt_0015 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "au_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_au_bt_0015(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_au_bt_0015 CURSOR FOR + SELECT key, merch_id, amount + FROM au_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_au_bt_0015; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_au_bt_0015"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[au_bt_0015] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_au_bt_0015 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_au_bt_0015"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, AU_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, AU_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = au_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[au_bt_0015] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_au_bt_0015; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[au_bt_0015] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 승인한도 배치 결과 [au_bt_0015] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[au_bt_0015] 배치 시작 date=%s", biz_date); + + rc = au_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[au_bt_0015] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_au_bt_0015(biz_date); + + au_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[au_bt_0015] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/au_bt_0016.c b/app/batch/au_bt_0016.c new file mode 100644 index 0000000..5166d71 --- /dev/null +++ b/app/batch/au_bt_0016.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/au_bt_0016.pgc" +/* @tier easy @module au @transform authorization-batch */ +/* + * au_bt_0016.pgc - 승인한도 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: au_bt_0016 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "au_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/au_bt_0016.pgc" + + +static int run_au_bt_0016(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/au_bt_0016.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/au_bt_0016.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/au_bt_0016.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/au_bt_0016.pgc" + long h_amount ; + +#line 28 "app/batch/au_bt_0016.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/au_bt_0016.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_au_bt_0016 cursor for select key , merch_id , amount from au_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/au_bt_0016.pgc" + +#line 42 "app/batch/au_bt_0016.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_au_bt_0016 cursor for select key , merch_id , amount from au_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/au_bt_0016.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_au_bt_0016"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[au_bt_0016] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_au_bt_0016", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/au_bt_0016.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_au_bt_0016"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, AU_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, AU_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = au_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[au_bt_0016] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_au_bt_0016", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/au_bt_0016.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[au_bt_0016] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 승인한도 배치 결과 [au_bt_0016] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[au_bt_0016] 배치 시작 date=%s", biz_date); + + rc = au_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[au_bt_0016] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_au_bt_0016(biz_date); + + au_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[au_bt_0016] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/au_bt_0016.pgc b/app/batch/au_bt_0016.pgc new file mode 100644 index 0000000..2b400be --- /dev/null +++ b/app/batch/au_bt_0016.pgc @@ -0,0 +1,138 @@ +/* @tier easy @module au @transform authorization-batch */ +/* + * au_bt_0016.pgc - 승인한도 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: au_bt_0016 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "au_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_au_bt_0016(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_au_bt_0016 CURSOR FOR + SELECT key, merch_id, amount + FROM au_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_au_bt_0016; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_au_bt_0016"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[au_bt_0016] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_au_bt_0016 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_au_bt_0016"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, AU_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, AU_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = au_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[au_bt_0016] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_au_bt_0016; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[au_bt_0016] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 승인한도 배치 결과 [au_bt_0016] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[au_bt_0016] 배치 시작 date=%s", biz_date); + + rc = au_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[au_bt_0016] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_au_bt_0016(biz_date); + + au_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[au_bt_0016] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/au_bt_0017.c b/app/batch/au_bt_0017.c new file mode 100644 index 0000000..feb9e77 --- /dev/null +++ b/app/batch/au_bt_0017.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/au_bt_0017.pgc" +/* @tier hard @module au @transform authorization-batch */ +/* + * au_bt_0017.pgc - 승인한도 배치 (커서 순회 + 상태전이) [tier=hard] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: au_bt_0017 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "au_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/au_bt_0017.pgc" + + +static int run_au_bt_0017(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/au_bt_0017.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/au_bt_0017.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/au_bt_0017.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/au_bt_0017.pgc" + long h_amount ; + +#line 28 "app/batch/au_bt_0017.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/au_bt_0017.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_au_bt_0017 cursor for select key , merch_id , amount from au_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/au_bt_0017.pgc" + +#line 42 "app/batch/au_bt_0017.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_au_bt_0017 cursor for select key , merch_id , amount from au_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/au_bt_0017.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_au_bt_0017"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[au_bt_0017] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_au_bt_0017", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/au_bt_0017.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_au_bt_0017"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, AU_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, AU_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = au_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[au_bt_0017] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_au_bt_0017", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/au_bt_0017.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[au_bt_0017] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 승인한도 배치 결과 [au_bt_0017] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[au_bt_0017] 배치 시작 date=%s", biz_date); + + rc = au_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[au_bt_0017] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_au_bt_0017(biz_date); + + au_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[au_bt_0017] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/au_bt_0017.pgc b/app/batch/au_bt_0017.pgc new file mode 100644 index 0000000..91fd30a --- /dev/null +++ b/app/batch/au_bt_0017.pgc @@ -0,0 +1,138 @@ +/* @tier hard @module au @transform authorization-batch */ +/* + * au_bt_0017.pgc - 승인한도 배치 (커서 순회 + 상태전이) [tier=hard] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: au_bt_0017 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "au_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_au_bt_0017(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_au_bt_0017 CURSOR FOR + SELECT key, merch_id, amount + FROM au_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_au_bt_0017; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_au_bt_0017"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[au_bt_0017] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_au_bt_0017 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_au_bt_0017"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, AU_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, AU_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = au_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[au_bt_0017] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_au_bt_0017; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[au_bt_0017] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 승인한도 배치 결과 [au_bt_0017] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[au_bt_0017] 배치 시작 date=%s", biz_date); + + rc = au_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[au_bt_0017] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_au_bt_0017(biz_date); + + au_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[au_bt_0017] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/cl_bt_0001.c b/app/batch/cl_bt_0001.c new file mode 100644 index 0000000..9221abc --- /dev/null +++ b/app/batch/cl_bt_0001.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/cl_bt_0001.pgc" +/* @tier easy @module cl @transform closing-batch */ +/* + * cl_bt_0001.pgc - 마감 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: cl_bt_0001 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "cl_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/cl_bt_0001.pgc" + + +static int run_cl_bt_0001(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/cl_bt_0001.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/cl_bt_0001.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/cl_bt_0001.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/cl_bt_0001.pgc" + long h_amount ; + +#line 28 "app/batch/cl_bt_0001.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/cl_bt_0001.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_cl_bt_0001 cursor for select key , merch_id , amount from cl_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/cl_bt_0001.pgc" + +#line 42 "app/batch/cl_bt_0001.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_cl_bt_0001 cursor for select key , merch_id , amount from cl_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/cl_bt_0001.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_cl_bt_0001"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[cl_bt_0001] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_cl_bt_0001", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/cl_bt_0001.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_cl_bt_0001"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, CL_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, CL_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = cl_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cl_bt_0001] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_cl_bt_0001", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/cl_bt_0001.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[cl_bt_0001] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 마감 배치 결과 [cl_bt_0001] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[cl_bt_0001] 배치 시작 date=%s", biz_date); + + rc = cl_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cl_bt_0001] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_cl_bt_0001(biz_date); + + cl_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[cl_bt_0001] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/cl_bt_0001.pgc b/app/batch/cl_bt_0001.pgc new file mode 100644 index 0000000..d494b24 --- /dev/null +++ b/app/batch/cl_bt_0001.pgc @@ -0,0 +1,138 @@ +/* @tier easy @module cl @transform closing-batch */ +/* + * cl_bt_0001.pgc - 마감 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: cl_bt_0001 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "cl_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_cl_bt_0001(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_cl_bt_0001 CURSOR FOR + SELECT key, merch_id, amount + FROM cl_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_cl_bt_0001; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_cl_bt_0001"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[cl_bt_0001] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_cl_bt_0001 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_cl_bt_0001"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, CL_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, CL_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = cl_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cl_bt_0001] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_cl_bt_0001; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[cl_bt_0001] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 마감 배치 결과 [cl_bt_0001] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[cl_bt_0001] 배치 시작 date=%s", biz_date); + + rc = cl_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cl_bt_0001] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_cl_bt_0001(biz_date); + + cl_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[cl_bt_0001] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/cl_bt_0002.c b/app/batch/cl_bt_0002.c new file mode 100644 index 0000000..24ea845 --- /dev/null +++ b/app/batch/cl_bt_0002.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/cl_bt_0002.pgc" +/* @tier easy @module cl @transform closing-batch */ +/* + * cl_bt_0002.pgc - 마감 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: cl_bt_0002 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "cl_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/cl_bt_0002.pgc" + + +static int run_cl_bt_0002(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/cl_bt_0002.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/cl_bt_0002.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/cl_bt_0002.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/cl_bt_0002.pgc" + long h_amount ; + +#line 28 "app/batch/cl_bt_0002.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/cl_bt_0002.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_cl_bt_0002 cursor for select key , merch_id , amount from cl_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/cl_bt_0002.pgc" + +#line 42 "app/batch/cl_bt_0002.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_cl_bt_0002 cursor for select key , merch_id , amount from cl_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/cl_bt_0002.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_cl_bt_0002"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[cl_bt_0002] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_cl_bt_0002", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/cl_bt_0002.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_cl_bt_0002"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, CL_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, CL_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = cl_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cl_bt_0002] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_cl_bt_0002", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/cl_bt_0002.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[cl_bt_0002] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 마감 배치 결과 [cl_bt_0002] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[cl_bt_0002] 배치 시작 date=%s", biz_date); + + rc = cl_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cl_bt_0002] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_cl_bt_0002(biz_date); + + cl_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[cl_bt_0002] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/cl_bt_0002.pgc b/app/batch/cl_bt_0002.pgc new file mode 100644 index 0000000..5474878 --- /dev/null +++ b/app/batch/cl_bt_0002.pgc @@ -0,0 +1,138 @@ +/* @tier easy @module cl @transform closing-batch */ +/* + * cl_bt_0002.pgc - 마감 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: cl_bt_0002 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "cl_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_cl_bt_0002(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_cl_bt_0002 CURSOR FOR + SELECT key, merch_id, amount + FROM cl_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_cl_bt_0002; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_cl_bt_0002"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[cl_bt_0002] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_cl_bt_0002 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_cl_bt_0002"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, CL_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, CL_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = cl_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cl_bt_0002] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_cl_bt_0002; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[cl_bt_0002] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 마감 배치 결과 [cl_bt_0002] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[cl_bt_0002] 배치 시작 date=%s", biz_date); + + rc = cl_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cl_bt_0002] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_cl_bt_0002(biz_date); + + cl_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[cl_bt_0002] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/cl_bt_0003.c b/app/batch/cl_bt_0003.c new file mode 100644 index 0000000..5a04bb8 --- /dev/null +++ b/app/batch/cl_bt_0003.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/cl_bt_0003.pgc" +/* @tier medium @module cl @transform closing-batch */ +/* + * cl_bt_0003.pgc - 마감 배치 (커서 순회 + 상태전이) [tier=medium] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: cl_bt_0003 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "cl_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/cl_bt_0003.pgc" + + +static int run_cl_bt_0003(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/cl_bt_0003.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/cl_bt_0003.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/cl_bt_0003.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/cl_bt_0003.pgc" + long h_amount ; + +#line 28 "app/batch/cl_bt_0003.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/cl_bt_0003.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_cl_bt_0003 cursor for select key , merch_id , amount from cl_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/cl_bt_0003.pgc" + +#line 42 "app/batch/cl_bt_0003.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_cl_bt_0003 cursor for select key , merch_id , amount from cl_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/cl_bt_0003.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_cl_bt_0003"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[cl_bt_0003] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_cl_bt_0003", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/cl_bt_0003.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_cl_bt_0003"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, CL_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, CL_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = cl_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cl_bt_0003] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_cl_bt_0003", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/cl_bt_0003.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[cl_bt_0003] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 마감 배치 결과 [cl_bt_0003] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[cl_bt_0003] 배치 시작 date=%s", biz_date); + + rc = cl_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cl_bt_0003] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_cl_bt_0003(biz_date); + + cl_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[cl_bt_0003] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/cl_bt_0003.pgc b/app/batch/cl_bt_0003.pgc new file mode 100644 index 0000000..cfa5aa2 --- /dev/null +++ b/app/batch/cl_bt_0003.pgc @@ -0,0 +1,138 @@ +/* @tier medium @module cl @transform closing-batch */ +/* + * cl_bt_0003.pgc - 마감 배치 (커서 순회 + 상태전이) [tier=medium] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: cl_bt_0003 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "cl_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_cl_bt_0003(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_cl_bt_0003 CURSOR FOR + SELECT key, merch_id, amount + FROM cl_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_cl_bt_0003; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_cl_bt_0003"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[cl_bt_0003] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_cl_bt_0003 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_cl_bt_0003"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, CL_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, CL_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = cl_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cl_bt_0003] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_cl_bt_0003; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[cl_bt_0003] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 마감 배치 결과 [cl_bt_0003] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[cl_bt_0003] 배치 시작 date=%s", biz_date); + + rc = cl_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cl_bt_0003] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_cl_bt_0003(biz_date); + + cl_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[cl_bt_0003] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/cl_bt_0004.c b/app/batch/cl_bt_0004.c new file mode 100644 index 0000000..80b6ea6 --- /dev/null +++ b/app/batch/cl_bt_0004.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/cl_bt_0004.pgc" +/* @tier easy @module cl @transform closing-batch */ +/* + * cl_bt_0004.pgc - 마감 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: cl_bt_0004 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "cl_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/cl_bt_0004.pgc" + + +static int run_cl_bt_0004(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/cl_bt_0004.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/cl_bt_0004.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/cl_bt_0004.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/cl_bt_0004.pgc" + long h_amount ; + +#line 28 "app/batch/cl_bt_0004.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/cl_bt_0004.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_cl_bt_0004 cursor for select key , merch_id , amount from cl_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/cl_bt_0004.pgc" + +#line 42 "app/batch/cl_bt_0004.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_cl_bt_0004 cursor for select key , merch_id , amount from cl_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/cl_bt_0004.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_cl_bt_0004"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[cl_bt_0004] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_cl_bt_0004", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/cl_bt_0004.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_cl_bt_0004"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, CL_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, CL_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = cl_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cl_bt_0004] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_cl_bt_0004", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/cl_bt_0004.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[cl_bt_0004] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 마감 배치 결과 [cl_bt_0004] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[cl_bt_0004] 배치 시작 date=%s", biz_date); + + rc = cl_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cl_bt_0004] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_cl_bt_0004(biz_date); + + cl_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[cl_bt_0004] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/cl_bt_0004.pgc b/app/batch/cl_bt_0004.pgc new file mode 100644 index 0000000..92166d4 --- /dev/null +++ b/app/batch/cl_bt_0004.pgc @@ -0,0 +1,138 @@ +/* @tier easy @module cl @transform closing-batch */ +/* + * cl_bt_0004.pgc - 마감 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: cl_bt_0004 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "cl_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_cl_bt_0004(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_cl_bt_0004 CURSOR FOR + SELECT key, merch_id, amount + FROM cl_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_cl_bt_0004; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_cl_bt_0004"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[cl_bt_0004] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_cl_bt_0004 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_cl_bt_0004"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, CL_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, CL_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = cl_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cl_bt_0004] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_cl_bt_0004; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[cl_bt_0004] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 마감 배치 결과 [cl_bt_0004] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[cl_bt_0004] 배치 시작 date=%s", biz_date); + + rc = cl_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cl_bt_0004] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_cl_bt_0004(biz_date); + + cl_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[cl_bt_0004] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/cl_bt_0005.c b/app/batch/cl_bt_0005.c new file mode 100644 index 0000000..4396d22 --- /dev/null +++ b/app/batch/cl_bt_0005.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/cl_bt_0005.pgc" +/* @tier medium @module cl @transform closing-batch */ +/* + * cl_bt_0005.pgc - 마감 배치 (커서 순회 + 상태전이) [tier=medium] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: cl_bt_0005 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "cl_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/cl_bt_0005.pgc" + + +static int run_cl_bt_0005(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/cl_bt_0005.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/cl_bt_0005.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/cl_bt_0005.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/cl_bt_0005.pgc" + long h_amount ; + +#line 28 "app/batch/cl_bt_0005.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/cl_bt_0005.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_cl_bt_0005 cursor for select key , merch_id , amount from cl_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/cl_bt_0005.pgc" + +#line 42 "app/batch/cl_bt_0005.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_cl_bt_0005 cursor for select key , merch_id , amount from cl_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/cl_bt_0005.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_cl_bt_0005"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[cl_bt_0005] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_cl_bt_0005", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/cl_bt_0005.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_cl_bt_0005"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, CL_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, CL_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = cl_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cl_bt_0005] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_cl_bt_0005", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/cl_bt_0005.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[cl_bt_0005] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 마감 배치 결과 [cl_bt_0005] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[cl_bt_0005] 배치 시작 date=%s", biz_date); + + rc = cl_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cl_bt_0005] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_cl_bt_0005(biz_date); + + cl_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[cl_bt_0005] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/cl_bt_0005.pgc b/app/batch/cl_bt_0005.pgc new file mode 100644 index 0000000..53e9eea --- /dev/null +++ b/app/batch/cl_bt_0005.pgc @@ -0,0 +1,138 @@ +/* @tier medium @module cl @transform closing-batch */ +/* + * cl_bt_0005.pgc - 마감 배치 (커서 순회 + 상태전이) [tier=medium] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: cl_bt_0005 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "cl_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_cl_bt_0005(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_cl_bt_0005 CURSOR FOR + SELECT key, merch_id, amount + FROM cl_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_cl_bt_0005; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_cl_bt_0005"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[cl_bt_0005] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_cl_bt_0005 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_cl_bt_0005"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, CL_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, CL_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = cl_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cl_bt_0005] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_cl_bt_0005; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[cl_bt_0005] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 마감 배치 결과 [cl_bt_0005] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[cl_bt_0005] 배치 시작 date=%s", biz_date); + + rc = cl_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cl_bt_0005] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_cl_bt_0005(biz_date); + + cl_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[cl_bt_0005] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/cl_bt_0006.c b/app/batch/cl_bt_0006.c new file mode 100644 index 0000000..214f074 --- /dev/null +++ b/app/batch/cl_bt_0006.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/cl_bt_0006.pgc" +/* @tier easy @module cl @transform closing-batch */ +/* + * cl_bt_0006.pgc - 마감 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: cl_bt_0006 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "cl_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/cl_bt_0006.pgc" + + +static int run_cl_bt_0006(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/cl_bt_0006.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/cl_bt_0006.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/cl_bt_0006.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/cl_bt_0006.pgc" + long h_amount ; + +#line 28 "app/batch/cl_bt_0006.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/cl_bt_0006.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_cl_bt_0006 cursor for select key , merch_id , amount from cl_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/cl_bt_0006.pgc" + +#line 42 "app/batch/cl_bt_0006.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_cl_bt_0006 cursor for select key , merch_id , amount from cl_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/cl_bt_0006.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_cl_bt_0006"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[cl_bt_0006] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_cl_bt_0006", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/cl_bt_0006.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_cl_bt_0006"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, CL_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, CL_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = cl_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cl_bt_0006] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_cl_bt_0006", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/cl_bt_0006.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[cl_bt_0006] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 마감 배치 결과 [cl_bt_0006] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[cl_bt_0006] 배치 시작 date=%s", biz_date); + + rc = cl_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cl_bt_0006] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_cl_bt_0006(biz_date); + + cl_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[cl_bt_0006] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/cl_bt_0006.pgc b/app/batch/cl_bt_0006.pgc new file mode 100644 index 0000000..dfa170c --- /dev/null +++ b/app/batch/cl_bt_0006.pgc @@ -0,0 +1,138 @@ +/* @tier easy @module cl @transform closing-batch */ +/* + * cl_bt_0006.pgc - 마감 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: cl_bt_0006 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "cl_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_cl_bt_0006(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_cl_bt_0006 CURSOR FOR + SELECT key, merch_id, amount + FROM cl_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_cl_bt_0006; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_cl_bt_0006"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[cl_bt_0006] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_cl_bt_0006 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_cl_bt_0006"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, CL_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, CL_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = cl_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cl_bt_0006] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_cl_bt_0006; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[cl_bt_0006] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 마감 배치 결과 [cl_bt_0006] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[cl_bt_0006] 배치 시작 date=%s", biz_date); + + rc = cl_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cl_bt_0006] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_cl_bt_0006(biz_date); + + cl_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[cl_bt_0006] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/cl_bt_0007.c b/app/batch/cl_bt_0007.c new file mode 100644 index 0000000..9ea2fa8 --- /dev/null +++ b/app/batch/cl_bt_0007.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/cl_bt_0007.pgc" +/* @tier medium @module cl @transform closing-batch */ +/* + * cl_bt_0007.pgc - 마감 배치 (커서 순회 + 상태전이) [tier=medium] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: cl_bt_0007 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "cl_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/cl_bt_0007.pgc" + + +static int run_cl_bt_0007(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/cl_bt_0007.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/cl_bt_0007.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/cl_bt_0007.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/cl_bt_0007.pgc" + long h_amount ; + +#line 28 "app/batch/cl_bt_0007.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/cl_bt_0007.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_cl_bt_0007 cursor for select key , merch_id , amount from cl_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/cl_bt_0007.pgc" + +#line 42 "app/batch/cl_bt_0007.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_cl_bt_0007 cursor for select key , merch_id , amount from cl_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/cl_bt_0007.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_cl_bt_0007"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[cl_bt_0007] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_cl_bt_0007", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/cl_bt_0007.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_cl_bt_0007"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, CL_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, CL_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = cl_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cl_bt_0007] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_cl_bt_0007", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/cl_bt_0007.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[cl_bt_0007] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 마감 배치 결과 [cl_bt_0007] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[cl_bt_0007] 배치 시작 date=%s", biz_date); + + rc = cl_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cl_bt_0007] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_cl_bt_0007(biz_date); + + cl_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[cl_bt_0007] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/cl_bt_0007.pgc b/app/batch/cl_bt_0007.pgc new file mode 100644 index 0000000..c5e49da --- /dev/null +++ b/app/batch/cl_bt_0007.pgc @@ -0,0 +1,138 @@ +/* @tier medium @module cl @transform closing-batch */ +/* + * cl_bt_0007.pgc - 마감 배치 (커서 순회 + 상태전이) [tier=medium] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: cl_bt_0007 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "cl_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_cl_bt_0007(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_cl_bt_0007 CURSOR FOR + SELECT key, merch_id, amount + FROM cl_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_cl_bt_0007; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_cl_bt_0007"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[cl_bt_0007] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_cl_bt_0007 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_cl_bt_0007"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, CL_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, CL_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = cl_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cl_bt_0007] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_cl_bt_0007; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[cl_bt_0007] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 마감 배치 결과 [cl_bt_0007] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[cl_bt_0007] 배치 시작 date=%s", biz_date); + + rc = cl_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cl_bt_0007] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_cl_bt_0007(biz_date); + + cl_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[cl_bt_0007] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/cl_bt_0008.c b/app/batch/cl_bt_0008.c new file mode 100644 index 0000000..2e41a18 --- /dev/null +++ b/app/batch/cl_bt_0008.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/cl_bt_0008.pgc" +/* @tier easy @module cl @transform closing-batch */ +/* + * cl_bt_0008.pgc - 마감 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: cl_bt_0008 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "cl_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/cl_bt_0008.pgc" + + +static int run_cl_bt_0008(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/cl_bt_0008.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/cl_bt_0008.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/cl_bt_0008.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/cl_bt_0008.pgc" + long h_amount ; + +#line 28 "app/batch/cl_bt_0008.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/cl_bt_0008.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_cl_bt_0008 cursor for select key , merch_id , amount from cl_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/cl_bt_0008.pgc" + +#line 42 "app/batch/cl_bt_0008.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_cl_bt_0008 cursor for select key , merch_id , amount from cl_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/cl_bt_0008.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_cl_bt_0008"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[cl_bt_0008] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_cl_bt_0008", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/cl_bt_0008.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_cl_bt_0008"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, CL_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, CL_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = cl_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cl_bt_0008] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_cl_bt_0008", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/cl_bt_0008.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[cl_bt_0008] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 마감 배치 결과 [cl_bt_0008] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[cl_bt_0008] 배치 시작 date=%s", biz_date); + + rc = cl_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cl_bt_0008] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_cl_bt_0008(biz_date); + + cl_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[cl_bt_0008] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/cl_bt_0008.pgc b/app/batch/cl_bt_0008.pgc new file mode 100644 index 0000000..0792886 --- /dev/null +++ b/app/batch/cl_bt_0008.pgc @@ -0,0 +1,138 @@ +/* @tier easy @module cl @transform closing-batch */ +/* + * cl_bt_0008.pgc - 마감 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: cl_bt_0008 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "cl_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_cl_bt_0008(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_cl_bt_0008 CURSOR FOR + SELECT key, merch_id, amount + FROM cl_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_cl_bt_0008; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_cl_bt_0008"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[cl_bt_0008] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_cl_bt_0008 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_cl_bt_0008"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, CL_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, CL_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = cl_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cl_bt_0008] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_cl_bt_0008; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[cl_bt_0008] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 마감 배치 결과 [cl_bt_0008] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[cl_bt_0008] 배치 시작 date=%s", biz_date); + + rc = cl_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cl_bt_0008] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_cl_bt_0008(biz_date); + + cl_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[cl_bt_0008] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/cl_bt_0009.c b/app/batch/cl_bt_0009.c new file mode 100644 index 0000000..fd7fe95 --- /dev/null +++ b/app/batch/cl_bt_0009.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/cl_bt_0009.pgc" +/* @tier hard @module cl @transform closing-batch */ +/* + * cl_bt_0009.pgc - 마감 배치 (커서 순회 + 상태전이) [tier=hard] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: cl_bt_0009 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "cl_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/cl_bt_0009.pgc" + + +static int run_cl_bt_0009(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/cl_bt_0009.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/cl_bt_0009.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/cl_bt_0009.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/cl_bt_0009.pgc" + long h_amount ; + +#line 28 "app/batch/cl_bt_0009.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/cl_bt_0009.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_cl_bt_0009 cursor for select key , merch_id , amount from cl_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/cl_bt_0009.pgc" + +#line 42 "app/batch/cl_bt_0009.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_cl_bt_0009 cursor for select key , merch_id , amount from cl_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/cl_bt_0009.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_cl_bt_0009"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[cl_bt_0009] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_cl_bt_0009", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/cl_bt_0009.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_cl_bt_0009"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, CL_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, CL_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = cl_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cl_bt_0009] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_cl_bt_0009", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/cl_bt_0009.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[cl_bt_0009] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 마감 배치 결과 [cl_bt_0009] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[cl_bt_0009] 배치 시작 date=%s", biz_date); + + rc = cl_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cl_bt_0009] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_cl_bt_0009(biz_date); + + cl_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[cl_bt_0009] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/cl_bt_0009.pgc b/app/batch/cl_bt_0009.pgc new file mode 100644 index 0000000..090e143 --- /dev/null +++ b/app/batch/cl_bt_0009.pgc @@ -0,0 +1,138 @@ +/* @tier hard @module cl @transform closing-batch */ +/* + * cl_bt_0009.pgc - 마감 배치 (커서 순회 + 상태전이) [tier=hard] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: cl_bt_0009 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "cl_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_cl_bt_0009(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_cl_bt_0009 CURSOR FOR + SELECT key, merch_id, amount + FROM cl_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_cl_bt_0009; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_cl_bt_0009"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[cl_bt_0009] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_cl_bt_0009 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_cl_bt_0009"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, CL_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, CL_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = cl_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cl_bt_0009] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_cl_bt_0009; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[cl_bt_0009] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 마감 배치 결과 [cl_bt_0009] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[cl_bt_0009] 배치 시작 date=%s", biz_date); + + rc = cl_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cl_bt_0009] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_cl_bt_0009(biz_date); + + cl_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[cl_bt_0009] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/cl_bt_0010.c b/app/batch/cl_bt_0010.c new file mode 100644 index 0000000..db55cde --- /dev/null +++ b/app/batch/cl_bt_0010.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/cl_bt_0010.pgc" +/* @tier easy @module cl @transform closing-batch */ +/* + * cl_bt_0010.pgc - 마감 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: cl_bt_0010 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "cl_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/cl_bt_0010.pgc" + + +static int run_cl_bt_0010(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/cl_bt_0010.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/cl_bt_0010.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/cl_bt_0010.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/cl_bt_0010.pgc" + long h_amount ; + +#line 28 "app/batch/cl_bt_0010.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/cl_bt_0010.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_cl_bt_0010 cursor for select key , merch_id , amount from cl_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/cl_bt_0010.pgc" + +#line 42 "app/batch/cl_bt_0010.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_cl_bt_0010 cursor for select key , merch_id , amount from cl_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/cl_bt_0010.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_cl_bt_0010"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[cl_bt_0010] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_cl_bt_0010", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/cl_bt_0010.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_cl_bt_0010"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, CL_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, CL_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = cl_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cl_bt_0010] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_cl_bt_0010", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/cl_bt_0010.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[cl_bt_0010] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 마감 배치 결과 [cl_bt_0010] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[cl_bt_0010] 배치 시작 date=%s", biz_date); + + rc = cl_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cl_bt_0010] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_cl_bt_0010(biz_date); + + cl_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[cl_bt_0010] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/cl_bt_0010.pgc b/app/batch/cl_bt_0010.pgc new file mode 100644 index 0000000..9fddbaf --- /dev/null +++ b/app/batch/cl_bt_0010.pgc @@ -0,0 +1,138 @@ +/* @tier easy @module cl @transform closing-batch */ +/* + * cl_bt_0010.pgc - 마감 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: cl_bt_0010 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "cl_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_cl_bt_0010(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_cl_bt_0010 CURSOR FOR + SELECT key, merch_id, amount + FROM cl_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_cl_bt_0010; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_cl_bt_0010"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[cl_bt_0010] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_cl_bt_0010 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_cl_bt_0010"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, CL_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, CL_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = cl_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cl_bt_0010] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_cl_bt_0010; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[cl_bt_0010] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 마감 배치 결과 [cl_bt_0010] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[cl_bt_0010] 배치 시작 date=%s", biz_date); + + rc = cl_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cl_bt_0010] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_cl_bt_0010(biz_date); + + cl_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[cl_bt_0010] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/cl_bt_0011.c b/app/batch/cl_bt_0011.c new file mode 100644 index 0000000..286f0f4 --- /dev/null +++ b/app/batch/cl_bt_0011.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/cl_bt_0011.pgc" +/* @tier easy @module cl @transform closing-batch */ +/* + * cl_bt_0011.pgc - 마감 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: cl_bt_0011 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "cl_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/cl_bt_0011.pgc" + + +static int run_cl_bt_0011(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/cl_bt_0011.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/cl_bt_0011.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/cl_bt_0011.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/cl_bt_0011.pgc" + long h_amount ; + +#line 28 "app/batch/cl_bt_0011.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/cl_bt_0011.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_cl_bt_0011 cursor for select key , merch_id , amount from cl_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/cl_bt_0011.pgc" + +#line 42 "app/batch/cl_bt_0011.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_cl_bt_0011 cursor for select key , merch_id , amount from cl_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/cl_bt_0011.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_cl_bt_0011"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[cl_bt_0011] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_cl_bt_0011", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/cl_bt_0011.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_cl_bt_0011"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, CL_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, CL_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = cl_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cl_bt_0011] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_cl_bt_0011", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/cl_bt_0011.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[cl_bt_0011] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 마감 배치 결과 [cl_bt_0011] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[cl_bt_0011] 배치 시작 date=%s", biz_date); + + rc = cl_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cl_bt_0011] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_cl_bt_0011(biz_date); + + cl_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[cl_bt_0011] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/cl_bt_0011.pgc b/app/batch/cl_bt_0011.pgc new file mode 100644 index 0000000..a0dd04a --- /dev/null +++ b/app/batch/cl_bt_0011.pgc @@ -0,0 +1,138 @@ +/* @tier easy @module cl @transform closing-batch */ +/* + * cl_bt_0011.pgc - 마감 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: cl_bt_0011 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "cl_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_cl_bt_0011(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_cl_bt_0011 CURSOR FOR + SELECT key, merch_id, amount + FROM cl_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_cl_bt_0011; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_cl_bt_0011"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[cl_bt_0011] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_cl_bt_0011 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_cl_bt_0011"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, CL_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, CL_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = cl_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cl_bt_0011] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_cl_bt_0011; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[cl_bt_0011] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 마감 배치 결과 [cl_bt_0011] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[cl_bt_0011] 배치 시작 date=%s", biz_date); + + rc = cl_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cl_bt_0011] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_cl_bt_0011(biz_date); + + cl_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[cl_bt_0011] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/cl_bt_0012.c b/app/batch/cl_bt_0012.c new file mode 100644 index 0000000..f364986 --- /dev/null +++ b/app/batch/cl_bt_0012.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/cl_bt_0012.pgc" +/* @tier medium @module cl @transform closing-batch */ +/* + * cl_bt_0012.pgc - 마감 배치 (커서 순회 + 상태전이) [tier=medium] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: cl_bt_0012 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "cl_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/cl_bt_0012.pgc" + + +static int run_cl_bt_0012(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/cl_bt_0012.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/cl_bt_0012.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/cl_bt_0012.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/cl_bt_0012.pgc" + long h_amount ; + +#line 28 "app/batch/cl_bt_0012.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/cl_bt_0012.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_cl_bt_0012 cursor for select key , merch_id , amount from cl_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/cl_bt_0012.pgc" + +#line 42 "app/batch/cl_bt_0012.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_cl_bt_0012 cursor for select key , merch_id , amount from cl_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/cl_bt_0012.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_cl_bt_0012"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[cl_bt_0012] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_cl_bt_0012", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/cl_bt_0012.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_cl_bt_0012"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, CL_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, CL_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = cl_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cl_bt_0012] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_cl_bt_0012", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/cl_bt_0012.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[cl_bt_0012] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 마감 배치 결과 [cl_bt_0012] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[cl_bt_0012] 배치 시작 date=%s", biz_date); + + rc = cl_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cl_bt_0012] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_cl_bt_0012(biz_date); + + cl_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[cl_bt_0012] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/cl_bt_0012.pgc b/app/batch/cl_bt_0012.pgc new file mode 100644 index 0000000..883d566 --- /dev/null +++ b/app/batch/cl_bt_0012.pgc @@ -0,0 +1,138 @@ +/* @tier medium @module cl @transform closing-batch */ +/* + * cl_bt_0012.pgc - 마감 배치 (커서 순회 + 상태전이) [tier=medium] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: cl_bt_0012 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "cl_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_cl_bt_0012(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_cl_bt_0012 CURSOR FOR + SELECT key, merch_id, amount + FROM cl_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_cl_bt_0012; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_cl_bt_0012"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[cl_bt_0012] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_cl_bt_0012 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_cl_bt_0012"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, CL_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, CL_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = cl_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cl_bt_0012] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_cl_bt_0012; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[cl_bt_0012] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 마감 배치 결과 [cl_bt_0012] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[cl_bt_0012] 배치 시작 date=%s", biz_date); + + rc = cl_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cl_bt_0012] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_cl_bt_0012(biz_date); + + cl_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[cl_bt_0012] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/cl_bt_0013.c b/app/batch/cl_bt_0013.c new file mode 100644 index 0000000..e1bcef8 --- /dev/null +++ b/app/batch/cl_bt_0013.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/cl_bt_0013.pgc" +/* @tier easy @module cl @transform closing-batch */ +/* + * cl_bt_0013.pgc - 마감 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: cl_bt_0013 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "cl_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/cl_bt_0013.pgc" + + +static int run_cl_bt_0013(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/cl_bt_0013.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/cl_bt_0013.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/cl_bt_0013.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/cl_bt_0013.pgc" + long h_amount ; + +#line 28 "app/batch/cl_bt_0013.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/cl_bt_0013.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_cl_bt_0013 cursor for select key , merch_id , amount from cl_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/cl_bt_0013.pgc" + +#line 42 "app/batch/cl_bt_0013.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_cl_bt_0013 cursor for select key , merch_id , amount from cl_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/cl_bt_0013.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_cl_bt_0013"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[cl_bt_0013] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_cl_bt_0013", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/cl_bt_0013.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_cl_bt_0013"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, CL_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, CL_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = cl_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cl_bt_0013] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_cl_bt_0013", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/cl_bt_0013.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[cl_bt_0013] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 마감 배치 결과 [cl_bt_0013] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[cl_bt_0013] 배치 시작 date=%s", biz_date); + + rc = cl_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cl_bt_0013] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_cl_bt_0013(biz_date); + + cl_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[cl_bt_0013] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/cl_bt_0013.pgc b/app/batch/cl_bt_0013.pgc new file mode 100644 index 0000000..97c31e0 --- /dev/null +++ b/app/batch/cl_bt_0013.pgc @@ -0,0 +1,138 @@ +/* @tier easy @module cl @transform closing-batch */ +/* + * cl_bt_0013.pgc - 마감 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: cl_bt_0013 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "cl_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_cl_bt_0013(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_cl_bt_0013 CURSOR FOR + SELECT key, merch_id, amount + FROM cl_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_cl_bt_0013; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_cl_bt_0013"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[cl_bt_0013] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_cl_bt_0013 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_cl_bt_0013"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, CL_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, CL_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = cl_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cl_bt_0013] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_cl_bt_0013; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[cl_bt_0013] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 마감 배치 결과 [cl_bt_0013] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[cl_bt_0013] 배치 시작 date=%s", biz_date); + + rc = cl_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cl_bt_0013] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_cl_bt_0013(biz_date); + + cl_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[cl_bt_0013] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/cl_bt_0014.c b/app/batch/cl_bt_0014.c new file mode 100644 index 0000000..06069bd --- /dev/null +++ b/app/batch/cl_bt_0014.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/cl_bt_0014.pgc" +/* @tier medium @module cl @transform closing-batch */ +/* + * cl_bt_0014.pgc - 마감 배치 (커서 순회 + 상태전이) [tier=medium] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: cl_bt_0014 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "cl_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/cl_bt_0014.pgc" + + +static int run_cl_bt_0014(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/cl_bt_0014.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/cl_bt_0014.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/cl_bt_0014.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/cl_bt_0014.pgc" + long h_amount ; + +#line 28 "app/batch/cl_bt_0014.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/cl_bt_0014.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_cl_bt_0014 cursor for select key , merch_id , amount from cl_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/cl_bt_0014.pgc" + +#line 42 "app/batch/cl_bt_0014.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_cl_bt_0014 cursor for select key , merch_id , amount from cl_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/cl_bt_0014.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_cl_bt_0014"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[cl_bt_0014] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_cl_bt_0014", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/cl_bt_0014.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_cl_bt_0014"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, CL_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, CL_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = cl_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cl_bt_0014] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_cl_bt_0014", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/cl_bt_0014.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[cl_bt_0014] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 마감 배치 결과 [cl_bt_0014] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[cl_bt_0014] 배치 시작 date=%s", biz_date); + + rc = cl_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cl_bt_0014] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_cl_bt_0014(biz_date); + + cl_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[cl_bt_0014] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/cl_bt_0014.pgc b/app/batch/cl_bt_0014.pgc new file mode 100644 index 0000000..05caf58 --- /dev/null +++ b/app/batch/cl_bt_0014.pgc @@ -0,0 +1,138 @@ +/* @tier medium @module cl @transform closing-batch */ +/* + * cl_bt_0014.pgc - 마감 배치 (커서 순회 + 상태전이) [tier=medium] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: cl_bt_0014 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "cl_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_cl_bt_0014(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_cl_bt_0014 CURSOR FOR + SELECT key, merch_id, amount + FROM cl_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_cl_bt_0014; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_cl_bt_0014"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[cl_bt_0014] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_cl_bt_0014 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_cl_bt_0014"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, CL_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, CL_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = cl_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cl_bt_0014] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_cl_bt_0014; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[cl_bt_0014] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 마감 배치 결과 [cl_bt_0014] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[cl_bt_0014] 배치 시작 date=%s", biz_date); + + rc = cl_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cl_bt_0014] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_cl_bt_0014(biz_date); + + cl_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[cl_bt_0014] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/cl_bt_0015.c b/app/batch/cl_bt_0015.c new file mode 100644 index 0000000..24f6dfd --- /dev/null +++ b/app/batch/cl_bt_0015.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/cl_bt_0015.pgc" +/* @tier easy @module cl @transform closing-batch */ +/* + * cl_bt_0015.pgc - 마감 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: cl_bt_0015 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "cl_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/cl_bt_0015.pgc" + + +static int run_cl_bt_0015(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/cl_bt_0015.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/cl_bt_0015.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/cl_bt_0015.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/cl_bt_0015.pgc" + long h_amount ; + +#line 28 "app/batch/cl_bt_0015.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/cl_bt_0015.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_cl_bt_0015 cursor for select key , merch_id , amount from cl_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/cl_bt_0015.pgc" + +#line 42 "app/batch/cl_bt_0015.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_cl_bt_0015 cursor for select key , merch_id , amount from cl_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/cl_bt_0015.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_cl_bt_0015"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[cl_bt_0015] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_cl_bt_0015", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/cl_bt_0015.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_cl_bt_0015"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, CL_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, CL_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = cl_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cl_bt_0015] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_cl_bt_0015", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/cl_bt_0015.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[cl_bt_0015] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 마감 배치 결과 [cl_bt_0015] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[cl_bt_0015] 배치 시작 date=%s", biz_date); + + rc = cl_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cl_bt_0015] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_cl_bt_0015(biz_date); + + cl_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[cl_bt_0015] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/cl_bt_0015.pgc b/app/batch/cl_bt_0015.pgc new file mode 100644 index 0000000..fa73e1a --- /dev/null +++ b/app/batch/cl_bt_0015.pgc @@ -0,0 +1,138 @@ +/* @tier easy @module cl @transform closing-batch */ +/* + * cl_bt_0015.pgc - 마감 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: cl_bt_0015 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "cl_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_cl_bt_0015(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_cl_bt_0015 CURSOR FOR + SELECT key, merch_id, amount + FROM cl_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_cl_bt_0015; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_cl_bt_0015"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[cl_bt_0015] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_cl_bt_0015 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_cl_bt_0015"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, CL_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, CL_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = cl_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cl_bt_0015] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_cl_bt_0015; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[cl_bt_0015] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 마감 배치 결과 [cl_bt_0015] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[cl_bt_0015] 배치 시작 date=%s", biz_date); + + rc = cl_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cl_bt_0015] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_cl_bt_0015(biz_date); + + cl_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[cl_bt_0015] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/cl_bt_0016.c b/app/batch/cl_bt_0016.c new file mode 100644 index 0000000..0487828 --- /dev/null +++ b/app/batch/cl_bt_0016.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/cl_bt_0016.pgc" +/* @tier medium @module cl @transform closing-batch */ +/* + * cl_bt_0016.pgc - 마감 배치 (커서 순회 + 상태전이) [tier=medium] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: cl_bt_0016 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "cl_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/cl_bt_0016.pgc" + + +static int run_cl_bt_0016(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/cl_bt_0016.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/cl_bt_0016.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/cl_bt_0016.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/cl_bt_0016.pgc" + long h_amount ; + +#line 28 "app/batch/cl_bt_0016.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/cl_bt_0016.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_cl_bt_0016 cursor for select key , merch_id , amount from cl_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/cl_bt_0016.pgc" + +#line 42 "app/batch/cl_bt_0016.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_cl_bt_0016 cursor for select key , merch_id , amount from cl_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/cl_bt_0016.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_cl_bt_0016"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[cl_bt_0016] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_cl_bt_0016", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/cl_bt_0016.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_cl_bt_0016"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, CL_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, CL_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = cl_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cl_bt_0016] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_cl_bt_0016", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/cl_bt_0016.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[cl_bt_0016] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 마감 배치 결과 [cl_bt_0016] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[cl_bt_0016] 배치 시작 date=%s", biz_date); + + rc = cl_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cl_bt_0016] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_cl_bt_0016(biz_date); + + cl_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[cl_bt_0016] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/cl_bt_0016.pgc b/app/batch/cl_bt_0016.pgc new file mode 100644 index 0000000..1d7400b --- /dev/null +++ b/app/batch/cl_bt_0016.pgc @@ -0,0 +1,138 @@ +/* @tier medium @module cl @transform closing-batch */ +/* + * cl_bt_0016.pgc - 마감 배치 (커서 순회 + 상태전이) [tier=medium] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: cl_bt_0016 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "cl_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_cl_bt_0016(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_cl_bt_0016 CURSOR FOR + SELECT key, merch_id, amount + FROM cl_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_cl_bt_0016; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_cl_bt_0016"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[cl_bt_0016] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_cl_bt_0016 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_cl_bt_0016"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, CL_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, CL_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = cl_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cl_bt_0016] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_cl_bt_0016; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[cl_bt_0016] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 마감 배치 결과 [cl_bt_0016] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[cl_bt_0016] 배치 시작 date=%s", biz_date); + + rc = cl_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cl_bt_0016] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_cl_bt_0016(biz_date); + + cl_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[cl_bt_0016] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/cm_bt_0001.c b/app/batch/cm_bt_0001.c new file mode 100644 index 0000000..f150945 --- /dev/null +++ b/app/batch/cm_bt_0001.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/cm_bt_0001.pgc" +/* @tier easy @module cm @transform common-batch */ +/* + * cm_bt_0001.pgc - 공통 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: cm_bt_0001 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "cm_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/cm_bt_0001.pgc" + + +static int run_cm_bt_0001(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/cm_bt_0001.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/cm_bt_0001.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/cm_bt_0001.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/cm_bt_0001.pgc" + long h_amount ; + +#line 28 "app/batch/cm_bt_0001.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/cm_bt_0001.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_cm_bt_0001 cursor for select key , merch_id , amount from cm_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/cm_bt_0001.pgc" + +#line 42 "app/batch/cm_bt_0001.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_cm_bt_0001 cursor for select key , merch_id , amount from cm_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/cm_bt_0001.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_cm_bt_0001"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[cm_bt_0001] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_cm_bt_0001", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/cm_bt_0001.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_cm_bt_0001"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, CM_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, CM_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = cm_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cm_bt_0001] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_cm_bt_0001", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/cm_bt_0001.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[cm_bt_0001] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 공통 배치 결과 [cm_bt_0001] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[cm_bt_0001] 배치 시작 date=%s", biz_date); + + rc = cm_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cm_bt_0001] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_cm_bt_0001(biz_date); + + cm_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[cm_bt_0001] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/cm_bt_0001.pgc b/app/batch/cm_bt_0001.pgc new file mode 100644 index 0000000..5294241 --- /dev/null +++ b/app/batch/cm_bt_0001.pgc @@ -0,0 +1,138 @@ +/* @tier easy @module cm @transform common-batch */ +/* + * cm_bt_0001.pgc - 공통 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: cm_bt_0001 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "cm_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_cm_bt_0001(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_cm_bt_0001 CURSOR FOR + SELECT key, merch_id, amount + FROM cm_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_cm_bt_0001; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_cm_bt_0001"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[cm_bt_0001] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_cm_bt_0001 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_cm_bt_0001"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, CM_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, CM_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = cm_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cm_bt_0001] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_cm_bt_0001; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[cm_bt_0001] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 공통 배치 결과 [cm_bt_0001] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[cm_bt_0001] 배치 시작 date=%s", biz_date); + + rc = cm_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cm_bt_0001] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_cm_bt_0001(biz_date); + + cm_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[cm_bt_0001] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/cm_bt_0002.c b/app/batch/cm_bt_0002.c new file mode 100644 index 0000000..cfb3b0f --- /dev/null +++ b/app/batch/cm_bt_0002.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/cm_bt_0002.pgc" +/* @tier easy @module cm @transform common-batch */ +/* + * cm_bt_0002.pgc - 공통 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: cm_bt_0002 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "cm_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/cm_bt_0002.pgc" + + +static int run_cm_bt_0002(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/cm_bt_0002.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/cm_bt_0002.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/cm_bt_0002.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/cm_bt_0002.pgc" + long h_amount ; + +#line 28 "app/batch/cm_bt_0002.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/cm_bt_0002.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_cm_bt_0002 cursor for select key , merch_id , amount from cm_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/cm_bt_0002.pgc" + +#line 42 "app/batch/cm_bt_0002.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_cm_bt_0002 cursor for select key , merch_id , amount from cm_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/cm_bt_0002.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_cm_bt_0002"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[cm_bt_0002] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_cm_bt_0002", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/cm_bt_0002.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_cm_bt_0002"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, CM_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, CM_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = cm_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cm_bt_0002] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_cm_bt_0002", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/cm_bt_0002.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[cm_bt_0002] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 공통 배치 결과 [cm_bt_0002] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[cm_bt_0002] 배치 시작 date=%s", biz_date); + + rc = cm_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cm_bt_0002] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_cm_bt_0002(biz_date); + + cm_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[cm_bt_0002] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/cm_bt_0002.pgc b/app/batch/cm_bt_0002.pgc new file mode 100644 index 0000000..d81509a --- /dev/null +++ b/app/batch/cm_bt_0002.pgc @@ -0,0 +1,138 @@ +/* @tier easy @module cm @transform common-batch */ +/* + * cm_bt_0002.pgc - 공통 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: cm_bt_0002 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "cm_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_cm_bt_0002(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_cm_bt_0002 CURSOR FOR + SELECT key, merch_id, amount + FROM cm_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_cm_bt_0002; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_cm_bt_0002"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[cm_bt_0002] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_cm_bt_0002 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_cm_bt_0002"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, CM_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, CM_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = cm_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cm_bt_0002] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_cm_bt_0002; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[cm_bt_0002] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 공통 배치 결과 [cm_bt_0002] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[cm_bt_0002] 배치 시작 date=%s", biz_date); + + rc = cm_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cm_bt_0002] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_cm_bt_0002(biz_date); + + cm_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[cm_bt_0002] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/cm_bt_0003.c b/app/batch/cm_bt_0003.c new file mode 100644 index 0000000..1205a47 --- /dev/null +++ b/app/batch/cm_bt_0003.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/cm_bt_0003.pgc" +/* @tier medium @module cm @transform common-batch */ +/* + * cm_bt_0003.pgc - 공통 배치 (커서 순회 + 상태전이) [tier=medium] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: cm_bt_0003 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "cm_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/cm_bt_0003.pgc" + + +static int run_cm_bt_0003(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/cm_bt_0003.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/cm_bt_0003.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/cm_bt_0003.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/cm_bt_0003.pgc" + long h_amount ; + +#line 28 "app/batch/cm_bt_0003.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/cm_bt_0003.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_cm_bt_0003 cursor for select key , merch_id , amount from cm_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/cm_bt_0003.pgc" + +#line 42 "app/batch/cm_bt_0003.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_cm_bt_0003 cursor for select key , merch_id , amount from cm_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/cm_bt_0003.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_cm_bt_0003"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[cm_bt_0003] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_cm_bt_0003", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/cm_bt_0003.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_cm_bt_0003"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, CM_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, CM_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = cm_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cm_bt_0003] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_cm_bt_0003", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/cm_bt_0003.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[cm_bt_0003] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 공통 배치 결과 [cm_bt_0003] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[cm_bt_0003] 배치 시작 date=%s", biz_date); + + rc = cm_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cm_bt_0003] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_cm_bt_0003(biz_date); + + cm_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[cm_bt_0003] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/cm_bt_0003.pgc b/app/batch/cm_bt_0003.pgc new file mode 100644 index 0000000..722032c --- /dev/null +++ b/app/batch/cm_bt_0003.pgc @@ -0,0 +1,138 @@ +/* @tier medium @module cm @transform common-batch */ +/* + * cm_bt_0003.pgc - 공통 배치 (커서 순회 + 상태전이) [tier=medium] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: cm_bt_0003 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "cm_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_cm_bt_0003(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_cm_bt_0003 CURSOR FOR + SELECT key, merch_id, amount + FROM cm_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_cm_bt_0003; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_cm_bt_0003"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[cm_bt_0003] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_cm_bt_0003 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_cm_bt_0003"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, CM_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, CM_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = cm_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cm_bt_0003] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_cm_bt_0003; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[cm_bt_0003] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 공통 배치 결과 [cm_bt_0003] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[cm_bt_0003] 배치 시작 date=%s", biz_date); + + rc = cm_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cm_bt_0003] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_cm_bt_0003(biz_date); + + cm_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[cm_bt_0003] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/cm_bt_0004.c b/app/batch/cm_bt_0004.c new file mode 100644 index 0000000..a590b73 --- /dev/null +++ b/app/batch/cm_bt_0004.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/cm_bt_0004.pgc" +/* @tier easy @module cm @transform common-batch */ +/* + * cm_bt_0004.pgc - 공통 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: cm_bt_0004 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "cm_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/cm_bt_0004.pgc" + + +static int run_cm_bt_0004(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/cm_bt_0004.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/cm_bt_0004.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/cm_bt_0004.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/cm_bt_0004.pgc" + long h_amount ; + +#line 28 "app/batch/cm_bt_0004.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/cm_bt_0004.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_cm_bt_0004 cursor for select key , merch_id , amount from cm_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/cm_bt_0004.pgc" + +#line 42 "app/batch/cm_bt_0004.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_cm_bt_0004 cursor for select key , merch_id , amount from cm_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/cm_bt_0004.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_cm_bt_0004"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[cm_bt_0004] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_cm_bt_0004", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/cm_bt_0004.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_cm_bt_0004"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, CM_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, CM_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = cm_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cm_bt_0004] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_cm_bt_0004", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/cm_bt_0004.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[cm_bt_0004] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 공통 배치 결과 [cm_bt_0004] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[cm_bt_0004] 배치 시작 date=%s", biz_date); + + rc = cm_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cm_bt_0004] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_cm_bt_0004(biz_date); + + cm_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[cm_bt_0004] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/cm_bt_0004.pgc b/app/batch/cm_bt_0004.pgc new file mode 100644 index 0000000..4253f81 --- /dev/null +++ b/app/batch/cm_bt_0004.pgc @@ -0,0 +1,138 @@ +/* @tier easy @module cm @transform common-batch */ +/* + * cm_bt_0004.pgc - 공통 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: cm_bt_0004 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "cm_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_cm_bt_0004(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_cm_bt_0004 CURSOR FOR + SELECT key, merch_id, amount + FROM cm_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_cm_bt_0004; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_cm_bt_0004"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[cm_bt_0004] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_cm_bt_0004 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_cm_bt_0004"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, CM_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, CM_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = cm_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cm_bt_0004] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_cm_bt_0004; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[cm_bt_0004] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 공통 배치 결과 [cm_bt_0004] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[cm_bt_0004] 배치 시작 date=%s", biz_date); + + rc = cm_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cm_bt_0004] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_cm_bt_0004(biz_date); + + cm_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[cm_bt_0004] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/cm_bt_0005.c b/app/batch/cm_bt_0005.c new file mode 100644 index 0000000..dfdb903 --- /dev/null +++ b/app/batch/cm_bt_0005.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/cm_bt_0005.pgc" +/* @tier medium @module cm @transform common-batch */ +/* + * cm_bt_0005.pgc - 공통 배치 (커서 순회 + 상태전이) [tier=medium] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: cm_bt_0005 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "cm_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/cm_bt_0005.pgc" + + +static int run_cm_bt_0005(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/cm_bt_0005.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/cm_bt_0005.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/cm_bt_0005.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/cm_bt_0005.pgc" + long h_amount ; + +#line 28 "app/batch/cm_bt_0005.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/cm_bt_0005.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_cm_bt_0005 cursor for select key , merch_id , amount from cm_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/cm_bt_0005.pgc" + +#line 42 "app/batch/cm_bt_0005.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_cm_bt_0005 cursor for select key , merch_id , amount from cm_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/cm_bt_0005.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_cm_bt_0005"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[cm_bt_0005] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_cm_bt_0005", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/cm_bt_0005.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_cm_bt_0005"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, CM_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, CM_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = cm_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cm_bt_0005] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_cm_bt_0005", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/cm_bt_0005.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[cm_bt_0005] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 공통 배치 결과 [cm_bt_0005] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[cm_bt_0005] 배치 시작 date=%s", biz_date); + + rc = cm_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cm_bt_0005] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_cm_bt_0005(biz_date); + + cm_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[cm_bt_0005] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/cm_bt_0005.pgc b/app/batch/cm_bt_0005.pgc new file mode 100644 index 0000000..08b75a2 --- /dev/null +++ b/app/batch/cm_bt_0005.pgc @@ -0,0 +1,138 @@ +/* @tier medium @module cm @transform common-batch */ +/* + * cm_bt_0005.pgc - 공통 배치 (커서 순회 + 상태전이) [tier=medium] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: cm_bt_0005 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "cm_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_cm_bt_0005(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_cm_bt_0005 CURSOR FOR + SELECT key, merch_id, amount + FROM cm_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_cm_bt_0005; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_cm_bt_0005"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[cm_bt_0005] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_cm_bt_0005 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_cm_bt_0005"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, CM_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, CM_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = cm_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cm_bt_0005] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_cm_bt_0005; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[cm_bt_0005] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 공통 배치 결과 [cm_bt_0005] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[cm_bt_0005] 배치 시작 date=%s", biz_date); + + rc = cm_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cm_bt_0005] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_cm_bt_0005(biz_date); + + cm_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[cm_bt_0005] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/cm_bt_0006.c b/app/batch/cm_bt_0006.c new file mode 100644 index 0000000..e17f669 --- /dev/null +++ b/app/batch/cm_bt_0006.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/cm_bt_0006.pgc" +/* @tier easy @module cm @transform common-batch */ +/* + * cm_bt_0006.pgc - 공통 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: cm_bt_0006 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "cm_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/cm_bt_0006.pgc" + + +static int run_cm_bt_0006(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/cm_bt_0006.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/cm_bt_0006.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/cm_bt_0006.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/cm_bt_0006.pgc" + long h_amount ; + +#line 28 "app/batch/cm_bt_0006.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/cm_bt_0006.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_cm_bt_0006 cursor for select key , merch_id , amount from cm_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/cm_bt_0006.pgc" + +#line 42 "app/batch/cm_bt_0006.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_cm_bt_0006 cursor for select key , merch_id , amount from cm_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/cm_bt_0006.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_cm_bt_0006"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[cm_bt_0006] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_cm_bt_0006", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/cm_bt_0006.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_cm_bt_0006"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, CM_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, CM_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = cm_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cm_bt_0006] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_cm_bt_0006", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/cm_bt_0006.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[cm_bt_0006] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 공통 배치 결과 [cm_bt_0006] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[cm_bt_0006] 배치 시작 date=%s", biz_date); + + rc = cm_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cm_bt_0006] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_cm_bt_0006(biz_date); + + cm_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[cm_bt_0006] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/cm_bt_0006.pgc b/app/batch/cm_bt_0006.pgc new file mode 100644 index 0000000..c1c6986 --- /dev/null +++ b/app/batch/cm_bt_0006.pgc @@ -0,0 +1,138 @@ +/* @tier easy @module cm @transform common-batch */ +/* + * cm_bt_0006.pgc - 공통 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: cm_bt_0006 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "cm_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_cm_bt_0006(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_cm_bt_0006 CURSOR FOR + SELECT key, merch_id, amount + FROM cm_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_cm_bt_0006; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_cm_bt_0006"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[cm_bt_0006] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_cm_bt_0006 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_cm_bt_0006"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, CM_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, CM_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = cm_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cm_bt_0006] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_cm_bt_0006; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[cm_bt_0006] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 공통 배치 결과 [cm_bt_0006] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[cm_bt_0006] 배치 시작 date=%s", biz_date); + + rc = cm_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cm_bt_0006] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_cm_bt_0006(biz_date); + + cm_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[cm_bt_0006] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/cm_bt_0007.c b/app/batch/cm_bt_0007.c new file mode 100644 index 0000000..f626d61 --- /dev/null +++ b/app/batch/cm_bt_0007.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/cm_bt_0007.pgc" +/* @tier medium @module cm @transform common-batch */ +/* + * cm_bt_0007.pgc - 공통 배치 (커서 순회 + 상태전이) [tier=medium] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: cm_bt_0007 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "cm_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/cm_bt_0007.pgc" + + +static int run_cm_bt_0007(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/cm_bt_0007.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/cm_bt_0007.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/cm_bt_0007.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/cm_bt_0007.pgc" + long h_amount ; + +#line 28 "app/batch/cm_bt_0007.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/cm_bt_0007.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_cm_bt_0007 cursor for select key , merch_id , amount from cm_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/cm_bt_0007.pgc" + +#line 42 "app/batch/cm_bt_0007.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_cm_bt_0007 cursor for select key , merch_id , amount from cm_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/cm_bt_0007.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_cm_bt_0007"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[cm_bt_0007] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_cm_bt_0007", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/cm_bt_0007.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_cm_bt_0007"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, CM_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, CM_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = cm_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cm_bt_0007] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_cm_bt_0007", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/cm_bt_0007.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[cm_bt_0007] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 공통 배치 결과 [cm_bt_0007] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[cm_bt_0007] 배치 시작 date=%s", biz_date); + + rc = cm_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cm_bt_0007] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_cm_bt_0007(biz_date); + + cm_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[cm_bt_0007] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/cm_bt_0007.pgc b/app/batch/cm_bt_0007.pgc new file mode 100644 index 0000000..f8235a1 --- /dev/null +++ b/app/batch/cm_bt_0007.pgc @@ -0,0 +1,138 @@ +/* @tier medium @module cm @transform common-batch */ +/* + * cm_bt_0007.pgc - 공통 배치 (커서 순회 + 상태전이) [tier=medium] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: cm_bt_0007 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "cm_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_cm_bt_0007(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_cm_bt_0007 CURSOR FOR + SELECT key, merch_id, amount + FROM cm_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_cm_bt_0007; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_cm_bt_0007"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[cm_bt_0007] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_cm_bt_0007 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_cm_bt_0007"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, CM_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, CM_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = cm_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cm_bt_0007] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_cm_bt_0007; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[cm_bt_0007] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 공통 배치 결과 [cm_bt_0007] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[cm_bt_0007] 배치 시작 date=%s", biz_date); + + rc = cm_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cm_bt_0007] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_cm_bt_0007(biz_date); + + cm_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[cm_bt_0007] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/cm_bt_0008.c b/app/batch/cm_bt_0008.c new file mode 100644 index 0000000..42c73ae --- /dev/null +++ b/app/batch/cm_bt_0008.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/cm_bt_0008.pgc" +/* @tier easy @module cm @transform common-batch */ +/* + * cm_bt_0008.pgc - 공통 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: cm_bt_0008 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "cm_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/cm_bt_0008.pgc" + + +static int run_cm_bt_0008(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/cm_bt_0008.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/cm_bt_0008.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/cm_bt_0008.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/cm_bt_0008.pgc" + long h_amount ; + +#line 28 "app/batch/cm_bt_0008.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/cm_bt_0008.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_cm_bt_0008 cursor for select key , merch_id , amount from cm_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/cm_bt_0008.pgc" + +#line 42 "app/batch/cm_bt_0008.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_cm_bt_0008 cursor for select key , merch_id , amount from cm_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/cm_bt_0008.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_cm_bt_0008"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[cm_bt_0008] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_cm_bt_0008", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/cm_bt_0008.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_cm_bt_0008"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, CM_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, CM_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = cm_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cm_bt_0008] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_cm_bt_0008", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/cm_bt_0008.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[cm_bt_0008] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 공통 배치 결과 [cm_bt_0008] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[cm_bt_0008] 배치 시작 date=%s", biz_date); + + rc = cm_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cm_bt_0008] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_cm_bt_0008(biz_date); + + cm_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[cm_bt_0008] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/cm_bt_0008.pgc b/app/batch/cm_bt_0008.pgc new file mode 100644 index 0000000..864d7ef --- /dev/null +++ b/app/batch/cm_bt_0008.pgc @@ -0,0 +1,138 @@ +/* @tier easy @module cm @transform common-batch */ +/* + * cm_bt_0008.pgc - 공통 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: cm_bt_0008 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "cm_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_cm_bt_0008(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_cm_bt_0008 CURSOR FOR + SELECT key, merch_id, amount + FROM cm_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_cm_bt_0008; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_cm_bt_0008"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[cm_bt_0008] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_cm_bt_0008 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_cm_bt_0008"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, CM_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, CM_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = cm_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cm_bt_0008] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_cm_bt_0008; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[cm_bt_0008] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 공통 배치 결과 [cm_bt_0008] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[cm_bt_0008] 배치 시작 date=%s", biz_date); + + rc = cm_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cm_bt_0008] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_cm_bt_0008(biz_date); + + cm_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[cm_bt_0008] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/cm_bt_0009.c b/app/batch/cm_bt_0009.c new file mode 100644 index 0000000..688e5cd --- /dev/null +++ b/app/batch/cm_bt_0009.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/cm_bt_0009.pgc" +/* @tier hard @module cm @transform common-batch */ +/* + * cm_bt_0009.pgc - 공통 배치 (커서 순회 + 상태전이) [tier=hard] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: cm_bt_0009 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "cm_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/cm_bt_0009.pgc" + + +static int run_cm_bt_0009(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/cm_bt_0009.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/cm_bt_0009.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/cm_bt_0009.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/cm_bt_0009.pgc" + long h_amount ; + +#line 28 "app/batch/cm_bt_0009.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/cm_bt_0009.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_cm_bt_0009 cursor for select key , merch_id , amount from cm_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/cm_bt_0009.pgc" + +#line 42 "app/batch/cm_bt_0009.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_cm_bt_0009 cursor for select key , merch_id , amount from cm_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/cm_bt_0009.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_cm_bt_0009"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[cm_bt_0009] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_cm_bt_0009", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/cm_bt_0009.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_cm_bt_0009"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, CM_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, CM_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = cm_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cm_bt_0009] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_cm_bt_0009", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/cm_bt_0009.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[cm_bt_0009] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 공통 배치 결과 [cm_bt_0009] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[cm_bt_0009] 배치 시작 date=%s", biz_date); + + rc = cm_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cm_bt_0009] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_cm_bt_0009(biz_date); + + cm_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[cm_bt_0009] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/cm_bt_0009.pgc b/app/batch/cm_bt_0009.pgc new file mode 100644 index 0000000..3cdbdae --- /dev/null +++ b/app/batch/cm_bt_0009.pgc @@ -0,0 +1,138 @@ +/* @tier hard @module cm @transform common-batch */ +/* + * cm_bt_0009.pgc - 공통 배치 (커서 순회 + 상태전이) [tier=hard] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: cm_bt_0009 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "cm_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_cm_bt_0009(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_cm_bt_0009 CURSOR FOR + SELECT key, merch_id, amount + FROM cm_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_cm_bt_0009; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_cm_bt_0009"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[cm_bt_0009] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_cm_bt_0009 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_cm_bt_0009"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, CM_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, CM_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = cm_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cm_bt_0009] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_cm_bt_0009; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[cm_bt_0009] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 공통 배치 결과 [cm_bt_0009] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[cm_bt_0009] 배치 시작 date=%s", biz_date); + + rc = cm_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cm_bt_0009] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_cm_bt_0009(biz_date); + + cm_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[cm_bt_0009] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/cm_bt_0010.c b/app/batch/cm_bt_0010.c new file mode 100644 index 0000000..719747d --- /dev/null +++ b/app/batch/cm_bt_0010.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/cm_bt_0010.pgc" +/* @tier easy @module cm @transform common-batch */ +/* + * cm_bt_0010.pgc - 공통 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: cm_bt_0010 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "cm_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/cm_bt_0010.pgc" + + +static int run_cm_bt_0010(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/cm_bt_0010.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/cm_bt_0010.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/cm_bt_0010.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/cm_bt_0010.pgc" + long h_amount ; + +#line 28 "app/batch/cm_bt_0010.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/cm_bt_0010.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_cm_bt_0010 cursor for select key , merch_id , amount from cm_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/cm_bt_0010.pgc" + +#line 42 "app/batch/cm_bt_0010.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_cm_bt_0010 cursor for select key , merch_id , amount from cm_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/cm_bt_0010.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_cm_bt_0010"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[cm_bt_0010] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_cm_bt_0010", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/cm_bt_0010.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_cm_bt_0010"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, CM_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, CM_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = cm_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cm_bt_0010] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_cm_bt_0010", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/cm_bt_0010.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[cm_bt_0010] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 공통 배치 결과 [cm_bt_0010] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[cm_bt_0010] 배치 시작 date=%s", biz_date); + + rc = cm_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cm_bt_0010] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_cm_bt_0010(biz_date); + + cm_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[cm_bt_0010] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/cm_bt_0010.pgc b/app/batch/cm_bt_0010.pgc new file mode 100644 index 0000000..c5877ab --- /dev/null +++ b/app/batch/cm_bt_0010.pgc @@ -0,0 +1,138 @@ +/* @tier easy @module cm @transform common-batch */ +/* + * cm_bt_0010.pgc - 공통 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: cm_bt_0010 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "cm_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_cm_bt_0010(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_cm_bt_0010 CURSOR FOR + SELECT key, merch_id, amount + FROM cm_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_cm_bt_0010; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_cm_bt_0010"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[cm_bt_0010] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_cm_bt_0010 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_cm_bt_0010"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, CM_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, CM_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = cm_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cm_bt_0010] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_cm_bt_0010; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[cm_bt_0010] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 공통 배치 결과 [cm_bt_0010] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[cm_bt_0010] 배치 시작 date=%s", biz_date); + + rc = cm_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cm_bt_0010] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_cm_bt_0010(biz_date); + + cm_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[cm_bt_0010] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/cm_bt_0011.c b/app/batch/cm_bt_0011.c new file mode 100644 index 0000000..bbcb5de --- /dev/null +++ b/app/batch/cm_bt_0011.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/cm_bt_0011.pgc" +/* @tier hard @module cm @transform common-batch */ +/* + * cm_bt_0011.pgc - 공통 배치 (커서 순회 + 상태전이) [tier=hard] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: cm_bt_0011 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "cm_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/cm_bt_0011.pgc" + + +static int run_cm_bt_0011(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/cm_bt_0011.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/cm_bt_0011.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/cm_bt_0011.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/cm_bt_0011.pgc" + long h_amount ; + +#line 28 "app/batch/cm_bt_0011.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/cm_bt_0011.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_cm_bt_0011 cursor for select key , merch_id , amount from cm_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/cm_bt_0011.pgc" + +#line 42 "app/batch/cm_bt_0011.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_cm_bt_0011 cursor for select key , merch_id , amount from cm_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/cm_bt_0011.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_cm_bt_0011"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[cm_bt_0011] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_cm_bt_0011", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/cm_bt_0011.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_cm_bt_0011"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, CM_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, CM_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = cm_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cm_bt_0011] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_cm_bt_0011", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/cm_bt_0011.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[cm_bt_0011] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 공통 배치 결과 [cm_bt_0011] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[cm_bt_0011] 배치 시작 date=%s", biz_date); + + rc = cm_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cm_bt_0011] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_cm_bt_0011(biz_date); + + cm_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[cm_bt_0011] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/cm_bt_0011.pgc b/app/batch/cm_bt_0011.pgc new file mode 100644 index 0000000..077d73c --- /dev/null +++ b/app/batch/cm_bt_0011.pgc @@ -0,0 +1,138 @@ +/* @tier hard @module cm @transform common-batch */ +/* + * cm_bt_0011.pgc - 공통 배치 (커서 순회 + 상태전이) [tier=hard] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: cm_bt_0011 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "cm_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_cm_bt_0011(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_cm_bt_0011 CURSOR FOR + SELECT key, merch_id, amount + FROM cm_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_cm_bt_0011; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_cm_bt_0011"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[cm_bt_0011] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_cm_bt_0011 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_cm_bt_0011"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, CM_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, CM_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = cm_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cm_bt_0011] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_cm_bt_0011; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[cm_bt_0011] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 공통 배치 결과 [cm_bt_0011] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[cm_bt_0011] 배치 시작 date=%s", biz_date); + + rc = cm_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cm_bt_0011] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_cm_bt_0011(biz_date); + + cm_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[cm_bt_0011] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/cm_bt_0012.c b/app/batch/cm_bt_0012.c new file mode 100644 index 0000000..7e8899a --- /dev/null +++ b/app/batch/cm_bt_0012.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/cm_bt_0012.pgc" +/* @tier easy @module cm @transform common-batch */ +/* + * cm_bt_0012.pgc - 공통 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: cm_bt_0012 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "cm_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/cm_bt_0012.pgc" + + +static int run_cm_bt_0012(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/cm_bt_0012.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/cm_bt_0012.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/cm_bt_0012.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/cm_bt_0012.pgc" + long h_amount ; + +#line 28 "app/batch/cm_bt_0012.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/cm_bt_0012.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_cm_bt_0012 cursor for select key , merch_id , amount from cm_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/cm_bt_0012.pgc" + +#line 42 "app/batch/cm_bt_0012.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_cm_bt_0012 cursor for select key , merch_id , amount from cm_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/cm_bt_0012.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_cm_bt_0012"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[cm_bt_0012] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_cm_bt_0012", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/cm_bt_0012.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_cm_bt_0012"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, CM_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, CM_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = cm_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cm_bt_0012] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_cm_bt_0012", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/cm_bt_0012.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[cm_bt_0012] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 공통 배치 결과 [cm_bt_0012] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[cm_bt_0012] 배치 시작 date=%s", biz_date); + + rc = cm_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cm_bt_0012] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_cm_bt_0012(biz_date); + + cm_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[cm_bt_0012] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/cm_bt_0012.pgc b/app/batch/cm_bt_0012.pgc new file mode 100644 index 0000000..9f2f025 --- /dev/null +++ b/app/batch/cm_bt_0012.pgc @@ -0,0 +1,138 @@ +/* @tier easy @module cm @transform common-batch */ +/* + * cm_bt_0012.pgc - 공통 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: cm_bt_0012 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "cm_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_cm_bt_0012(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_cm_bt_0012 CURSOR FOR + SELECT key, merch_id, amount + FROM cm_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_cm_bt_0012; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_cm_bt_0012"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[cm_bt_0012] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_cm_bt_0012 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_cm_bt_0012"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, CM_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, CM_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = cm_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cm_bt_0012] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_cm_bt_0012; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[cm_bt_0012] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 공통 배치 결과 [cm_bt_0012] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[cm_bt_0012] 배치 시작 date=%s", biz_date); + + rc = cm_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cm_bt_0012] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_cm_bt_0012(biz_date); + + cm_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[cm_bt_0012] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/cm_bt_0013.c b/app/batch/cm_bt_0013.c new file mode 100644 index 0000000..8dc5860 --- /dev/null +++ b/app/batch/cm_bt_0013.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/cm_bt_0013.pgc" +/* @tier easy @module cm @transform common-batch */ +/* + * cm_bt_0013.pgc - 공통 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: cm_bt_0013 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "cm_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/cm_bt_0013.pgc" + + +static int run_cm_bt_0013(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/cm_bt_0013.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/cm_bt_0013.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/cm_bt_0013.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/cm_bt_0013.pgc" + long h_amount ; + +#line 28 "app/batch/cm_bt_0013.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/cm_bt_0013.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_cm_bt_0013 cursor for select key , merch_id , amount from cm_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/cm_bt_0013.pgc" + +#line 42 "app/batch/cm_bt_0013.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_cm_bt_0013 cursor for select key , merch_id , amount from cm_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/cm_bt_0013.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_cm_bt_0013"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[cm_bt_0013] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_cm_bt_0013", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/cm_bt_0013.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_cm_bt_0013"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, CM_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, CM_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = cm_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cm_bt_0013] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_cm_bt_0013", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/cm_bt_0013.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[cm_bt_0013] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 공통 배치 결과 [cm_bt_0013] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[cm_bt_0013] 배치 시작 date=%s", biz_date); + + rc = cm_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cm_bt_0013] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_cm_bt_0013(biz_date); + + cm_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[cm_bt_0013] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/cm_bt_0013.pgc b/app/batch/cm_bt_0013.pgc new file mode 100644 index 0000000..c4df7d0 --- /dev/null +++ b/app/batch/cm_bt_0013.pgc @@ -0,0 +1,138 @@ +/* @tier easy @module cm @transform common-batch */ +/* + * cm_bt_0013.pgc - 공통 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: cm_bt_0013 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "cm_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_cm_bt_0013(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_cm_bt_0013 CURSOR FOR + SELECT key, merch_id, amount + FROM cm_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_cm_bt_0013; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_cm_bt_0013"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[cm_bt_0013] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_cm_bt_0013 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_cm_bt_0013"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, CM_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, CM_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = cm_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cm_bt_0013] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_cm_bt_0013; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[cm_bt_0013] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 공통 배치 결과 [cm_bt_0013] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[cm_bt_0013] 배치 시작 date=%s", biz_date); + + rc = cm_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cm_bt_0013] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_cm_bt_0013(biz_date); + + cm_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[cm_bt_0013] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/cm_bt_0014.c b/app/batch/cm_bt_0014.c new file mode 100644 index 0000000..d311c3b --- /dev/null +++ b/app/batch/cm_bt_0014.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/cm_bt_0014.pgc" +/* @tier medium @module cm @transform common-batch */ +/* + * cm_bt_0014.pgc - 공통 배치 (커서 순회 + 상태전이) [tier=medium] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: cm_bt_0014 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "cm_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/cm_bt_0014.pgc" + + +static int run_cm_bt_0014(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/cm_bt_0014.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/cm_bt_0014.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/cm_bt_0014.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/cm_bt_0014.pgc" + long h_amount ; + +#line 28 "app/batch/cm_bt_0014.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/cm_bt_0014.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_cm_bt_0014 cursor for select key , merch_id , amount from cm_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/cm_bt_0014.pgc" + +#line 42 "app/batch/cm_bt_0014.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_cm_bt_0014 cursor for select key , merch_id , amount from cm_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/cm_bt_0014.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_cm_bt_0014"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[cm_bt_0014] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_cm_bt_0014", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/cm_bt_0014.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_cm_bt_0014"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, CM_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, CM_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = cm_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cm_bt_0014] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_cm_bt_0014", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/cm_bt_0014.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[cm_bt_0014] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 공통 배치 결과 [cm_bt_0014] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[cm_bt_0014] 배치 시작 date=%s", biz_date); + + rc = cm_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cm_bt_0014] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_cm_bt_0014(biz_date); + + cm_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[cm_bt_0014] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/cm_bt_0014.pgc b/app/batch/cm_bt_0014.pgc new file mode 100644 index 0000000..2c9bf0a --- /dev/null +++ b/app/batch/cm_bt_0014.pgc @@ -0,0 +1,138 @@ +/* @tier medium @module cm @transform common-batch */ +/* + * cm_bt_0014.pgc - 공통 배치 (커서 순회 + 상태전이) [tier=medium] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: cm_bt_0014 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "cm_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_cm_bt_0014(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_cm_bt_0014 CURSOR FOR + SELECT key, merch_id, amount + FROM cm_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_cm_bt_0014; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_cm_bt_0014"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[cm_bt_0014] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_cm_bt_0014 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_cm_bt_0014"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, CM_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, CM_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = cm_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cm_bt_0014] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_cm_bt_0014; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[cm_bt_0014] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 공통 배치 결과 [cm_bt_0014] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[cm_bt_0014] 배치 시작 date=%s", biz_date); + + rc = cm_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cm_bt_0014] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_cm_bt_0014(biz_date); + + cm_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[cm_bt_0014] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/cm_bt_0015.c b/app/batch/cm_bt_0015.c new file mode 100644 index 0000000..a935904 --- /dev/null +++ b/app/batch/cm_bt_0015.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/cm_bt_0015.pgc" +/* @tier easy @module cm @transform common-batch */ +/* + * cm_bt_0015.pgc - 공통 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: cm_bt_0015 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "cm_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/cm_bt_0015.pgc" + + +static int run_cm_bt_0015(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/cm_bt_0015.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/cm_bt_0015.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/cm_bt_0015.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/cm_bt_0015.pgc" + long h_amount ; + +#line 28 "app/batch/cm_bt_0015.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/cm_bt_0015.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_cm_bt_0015 cursor for select key , merch_id , amount from cm_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/cm_bt_0015.pgc" + +#line 42 "app/batch/cm_bt_0015.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_cm_bt_0015 cursor for select key , merch_id , amount from cm_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/cm_bt_0015.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_cm_bt_0015"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[cm_bt_0015] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_cm_bt_0015", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/cm_bt_0015.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_cm_bt_0015"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, CM_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, CM_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = cm_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cm_bt_0015] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_cm_bt_0015", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/cm_bt_0015.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[cm_bt_0015] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 공통 배치 결과 [cm_bt_0015] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[cm_bt_0015] 배치 시작 date=%s", biz_date); + + rc = cm_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cm_bt_0015] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_cm_bt_0015(biz_date); + + cm_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[cm_bt_0015] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/cm_bt_0015.pgc b/app/batch/cm_bt_0015.pgc new file mode 100644 index 0000000..207466a --- /dev/null +++ b/app/batch/cm_bt_0015.pgc @@ -0,0 +1,138 @@ +/* @tier easy @module cm @transform common-batch */ +/* + * cm_bt_0015.pgc - 공통 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: cm_bt_0015 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "cm_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_cm_bt_0015(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_cm_bt_0015 CURSOR FOR + SELECT key, merch_id, amount + FROM cm_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_cm_bt_0015; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_cm_bt_0015"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[cm_bt_0015] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_cm_bt_0015 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_cm_bt_0015"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, CM_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, CM_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = cm_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cm_bt_0015] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_cm_bt_0015; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[cm_bt_0015] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 공통 배치 결과 [cm_bt_0015] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[cm_bt_0015] 배치 시작 date=%s", biz_date); + + rc = cm_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cm_bt_0015] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_cm_bt_0015(biz_date); + + cm_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[cm_bt_0015] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/cm_bt_0016.c b/app/batch/cm_bt_0016.c new file mode 100644 index 0000000..a1b5536 --- /dev/null +++ b/app/batch/cm_bt_0016.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/cm_bt_0016.pgc" +/* @tier medium @module cm @transform common-batch */ +/* + * cm_bt_0016.pgc - 공통 배치 (커서 순회 + 상태전이) [tier=medium] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: cm_bt_0016 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "cm_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/cm_bt_0016.pgc" + + +static int run_cm_bt_0016(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/cm_bt_0016.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/cm_bt_0016.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/cm_bt_0016.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/cm_bt_0016.pgc" + long h_amount ; + +#line 28 "app/batch/cm_bt_0016.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/cm_bt_0016.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_cm_bt_0016 cursor for select key , merch_id , amount from cm_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/cm_bt_0016.pgc" + +#line 42 "app/batch/cm_bt_0016.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_cm_bt_0016 cursor for select key , merch_id , amount from cm_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/cm_bt_0016.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_cm_bt_0016"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[cm_bt_0016] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_cm_bt_0016", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/cm_bt_0016.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_cm_bt_0016"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, CM_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, CM_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = cm_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cm_bt_0016] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_cm_bt_0016", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/cm_bt_0016.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[cm_bt_0016] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 공통 배치 결과 [cm_bt_0016] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[cm_bt_0016] 배치 시작 date=%s", biz_date); + + rc = cm_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cm_bt_0016] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_cm_bt_0016(biz_date); + + cm_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[cm_bt_0016] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/cm_bt_0016.pgc b/app/batch/cm_bt_0016.pgc new file mode 100644 index 0000000..ae19a69 --- /dev/null +++ b/app/batch/cm_bt_0016.pgc @@ -0,0 +1,138 @@ +/* @tier medium @module cm @transform common-batch */ +/* + * cm_bt_0016.pgc - 공통 배치 (커서 순회 + 상태전이) [tier=medium] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: cm_bt_0016 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "cm_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_cm_bt_0016(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_cm_bt_0016 CURSOR FOR + SELECT key, merch_id, amount + FROM cm_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_cm_bt_0016; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_cm_bt_0016"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[cm_bt_0016] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_cm_bt_0016 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_cm_bt_0016"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, CM_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, CM_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = cm_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cm_bt_0016] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_cm_bt_0016; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[cm_bt_0016] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 공통 배치 결과 [cm_bt_0016] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[cm_bt_0016] 배치 시작 date=%s", biz_date); + + rc = cm_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[cm_bt_0016] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_cm_bt_0016(biz_date); + + cm_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[cm_bt_0016] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/lg_bt_0001.c b/app/batch/lg_bt_0001.c new file mode 100644 index 0000000..3a40aa8 --- /dev/null +++ b/app/batch/lg_bt_0001.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/lg_bt_0001.pgc" +/* @tier easy @module lg @transform ledger-batch */ +/* + * lg_bt_0001.pgc - 원장 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: lg_bt_0001 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "lg_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/lg_bt_0001.pgc" + + +static int run_lg_bt_0001(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/lg_bt_0001.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/lg_bt_0001.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/lg_bt_0001.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/lg_bt_0001.pgc" + long h_amount ; + +#line 28 "app/batch/lg_bt_0001.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/lg_bt_0001.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_lg_bt_0001 cursor for select key , merch_id , amount from lg_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/lg_bt_0001.pgc" + +#line 42 "app/batch/lg_bt_0001.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_lg_bt_0001 cursor for select key , merch_id , amount from lg_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/lg_bt_0001.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_lg_bt_0001"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[lg_bt_0001] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_lg_bt_0001", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/lg_bt_0001.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_lg_bt_0001"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, LG_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, LG_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = lg_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[lg_bt_0001] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_lg_bt_0001", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/lg_bt_0001.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[lg_bt_0001] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 원장 배치 결과 [lg_bt_0001] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[lg_bt_0001] 배치 시작 date=%s", biz_date); + + rc = lg_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[lg_bt_0001] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_lg_bt_0001(biz_date); + + lg_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[lg_bt_0001] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/lg_bt_0001.pgc b/app/batch/lg_bt_0001.pgc new file mode 100644 index 0000000..fb3d418 --- /dev/null +++ b/app/batch/lg_bt_0001.pgc @@ -0,0 +1,138 @@ +/* @tier easy @module lg @transform ledger-batch */ +/* + * lg_bt_0001.pgc - 원장 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: lg_bt_0001 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "lg_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_lg_bt_0001(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_lg_bt_0001 CURSOR FOR + SELECT key, merch_id, amount + FROM lg_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_lg_bt_0001; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_lg_bt_0001"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[lg_bt_0001] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_lg_bt_0001 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_lg_bt_0001"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, LG_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, LG_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = lg_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[lg_bt_0001] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_lg_bt_0001; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[lg_bt_0001] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 원장 배치 결과 [lg_bt_0001] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[lg_bt_0001] 배치 시작 date=%s", biz_date); + + rc = lg_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[lg_bt_0001] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_lg_bt_0001(biz_date); + + lg_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[lg_bt_0001] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/lg_bt_0002.c b/app/batch/lg_bt_0002.c new file mode 100644 index 0000000..0b58db2 --- /dev/null +++ b/app/batch/lg_bt_0002.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/lg_bt_0002.pgc" +/* @tier hard @module lg @transform ledger-batch */ +/* + * lg_bt_0002.pgc - 원장 배치 (커서 순회 + 상태전이) [tier=hard] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: lg_bt_0002 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "lg_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/lg_bt_0002.pgc" + + +static int run_lg_bt_0002(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/lg_bt_0002.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/lg_bt_0002.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/lg_bt_0002.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/lg_bt_0002.pgc" + long h_amount ; + +#line 28 "app/batch/lg_bt_0002.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/lg_bt_0002.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_lg_bt_0002 cursor for select key , merch_id , amount from lg_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/lg_bt_0002.pgc" + +#line 42 "app/batch/lg_bt_0002.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_lg_bt_0002 cursor for select key , merch_id , amount from lg_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/lg_bt_0002.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_lg_bt_0002"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[lg_bt_0002] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_lg_bt_0002", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/lg_bt_0002.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_lg_bt_0002"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, LG_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, LG_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = lg_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[lg_bt_0002] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_lg_bt_0002", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/lg_bt_0002.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[lg_bt_0002] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 원장 배치 결과 [lg_bt_0002] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[lg_bt_0002] 배치 시작 date=%s", biz_date); + + rc = lg_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[lg_bt_0002] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_lg_bt_0002(biz_date); + + lg_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[lg_bt_0002] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/lg_bt_0002.pgc b/app/batch/lg_bt_0002.pgc new file mode 100644 index 0000000..a9f1e12 --- /dev/null +++ b/app/batch/lg_bt_0002.pgc @@ -0,0 +1,138 @@ +/* @tier hard @module lg @transform ledger-batch */ +/* + * lg_bt_0002.pgc - 원장 배치 (커서 순회 + 상태전이) [tier=hard] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: lg_bt_0002 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "lg_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_lg_bt_0002(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_lg_bt_0002 CURSOR FOR + SELECT key, merch_id, amount + FROM lg_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_lg_bt_0002; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_lg_bt_0002"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[lg_bt_0002] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_lg_bt_0002 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_lg_bt_0002"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, LG_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, LG_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = lg_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[lg_bt_0002] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_lg_bt_0002; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[lg_bt_0002] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 원장 배치 결과 [lg_bt_0002] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[lg_bt_0002] 배치 시작 date=%s", biz_date); + + rc = lg_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[lg_bt_0002] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_lg_bt_0002(biz_date); + + lg_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[lg_bt_0002] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/lg_bt_0003.c b/app/batch/lg_bt_0003.c new file mode 100644 index 0000000..0bbaea4 --- /dev/null +++ b/app/batch/lg_bt_0003.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/lg_bt_0003.pgc" +/* @tier easy @module lg @transform ledger-batch */ +/* + * lg_bt_0003.pgc - 원장 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: lg_bt_0003 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "lg_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/lg_bt_0003.pgc" + + +static int run_lg_bt_0003(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/lg_bt_0003.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/lg_bt_0003.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/lg_bt_0003.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/lg_bt_0003.pgc" + long h_amount ; + +#line 28 "app/batch/lg_bt_0003.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/lg_bt_0003.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_lg_bt_0003 cursor for select key , merch_id , amount from lg_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/lg_bt_0003.pgc" + +#line 42 "app/batch/lg_bt_0003.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_lg_bt_0003 cursor for select key , merch_id , amount from lg_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/lg_bt_0003.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_lg_bt_0003"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[lg_bt_0003] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_lg_bt_0003", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/lg_bt_0003.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_lg_bt_0003"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, LG_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, LG_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = lg_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[lg_bt_0003] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_lg_bt_0003", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/lg_bt_0003.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[lg_bt_0003] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 원장 배치 결과 [lg_bt_0003] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[lg_bt_0003] 배치 시작 date=%s", biz_date); + + rc = lg_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[lg_bt_0003] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_lg_bt_0003(biz_date); + + lg_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[lg_bt_0003] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/lg_bt_0003.pgc b/app/batch/lg_bt_0003.pgc new file mode 100644 index 0000000..82c5be5 --- /dev/null +++ b/app/batch/lg_bt_0003.pgc @@ -0,0 +1,138 @@ +/* @tier easy @module lg @transform ledger-batch */ +/* + * lg_bt_0003.pgc - 원장 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: lg_bt_0003 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "lg_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_lg_bt_0003(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_lg_bt_0003 CURSOR FOR + SELECT key, merch_id, amount + FROM lg_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_lg_bt_0003; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_lg_bt_0003"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[lg_bt_0003] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_lg_bt_0003 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_lg_bt_0003"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, LG_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, LG_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = lg_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[lg_bt_0003] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_lg_bt_0003; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[lg_bt_0003] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 원장 배치 결과 [lg_bt_0003] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[lg_bt_0003] 배치 시작 date=%s", biz_date); + + rc = lg_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[lg_bt_0003] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_lg_bt_0003(biz_date); + + lg_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[lg_bt_0003] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/lg_bt_0004.c b/app/batch/lg_bt_0004.c new file mode 100644 index 0000000..45b431b --- /dev/null +++ b/app/batch/lg_bt_0004.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/lg_bt_0004.pgc" +/* @tier easy @module lg @transform ledger-batch */ +/* + * lg_bt_0004.pgc - 원장 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: lg_bt_0004 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "lg_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/lg_bt_0004.pgc" + + +static int run_lg_bt_0004(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/lg_bt_0004.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/lg_bt_0004.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/lg_bt_0004.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/lg_bt_0004.pgc" + long h_amount ; + +#line 28 "app/batch/lg_bt_0004.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/lg_bt_0004.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_lg_bt_0004 cursor for select key , merch_id , amount from lg_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/lg_bt_0004.pgc" + +#line 42 "app/batch/lg_bt_0004.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_lg_bt_0004 cursor for select key , merch_id , amount from lg_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/lg_bt_0004.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_lg_bt_0004"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[lg_bt_0004] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_lg_bt_0004", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/lg_bt_0004.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_lg_bt_0004"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, LG_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, LG_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = lg_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[lg_bt_0004] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_lg_bt_0004", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/lg_bt_0004.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[lg_bt_0004] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 원장 배치 결과 [lg_bt_0004] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[lg_bt_0004] 배치 시작 date=%s", biz_date); + + rc = lg_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[lg_bt_0004] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_lg_bt_0004(biz_date); + + lg_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[lg_bt_0004] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/lg_bt_0004.pgc b/app/batch/lg_bt_0004.pgc new file mode 100644 index 0000000..2d883fe --- /dev/null +++ b/app/batch/lg_bt_0004.pgc @@ -0,0 +1,138 @@ +/* @tier easy @module lg @transform ledger-batch */ +/* + * lg_bt_0004.pgc - 원장 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: lg_bt_0004 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "lg_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_lg_bt_0004(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_lg_bt_0004 CURSOR FOR + SELECT key, merch_id, amount + FROM lg_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_lg_bt_0004; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_lg_bt_0004"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[lg_bt_0004] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_lg_bt_0004 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_lg_bt_0004"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, LG_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, LG_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = lg_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[lg_bt_0004] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_lg_bt_0004; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[lg_bt_0004] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 원장 배치 결과 [lg_bt_0004] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[lg_bt_0004] 배치 시작 date=%s", biz_date); + + rc = lg_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[lg_bt_0004] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_lg_bt_0004(biz_date); + + lg_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[lg_bt_0004] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/lg_bt_0005.c b/app/batch/lg_bt_0005.c new file mode 100644 index 0000000..b30e8f7 --- /dev/null +++ b/app/batch/lg_bt_0005.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/lg_bt_0005.pgc" +/* @tier medium @module lg @transform ledger-batch */ +/* + * lg_bt_0005.pgc - 원장 배치 (커서 순회 + 상태전이) [tier=medium] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: lg_bt_0005 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "lg_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/lg_bt_0005.pgc" + + +static int run_lg_bt_0005(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/lg_bt_0005.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/lg_bt_0005.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/lg_bt_0005.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/lg_bt_0005.pgc" + long h_amount ; + +#line 28 "app/batch/lg_bt_0005.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/lg_bt_0005.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_lg_bt_0005 cursor for select key , merch_id , amount from lg_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/lg_bt_0005.pgc" + +#line 42 "app/batch/lg_bt_0005.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_lg_bt_0005 cursor for select key , merch_id , amount from lg_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/lg_bt_0005.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_lg_bt_0005"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[lg_bt_0005] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_lg_bt_0005", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/lg_bt_0005.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_lg_bt_0005"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, LG_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, LG_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = lg_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[lg_bt_0005] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_lg_bt_0005", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/lg_bt_0005.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[lg_bt_0005] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 원장 배치 결과 [lg_bt_0005] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[lg_bt_0005] 배치 시작 date=%s", biz_date); + + rc = lg_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[lg_bt_0005] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_lg_bt_0005(biz_date); + + lg_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[lg_bt_0005] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/lg_bt_0005.pgc b/app/batch/lg_bt_0005.pgc new file mode 100644 index 0000000..214cd8b --- /dev/null +++ b/app/batch/lg_bt_0005.pgc @@ -0,0 +1,138 @@ +/* @tier medium @module lg @transform ledger-batch */ +/* + * lg_bt_0005.pgc - 원장 배치 (커서 순회 + 상태전이) [tier=medium] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: lg_bt_0005 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "lg_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_lg_bt_0005(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_lg_bt_0005 CURSOR FOR + SELECT key, merch_id, amount + FROM lg_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_lg_bt_0005; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_lg_bt_0005"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[lg_bt_0005] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_lg_bt_0005 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_lg_bt_0005"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, LG_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, LG_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = lg_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[lg_bt_0005] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_lg_bt_0005; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[lg_bt_0005] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 원장 배치 결과 [lg_bt_0005] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[lg_bt_0005] 배치 시작 date=%s", biz_date); + + rc = lg_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[lg_bt_0005] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_lg_bt_0005(biz_date); + + lg_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[lg_bt_0005] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/lg_bt_0006.c b/app/batch/lg_bt_0006.c new file mode 100644 index 0000000..14c46aa --- /dev/null +++ b/app/batch/lg_bt_0006.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/lg_bt_0006.pgc" +/* @tier easy @module lg @transform ledger-batch */ +/* + * lg_bt_0006.pgc - 원장 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: lg_bt_0006 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "lg_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/lg_bt_0006.pgc" + + +static int run_lg_bt_0006(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/lg_bt_0006.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/lg_bt_0006.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/lg_bt_0006.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/lg_bt_0006.pgc" + long h_amount ; + +#line 28 "app/batch/lg_bt_0006.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/lg_bt_0006.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_lg_bt_0006 cursor for select key , merch_id , amount from lg_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/lg_bt_0006.pgc" + +#line 42 "app/batch/lg_bt_0006.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_lg_bt_0006 cursor for select key , merch_id , amount from lg_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/lg_bt_0006.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_lg_bt_0006"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[lg_bt_0006] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_lg_bt_0006", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/lg_bt_0006.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_lg_bt_0006"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, LG_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, LG_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = lg_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[lg_bt_0006] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_lg_bt_0006", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/lg_bt_0006.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[lg_bt_0006] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 원장 배치 결과 [lg_bt_0006] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[lg_bt_0006] 배치 시작 date=%s", biz_date); + + rc = lg_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[lg_bt_0006] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_lg_bt_0006(biz_date); + + lg_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[lg_bt_0006] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/lg_bt_0006.pgc b/app/batch/lg_bt_0006.pgc new file mode 100644 index 0000000..0264222 --- /dev/null +++ b/app/batch/lg_bt_0006.pgc @@ -0,0 +1,138 @@ +/* @tier easy @module lg @transform ledger-batch */ +/* + * lg_bt_0006.pgc - 원장 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: lg_bt_0006 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "lg_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_lg_bt_0006(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_lg_bt_0006 CURSOR FOR + SELECT key, merch_id, amount + FROM lg_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_lg_bt_0006; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_lg_bt_0006"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[lg_bt_0006] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_lg_bt_0006 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_lg_bt_0006"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, LG_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, LG_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = lg_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[lg_bt_0006] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_lg_bt_0006; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[lg_bt_0006] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 원장 배치 결과 [lg_bt_0006] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[lg_bt_0006] 배치 시작 date=%s", biz_date); + + rc = lg_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[lg_bt_0006] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_lg_bt_0006(biz_date); + + lg_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[lg_bt_0006] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/lg_bt_0007.c b/app/batch/lg_bt_0007.c new file mode 100644 index 0000000..4aec6cd --- /dev/null +++ b/app/batch/lg_bt_0007.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/lg_bt_0007.pgc" +/* @tier medium @module lg @transform ledger-batch */ +/* + * lg_bt_0007.pgc - 원장 배치 (커서 순회 + 상태전이) [tier=medium] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: lg_bt_0007 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "lg_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/lg_bt_0007.pgc" + + +static int run_lg_bt_0007(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/lg_bt_0007.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/lg_bt_0007.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/lg_bt_0007.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/lg_bt_0007.pgc" + long h_amount ; + +#line 28 "app/batch/lg_bt_0007.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/lg_bt_0007.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_lg_bt_0007 cursor for select key , merch_id , amount from lg_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/lg_bt_0007.pgc" + +#line 42 "app/batch/lg_bt_0007.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_lg_bt_0007 cursor for select key , merch_id , amount from lg_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/lg_bt_0007.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_lg_bt_0007"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[lg_bt_0007] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_lg_bt_0007", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/lg_bt_0007.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_lg_bt_0007"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, LG_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, LG_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = lg_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[lg_bt_0007] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_lg_bt_0007", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/lg_bt_0007.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[lg_bt_0007] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 원장 배치 결과 [lg_bt_0007] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[lg_bt_0007] 배치 시작 date=%s", biz_date); + + rc = lg_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[lg_bt_0007] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_lg_bt_0007(biz_date); + + lg_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[lg_bt_0007] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/lg_bt_0007.pgc b/app/batch/lg_bt_0007.pgc new file mode 100644 index 0000000..973215c --- /dev/null +++ b/app/batch/lg_bt_0007.pgc @@ -0,0 +1,138 @@ +/* @tier medium @module lg @transform ledger-batch */ +/* + * lg_bt_0007.pgc - 원장 배치 (커서 순회 + 상태전이) [tier=medium] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: lg_bt_0007 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "lg_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_lg_bt_0007(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_lg_bt_0007 CURSOR FOR + SELECT key, merch_id, amount + FROM lg_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_lg_bt_0007; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_lg_bt_0007"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[lg_bt_0007] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_lg_bt_0007 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_lg_bt_0007"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, LG_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, LG_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = lg_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[lg_bt_0007] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_lg_bt_0007; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[lg_bt_0007] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 원장 배치 결과 [lg_bt_0007] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[lg_bt_0007] 배치 시작 date=%s", biz_date); + + rc = lg_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[lg_bt_0007] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_lg_bt_0007(biz_date); + + lg_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[lg_bt_0007] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/lg_bt_0008.c b/app/batch/lg_bt_0008.c new file mode 100644 index 0000000..3d9d1e1 --- /dev/null +++ b/app/batch/lg_bt_0008.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/lg_bt_0008.pgc" +/* @tier easy @module lg @transform ledger-batch */ +/* + * lg_bt_0008.pgc - 원장 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: lg_bt_0008 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "lg_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/lg_bt_0008.pgc" + + +static int run_lg_bt_0008(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/lg_bt_0008.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/lg_bt_0008.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/lg_bt_0008.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/lg_bt_0008.pgc" + long h_amount ; + +#line 28 "app/batch/lg_bt_0008.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/lg_bt_0008.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_lg_bt_0008 cursor for select key , merch_id , amount from lg_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/lg_bt_0008.pgc" + +#line 42 "app/batch/lg_bt_0008.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_lg_bt_0008 cursor for select key , merch_id , amount from lg_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/lg_bt_0008.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_lg_bt_0008"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[lg_bt_0008] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_lg_bt_0008", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/lg_bt_0008.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_lg_bt_0008"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, LG_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, LG_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = lg_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[lg_bt_0008] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_lg_bt_0008", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/lg_bt_0008.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[lg_bt_0008] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 원장 배치 결과 [lg_bt_0008] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[lg_bt_0008] 배치 시작 date=%s", biz_date); + + rc = lg_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[lg_bt_0008] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_lg_bt_0008(biz_date); + + lg_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[lg_bt_0008] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/lg_bt_0008.pgc b/app/batch/lg_bt_0008.pgc new file mode 100644 index 0000000..b5361a5 --- /dev/null +++ b/app/batch/lg_bt_0008.pgc @@ -0,0 +1,138 @@ +/* @tier easy @module lg @transform ledger-batch */ +/* + * lg_bt_0008.pgc - 원장 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: lg_bt_0008 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "lg_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_lg_bt_0008(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_lg_bt_0008 CURSOR FOR + SELECT key, merch_id, amount + FROM lg_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_lg_bt_0008; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_lg_bt_0008"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[lg_bt_0008] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_lg_bt_0008 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_lg_bt_0008"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, LG_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, LG_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = lg_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[lg_bt_0008] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_lg_bt_0008; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[lg_bt_0008] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 원장 배치 결과 [lg_bt_0008] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[lg_bt_0008] 배치 시작 date=%s", biz_date); + + rc = lg_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[lg_bt_0008] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_lg_bt_0008(biz_date); + + lg_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[lg_bt_0008] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/lg_bt_0009.c b/app/batch/lg_bt_0009.c new file mode 100644 index 0000000..34a4e97 --- /dev/null +++ b/app/batch/lg_bt_0009.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/lg_bt_0009.pgc" +/* @tier medium @module lg @transform ledger-batch */ +/* + * lg_bt_0009.pgc - 원장 배치 (커서 순회 + 상태전이) [tier=medium] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: lg_bt_0009 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "lg_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/lg_bt_0009.pgc" + + +static int run_lg_bt_0009(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/lg_bt_0009.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/lg_bt_0009.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/lg_bt_0009.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/lg_bt_0009.pgc" + long h_amount ; + +#line 28 "app/batch/lg_bt_0009.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/lg_bt_0009.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_lg_bt_0009 cursor for select key , merch_id , amount from lg_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/lg_bt_0009.pgc" + +#line 42 "app/batch/lg_bt_0009.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_lg_bt_0009 cursor for select key , merch_id , amount from lg_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/lg_bt_0009.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_lg_bt_0009"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[lg_bt_0009] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_lg_bt_0009", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/lg_bt_0009.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_lg_bt_0009"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, LG_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, LG_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = lg_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[lg_bt_0009] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_lg_bt_0009", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/lg_bt_0009.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[lg_bt_0009] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 원장 배치 결과 [lg_bt_0009] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[lg_bt_0009] 배치 시작 date=%s", biz_date); + + rc = lg_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[lg_bt_0009] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_lg_bt_0009(biz_date); + + lg_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[lg_bt_0009] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/lg_bt_0009.pgc b/app/batch/lg_bt_0009.pgc new file mode 100644 index 0000000..70f7aec --- /dev/null +++ b/app/batch/lg_bt_0009.pgc @@ -0,0 +1,138 @@ +/* @tier medium @module lg @transform ledger-batch */ +/* + * lg_bt_0009.pgc - 원장 배치 (커서 순회 + 상태전이) [tier=medium] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: lg_bt_0009 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "lg_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_lg_bt_0009(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_lg_bt_0009 CURSOR FOR + SELECT key, merch_id, amount + FROM lg_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_lg_bt_0009; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_lg_bt_0009"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[lg_bt_0009] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_lg_bt_0009 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_lg_bt_0009"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, LG_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, LG_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = lg_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[lg_bt_0009] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_lg_bt_0009; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[lg_bt_0009] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 원장 배치 결과 [lg_bt_0009] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[lg_bt_0009] 배치 시작 date=%s", biz_date); + + rc = lg_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[lg_bt_0009] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_lg_bt_0009(biz_date); + + lg_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[lg_bt_0009] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/lg_bt_0010.c b/app/batch/lg_bt_0010.c new file mode 100644 index 0000000..08a0a56 --- /dev/null +++ b/app/batch/lg_bt_0010.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/lg_bt_0010.pgc" +/* @tier easy @module lg @transform ledger-batch */ +/* + * lg_bt_0010.pgc - 원장 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: lg_bt_0010 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "lg_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/lg_bt_0010.pgc" + + +static int run_lg_bt_0010(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/lg_bt_0010.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/lg_bt_0010.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/lg_bt_0010.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/lg_bt_0010.pgc" + long h_amount ; + +#line 28 "app/batch/lg_bt_0010.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/lg_bt_0010.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_lg_bt_0010 cursor for select key , merch_id , amount from lg_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/lg_bt_0010.pgc" + +#line 42 "app/batch/lg_bt_0010.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_lg_bt_0010 cursor for select key , merch_id , amount from lg_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/lg_bt_0010.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_lg_bt_0010"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[lg_bt_0010] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_lg_bt_0010", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/lg_bt_0010.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_lg_bt_0010"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, LG_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, LG_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = lg_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[lg_bt_0010] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_lg_bt_0010", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/lg_bt_0010.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[lg_bt_0010] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 원장 배치 결과 [lg_bt_0010] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[lg_bt_0010] 배치 시작 date=%s", biz_date); + + rc = lg_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[lg_bt_0010] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_lg_bt_0010(biz_date); + + lg_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[lg_bt_0010] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/lg_bt_0010.pgc b/app/batch/lg_bt_0010.pgc new file mode 100644 index 0000000..945a40d --- /dev/null +++ b/app/batch/lg_bt_0010.pgc @@ -0,0 +1,138 @@ +/* @tier easy @module lg @transform ledger-batch */ +/* + * lg_bt_0010.pgc - 원장 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: lg_bt_0010 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "lg_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_lg_bt_0010(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_lg_bt_0010 CURSOR FOR + SELECT key, merch_id, amount + FROM lg_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_lg_bt_0010; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_lg_bt_0010"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[lg_bt_0010] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_lg_bt_0010 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_lg_bt_0010"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, LG_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, LG_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = lg_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[lg_bt_0010] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_lg_bt_0010; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[lg_bt_0010] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 원장 배치 결과 [lg_bt_0010] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[lg_bt_0010] 배치 시작 date=%s", biz_date); + + rc = lg_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[lg_bt_0010] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_lg_bt_0010(biz_date); + + lg_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[lg_bt_0010] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/lg_bt_0011.c b/app/batch/lg_bt_0011.c new file mode 100644 index 0000000..df6e6d8 --- /dev/null +++ b/app/batch/lg_bt_0011.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/lg_bt_0011.pgc" +/* @tier hard @module lg @transform ledger-batch */ +/* + * lg_bt_0011.pgc - 원장 배치 (커서 순회 + 상태전이) [tier=hard] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: lg_bt_0011 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "lg_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/lg_bt_0011.pgc" + + +static int run_lg_bt_0011(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/lg_bt_0011.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/lg_bt_0011.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/lg_bt_0011.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/lg_bt_0011.pgc" + long h_amount ; + +#line 28 "app/batch/lg_bt_0011.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/lg_bt_0011.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_lg_bt_0011 cursor for select key , merch_id , amount from lg_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/lg_bt_0011.pgc" + +#line 42 "app/batch/lg_bt_0011.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_lg_bt_0011 cursor for select key , merch_id , amount from lg_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/lg_bt_0011.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_lg_bt_0011"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[lg_bt_0011] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_lg_bt_0011", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/lg_bt_0011.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_lg_bt_0011"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, LG_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, LG_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = lg_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[lg_bt_0011] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_lg_bt_0011", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/lg_bt_0011.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[lg_bt_0011] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 원장 배치 결과 [lg_bt_0011] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[lg_bt_0011] 배치 시작 date=%s", biz_date); + + rc = lg_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[lg_bt_0011] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_lg_bt_0011(biz_date); + + lg_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[lg_bt_0011] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/lg_bt_0011.pgc b/app/batch/lg_bt_0011.pgc new file mode 100644 index 0000000..aff3d0e --- /dev/null +++ b/app/batch/lg_bt_0011.pgc @@ -0,0 +1,138 @@ +/* @tier hard @module lg @transform ledger-batch */ +/* + * lg_bt_0011.pgc - 원장 배치 (커서 순회 + 상태전이) [tier=hard] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: lg_bt_0011 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "lg_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_lg_bt_0011(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_lg_bt_0011 CURSOR FOR + SELECT key, merch_id, amount + FROM lg_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_lg_bt_0011; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_lg_bt_0011"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[lg_bt_0011] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_lg_bt_0011 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_lg_bt_0011"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, LG_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, LG_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = lg_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[lg_bt_0011] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_lg_bt_0011; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[lg_bt_0011] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 원장 배치 결과 [lg_bt_0011] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[lg_bt_0011] 배치 시작 date=%s", biz_date); + + rc = lg_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[lg_bt_0011] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_lg_bt_0011(biz_date); + + lg_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[lg_bt_0011] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/lg_bt_0012.c b/app/batch/lg_bt_0012.c new file mode 100644 index 0000000..04b89a3 --- /dev/null +++ b/app/batch/lg_bt_0012.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/lg_bt_0012.pgc" +/* @tier easy @module lg @transform ledger-batch */ +/* + * lg_bt_0012.pgc - 원장 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: lg_bt_0012 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "lg_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/lg_bt_0012.pgc" + + +static int run_lg_bt_0012(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/lg_bt_0012.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/lg_bt_0012.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/lg_bt_0012.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/lg_bt_0012.pgc" + long h_amount ; + +#line 28 "app/batch/lg_bt_0012.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/lg_bt_0012.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_lg_bt_0012 cursor for select key , merch_id , amount from lg_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/lg_bt_0012.pgc" + +#line 42 "app/batch/lg_bt_0012.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_lg_bt_0012 cursor for select key , merch_id , amount from lg_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/lg_bt_0012.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_lg_bt_0012"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[lg_bt_0012] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_lg_bt_0012", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/lg_bt_0012.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_lg_bt_0012"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, LG_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, LG_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = lg_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[lg_bt_0012] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_lg_bt_0012", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/lg_bt_0012.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[lg_bt_0012] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 원장 배치 결과 [lg_bt_0012] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[lg_bt_0012] 배치 시작 date=%s", biz_date); + + rc = lg_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[lg_bt_0012] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_lg_bt_0012(biz_date); + + lg_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[lg_bt_0012] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/lg_bt_0012.pgc b/app/batch/lg_bt_0012.pgc new file mode 100644 index 0000000..3dde87b --- /dev/null +++ b/app/batch/lg_bt_0012.pgc @@ -0,0 +1,138 @@ +/* @tier easy @module lg @transform ledger-batch */ +/* + * lg_bt_0012.pgc - 원장 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: lg_bt_0012 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "lg_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_lg_bt_0012(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_lg_bt_0012 CURSOR FOR + SELECT key, merch_id, amount + FROM lg_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_lg_bt_0012; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_lg_bt_0012"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[lg_bt_0012] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_lg_bt_0012 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_lg_bt_0012"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, LG_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, LG_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = lg_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[lg_bt_0012] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_lg_bt_0012; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[lg_bt_0012] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 원장 배치 결과 [lg_bt_0012] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[lg_bt_0012] 배치 시작 date=%s", biz_date); + + rc = lg_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[lg_bt_0012] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_lg_bt_0012(biz_date); + + lg_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[lg_bt_0012] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/lg_bt_0013.c b/app/batch/lg_bt_0013.c new file mode 100644 index 0000000..2f86c06 --- /dev/null +++ b/app/batch/lg_bt_0013.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/lg_bt_0013.pgc" +/* @tier hard @module lg @transform ledger-batch */ +/* + * lg_bt_0013.pgc - 원장 배치 (커서 순회 + 상태전이) [tier=hard] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: lg_bt_0013 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "lg_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/lg_bt_0013.pgc" + + +static int run_lg_bt_0013(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/lg_bt_0013.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/lg_bt_0013.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/lg_bt_0013.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/lg_bt_0013.pgc" + long h_amount ; + +#line 28 "app/batch/lg_bt_0013.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/lg_bt_0013.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_lg_bt_0013 cursor for select key , merch_id , amount from lg_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/lg_bt_0013.pgc" + +#line 42 "app/batch/lg_bt_0013.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_lg_bt_0013 cursor for select key , merch_id , amount from lg_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/lg_bt_0013.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_lg_bt_0013"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[lg_bt_0013] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_lg_bt_0013", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/lg_bt_0013.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_lg_bt_0013"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, LG_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, LG_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = lg_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[lg_bt_0013] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_lg_bt_0013", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/lg_bt_0013.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[lg_bt_0013] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 원장 배치 결과 [lg_bt_0013] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[lg_bt_0013] 배치 시작 date=%s", biz_date); + + rc = lg_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[lg_bt_0013] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_lg_bt_0013(biz_date); + + lg_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[lg_bt_0013] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/lg_bt_0013.pgc b/app/batch/lg_bt_0013.pgc new file mode 100644 index 0000000..ed0f3b4 --- /dev/null +++ b/app/batch/lg_bt_0013.pgc @@ -0,0 +1,138 @@ +/* @tier hard @module lg @transform ledger-batch */ +/* + * lg_bt_0013.pgc - 원장 배치 (커서 순회 + 상태전이) [tier=hard] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: lg_bt_0013 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "lg_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_lg_bt_0013(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_lg_bt_0013 CURSOR FOR + SELECT key, merch_id, amount + FROM lg_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_lg_bt_0013; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_lg_bt_0013"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[lg_bt_0013] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_lg_bt_0013 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_lg_bt_0013"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, LG_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, LG_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = lg_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[lg_bt_0013] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_lg_bt_0013; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[lg_bt_0013] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 원장 배치 결과 [lg_bt_0013] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[lg_bt_0013] 배치 시작 date=%s", biz_date); + + rc = lg_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[lg_bt_0013] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_lg_bt_0013(biz_date); + + lg_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[lg_bt_0013] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/lg_bt_0014.c b/app/batch/lg_bt_0014.c new file mode 100644 index 0000000..ec37547 --- /dev/null +++ b/app/batch/lg_bt_0014.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/lg_bt_0014.pgc" +/* @tier easy @module lg @transform ledger-batch */ +/* + * lg_bt_0014.pgc - 원장 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: lg_bt_0014 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "lg_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/lg_bt_0014.pgc" + + +static int run_lg_bt_0014(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/lg_bt_0014.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/lg_bt_0014.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/lg_bt_0014.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/lg_bt_0014.pgc" + long h_amount ; + +#line 28 "app/batch/lg_bt_0014.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/lg_bt_0014.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_lg_bt_0014 cursor for select key , merch_id , amount from lg_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/lg_bt_0014.pgc" + +#line 42 "app/batch/lg_bt_0014.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_lg_bt_0014 cursor for select key , merch_id , amount from lg_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/lg_bt_0014.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_lg_bt_0014"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[lg_bt_0014] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_lg_bt_0014", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/lg_bt_0014.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_lg_bt_0014"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, LG_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, LG_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = lg_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[lg_bt_0014] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_lg_bt_0014", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/lg_bt_0014.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[lg_bt_0014] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 원장 배치 결과 [lg_bt_0014] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[lg_bt_0014] 배치 시작 date=%s", biz_date); + + rc = lg_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[lg_bt_0014] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_lg_bt_0014(biz_date); + + lg_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[lg_bt_0014] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/lg_bt_0014.pgc b/app/batch/lg_bt_0014.pgc new file mode 100644 index 0000000..692efe9 --- /dev/null +++ b/app/batch/lg_bt_0014.pgc @@ -0,0 +1,138 @@ +/* @tier easy @module lg @transform ledger-batch */ +/* + * lg_bt_0014.pgc - 원장 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: lg_bt_0014 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "lg_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_lg_bt_0014(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_lg_bt_0014 CURSOR FOR + SELECT key, merch_id, amount + FROM lg_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_lg_bt_0014; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_lg_bt_0014"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[lg_bt_0014] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_lg_bt_0014 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_lg_bt_0014"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, LG_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, LG_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = lg_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[lg_bt_0014] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_lg_bt_0014; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[lg_bt_0014] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 원장 배치 결과 [lg_bt_0014] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[lg_bt_0014] 배치 시작 date=%s", biz_date); + + rc = lg_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[lg_bt_0014] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_lg_bt_0014(biz_date); + + lg_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[lg_bt_0014] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/lg_bt_0015.c b/app/batch/lg_bt_0015.c new file mode 100644 index 0000000..d0b3b01 --- /dev/null +++ b/app/batch/lg_bt_0015.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/lg_bt_0015.pgc" +/* @tier easy @module lg @transform ledger-batch */ +/* + * lg_bt_0015.pgc - 원장 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: lg_bt_0015 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "lg_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/lg_bt_0015.pgc" + + +static int run_lg_bt_0015(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/lg_bt_0015.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/lg_bt_0015.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/lg_bt_0015.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/lg_bt_0015.pgc" + long h_amount ; + +#line 28 "app/batch/lg_bt_0015.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/lg_bt_0015.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_lg_bt_0015 cursor for select key , merch_id , amount from lg_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/lg_bt_0015.pgc" + +#line 42 "app/batch/lg_bt_0015.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_lg_bt_0015 cursor for select key , merch_id , amount from lg_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/lg_bt_0015.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_lg_bt_0015"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[lg_bt_0015] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_lg_bt_0015", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/lg_bt_0015.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_lg_bt_0015"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, LG_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, LG_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = lg_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[lg_bt_0015] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_lg_bt_0015", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/lg_bt_0015.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[lg_bt_0015] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 원장 배치 결과 [lg_bt_0015] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[lg_bt_0015] 배치 시작 date=%s", biz_date); + + rc = lg_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[lg_bt_0015] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_lg_bt_0015(biz_date); + + lg_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[lg_bt_0015] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/lg_bt_0015.pgc b/app/batch/lg_bt_0015.pgc new file mode 100644 index 0000000..9a34e7b --- /dev/null +++ b/app/batch/lg_bt_0015.pgc @@ -0,0 +1,138 @@ +/* @tier easy @module lg @transform ledger-batch */ +/* + * lg_bt_0015.pgc - 원장 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: lg_bt_0015 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "lg_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_lg_bt_0015(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_lg_bt_0015 CURSOR FOR + SELECT key, merch_id, amount + FROM lg_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_lg_bt_0015; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_lg_bt_0015"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[lg_bt_0015] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_lg_bt_0015 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_lg_bt_0015"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, LG_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, LG_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = lg_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[lg_bt_0015] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_lg_bt_0015; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[lg_bt_0015] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 원장 배치 결과 [lg_bt_0015] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[lg_bt_0015] 배치 시작 date=%s", biz_date); + + rc = lg_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[lg_bt_0015] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_lg_bt_0015(biz_date); + + lg_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[lg_bt_0015] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/lg_bt_0016.c b/app/batch/lg_bt_0016.c new file mode 100644 index 0000000..72b1ae0 --- /dev/null +++ b/app/batch/lg_bt_0016.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/lg_bt_0016.pgc" +/* @tier medium @module lg @transform ledger-batch */ +/* + * lg_bt_0016.pgc - 원장 배치 (커서 순회 + 상태전이) [tier=medium] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: lg_bt_0016 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "lg_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/lg_bt_0016.pgc" + + +static int run_lg_bt_0016(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/lg_bt_0016.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/lg_bt_0016.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/lg_bt_0016.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/lg_bt_0016.pgc" + long h_amount ; + +#line 28 "app/batch/lg_bt_0016.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/lg_bt_0016.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_lg_bt_0016 cursor for select key , merch_id , amount from lg_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/lg_bt_0016.pgc" + +#line 42 "app/batch/lg_bt_0016.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_lg_bt_0016 cursor for select key , merch_id , amount from lg_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/lg_bt_0016.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_lg_bt_0016"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[lg_bt_0016] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_lg_bt_0016", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/lg_bt_0016.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_lg_bt_0016"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, LG_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, LG_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = lg_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[lg_bt_0016] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_lg_bt_0016", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/lg_bt_0016.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[lg_bt_0016] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 원장 배치 결과 [lg_bt_0016] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[lg_bt_0016] 배치 시작 date=%s", biz_date); + + rc = lg_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[lg_bt_0016] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_lg_bt_0016(biz_date); + + lg_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[lg_bt_0016] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/lg_bt_0016.pgc b/app/batch/lg_bt_0016.pgc new file mode 100644 index 0000000..b30eaf1 --- /dev/null +++ b/app/batch/lg_bt_0016.pgc @@ -0,0 +1,138 @@ +/* @tier medium @module lg @transform ledger-batch */ +/* + * lg_bt_0016.pgc - 원장 배치 (커서 순회 + 상태전이) [tier=medium] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: lg_bt_0016 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "lg_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_lg_bt_0016(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_lg_bt_0016 CURSOR FOR + SELECT key, merch_id, amount + FROM lg_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_lg_bt_0016; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_lg_bt_0016"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[lg_bt_0016] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_lg_bt_0016 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_lg_bt_0016"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, LG_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, LG_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = lg_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[lg_bt_0016] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_lg_bt_0016; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[lg_bt_0016] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 원장 배치 결과 [lg_bt_0016] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[lg_bt_0016] 배치 시작 date=%s", biz_date); + + rc = lg_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[lg_bt_0016] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_lg_bt_0016(biz_date); + + lg_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[lg_bt_0016] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/mg_bt_0001.c b/app/batch/mg_bt_0001.c new file mode 100644 index 0000000..4420cd8 --- /dev/null +++ b/app/batch/mg_bt_0001.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/mg_bt_0001.pgc" +/* @tier easy @module mg @transform msg-gateway-batch */ +/* + * mg_bt_0001.pgc - 전문게이트웨이 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: mg_bt_0001 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "mg_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/mg_bt_0001.pgc" + + +static int run_mg_bt_0001(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/mg_bt_0001.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/mg_bt_0001.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/mg_bt_0001.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/mg_bt_0001.pgc" + long h_amount ; + +#line 28 "app/batch/mg_bt_0001.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/mg_bt_0001.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_mg_bt_0001 cursor for select key , merch_id , amount from mg_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/mg_bt_0001.pgc" + +#line 42 "app/batch/mg_bt_0001.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_mg_bt_0001 cursor for select key , merch_id , amount from mg_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/mg_bt_0001.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_mg_bt_0001"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[mg_bt_0001] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_mg_bt_0001", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/mg_bt_0001.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_mg_bt_0001"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, MG_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, MG_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = mg_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mg_bt_0001] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_mg_bt_0001", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/mg_bt_0001.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[mg_bt_0001] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 전문게이트웨이 배치 결과 [mg_bt_0001] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[mg_bt_0001] 배치 시작 date=%s", biz_date); + + rc = mg_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mg_bt_0001] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_mg_bt_0001(biz_date); + + mg_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[mg_bt_0001] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/mg_bt_0001.pgc b/app/batch/mg_bt_0001.pgc new file mode 100644 index 0000000..f42bc2a --- /dev/null +++ b/app/batch/mg_bt_0001.pgc @@ -0,0 +1,138 @@ +/* @tier easy @module mg @transform msg-gateway-batch */ +/* + * mg_bt_0001.pgc - 전문게이트웨이 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: mg_bt_0001 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "mg_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_mg_bt_0001(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_mg_bt_0001 CURSOR FOR + SELECT key, merch_id, amount + FROM mg_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_mg_bt_0001; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_mg_bt_0001"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[mg_bt_0001] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_mg_bt_0001 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_mg_bt_0001"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, MG_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, MG_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = mg_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mg_bt_0001] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_mg_bt_0001; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[mg_bt_0001] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 전문게이트웨이 배치 결과 [mg_bt_0001] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[mg_bt_0001] 배치 시작 date=%s", biz_date); + + rc = mg_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mg_bt_0001] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_mg_bt_0001(biz_date); + + mg_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[mg_bt_0001] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/mg_bt_0002.c b/app/batch/mg_bt_0002.c new file mode 100644 index 0000000..4d1bd42 --- /dev/null +++ b/app/batch/mg_bt_0002.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/mg_bt_0002.pgc" +/* @tier medium @module mg @transform msg-gateway-batch */ +/* + * mg_bt_0002.pgc - 전문게이트웨이 배치 (커서 순회 + 상태전이) [tier=medium] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: mg_bt_0002 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "mg_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/mg_bt_0002.pgc" + + +static int run_mg_bt_0002(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/mg_bt_0002.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/mg_bt_0002.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/mg_bt_0002.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/mg_bt_0002.pgc" + long h_amount ; + +#line 28 "app/batch/mg_bt_0002.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/mg_bt_0002.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_mg_bt_0002 cursor for select key , merch_id , amount from mg_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/mg_bt_0002.pgc" + +#line 42 "app/batch/mg_bt_0002.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_mg_bt_0002 cursor for select key , merch_id , amount from mg_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/mg_bt_0002.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_mg_bt_0002"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[mg_bt_0002] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_mg_bt_0002", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/mg_bt_0002.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_mg_bt_0002"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, MG_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, MG_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = mg_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mg_bt_0002] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_mg_bt_0002", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/mg_bt_0002.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[mg_bt_0002] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 전문게이트웨이 배치 결과 [mg_bt_0002] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[mg_bt_0002] 배치 시작 date=%s", biz_date); + + rc = mg_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mg_bt_0002] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_mg_bt_0002(biz_date); + + mg_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[mg_bt_0002] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/mg_bt_0002.pgc b/app/batch/mg_bt_0002.pgc new file mode 100644 index 0000000..f04039d --- /dev/null +++ b/app/batch/mg_bt_0002.pgc @@ -0,0 +1,138 @@ +/* @tier medium @module mg @transform msg-gateway-batch */ +/* + * mg_bt_0002.pgc - 전문게이트웨이 배치 (커서 순회 + 상태전이) [tier=medium] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: mg_bt_0002 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "mg_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_mg_bt_0002(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_mg_bt_0002 CURSOR FOR + SELECT key, merch_id, amount + FROM mg_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_mg_bt_0002; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_mg_bt_0002"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[mg_bt_0002] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_mg_bt_0002 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_mg_bt_0002"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, MG_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, MG_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = mg_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mg_bt_0002] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_mg_bt_0002; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[mg_bt_0002] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 전문게이트웨이 배치 결과 [mg_bt_0002] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[mg_bt_0002] 배치 시작 date=%s", biz_date); + + rc = mg_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mg_bt_0002] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_mg_bt_0002(biz_date); + + mg_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[mg_bt_0002] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/mg_bt_0003.c b/app/batch/mg_bt_0003.c new file mode 100644 index 0000000..2a8e61e --- /dev/null +++ b/app/batch/mg_bt_0003.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/mg_bt_0003.pgc" +/* @tier easy @module mg @transform msg-gateway-batch */ +/* + * mg_bt_0003.pgc - 전문게이트웨이 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: mg_bt_0003 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "mg_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/mg_bt_0003.pgc" + + +static int run_mg_bt_0003(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/mg_bt_0003.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/mg_bt_0003.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/mg_bt_0003.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/mg_bt_0003.pgc" + long h_amount ; + +#line 28 "app/batch/mg_bt_0003.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/mg_bt_0003.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_mg_bt_0003 cursor for select key , merch_id , amount from mg_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/mg_bt_0003.pgc" + +#line 42 "app/batch/mg_bt_0003.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_mg_bt_0003 cursor for select key , merch_id , amount from mg_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/mg_bt_0003.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_mg_bt_0003"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[mg_bt_0003] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_mg_bt_0003", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/mg_bt_0003.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_mg_bt_0003"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, MG_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, MG_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = mg_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mg_bt_0003] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_mg_bt_0003", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/mg_bt_0003.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[mg_bt_0003] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 전문게이트웨이 배치 결과 [mg_bt_0003] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[mg_bt_0003] 배치 시작 date=%s", biz_date); + + rc = mg_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mg_bt_0003] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_mg_bt_0003(biz_date); + + mg_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[mg_bt_0003] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/mg_bt_0003.pgc b/app/batch/mg_bt_0003.pgc new file mode 100644 index 0000000..293eb02 --- /dev/null +++ b/app/batch/mg_bt_0003.pgc @@ -0,0 +1,138 @@ +/* @tier easy @module mg @transform msg-gateway-batch */ +/* + * mg_bt_0003.pgc - 전문게이트웨이 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: mg_bt_0003 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "mg_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_mg_bt_0003(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_mg_bt_0003 CURSOR FOR + SELECT key, merch_id, amount + FROM mg_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_mg_bt_0003; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_mg_bt_0003"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[mg_bt_0003] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_mg_bt_0003 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_mg_bt_0003"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, MG_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, MG_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = mg_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mg_bt_0003] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_mg_bt_0003; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[mg_bt_0003] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 전문게이트웨이 배치 결과 [mg_bt_0003] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[mg_bt_0003] 배치 시작 date=%s", biz_date); + + rc = mg_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mg_bt_0003] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_mg_bt_0003(biz_date); + + mg_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[mg_bt_0003] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/mg_bt_0004.c b/app/batch/mg_bt_0004.c new file mode 100644 index 0000000..0703624 --- /dev/null +++ b/app/batch/mg_bt_0004.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/mg_bt_0004.pgc" +/* @tier medium @module mg @transform msg-gateway-batch */ +/* + * mg_bt_0004.pgc - 전문게이트웨이 배치 (커서 순회 + 상태전이) [tier=medium] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: mg_bt_0004 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "mg_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/mg_bt_0004.pgc" + + +static int run_mg_bt_0004(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/mg_bt_0004.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/mg_bt_0004.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/mg_bt_0004.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/mg_bt_0004.pgc" + long h_amount ; + +#line 28 "app/batch/mg_bt_0004.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/mg_bt_0004.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_mg_bt_0004 cursor for select key , merch_id , amount from mg_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/mg_bt_0004.pgc" + +#line 42 "app/batch/mg_bt_0004.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_mg_bt_0004 cursor for select key , merch_id , amount from mg_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/mg_bt_0004.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_mg_bt_0004"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[mg_bt_0004] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_mg_bt_0004", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/mg_bt_0004.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_mg_bt_0004"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, MG_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, MG_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = mg_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mg_bt_0004] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_mg_bt_0004", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/mg_bt_0004.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[mg_bt_0004] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 전문게이트웨이 배치 결과 [mg_bt_0004] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[mg_bt_0004] 배치 시작 date=%s", biz_date); + + rc = mg_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mg_bt_0004] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_mg_bt_0004(biz_date); + + mg_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[mg_bt_0004] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/mg_bt_0004.pgc b/app/batch/mg_bt_0004.pgc new file mode 100644 index 0000000..ecf9e92 --- /dev/null +++ b/app/batch/mg_bt_0004.pgc @@ -0,0 +1,138 @@ +/* @tier medium @module mg @transform msg-gateway-batch */ +/* + * mg_bt_0004.pgc - 전문게이트웨이 배치 (커서 순회 + 상태전이) [tier=medium] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: mg_bt_0004 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "mg_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_mg_bt_0004(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_mg_bt_0004 CURSOR FOR + SELECT key, merch_id, amount + FROM mg_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_mg_bt_0004; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_mg_bt_0004"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[mg_bt_0004] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_mg_bt_0004 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_mg_bt_0004"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, MG_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, MG_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = mg_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mg_bt_0004] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_mg_bt_0004; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[mg_bt_0004] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 전문게이트웨이 배치 결과 [mg_bt_0004] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[mg_bt_0004] 배치 시작 date=%s", biz_date); + + rc = mg_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mg_bt_0004] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_mg_bt_0004(biz_date); + + mg_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[mg_bt_0004] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/mg_bt_0005.c b/app/batch/mg_bt_0005.c new file mode 100644 index 0000000..1c08743 --- /dev/null +++ b/app/batch/mg_bt_0005.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/mg_bt_0005.pgc" +/* @tier easy @module mg @transform msg-gateway-batch */ +/* + * mg_bt_0005.pgc - 전문게이트웨이 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: mg_bt_0005 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "mg_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/mg_bt_0005.pgc" + + +static int run_mg_bt_0005(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/mg_bt_0005.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/mg_bt_0005.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/mg_bt_0005.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/mg_bt_0005.pgc" + long h_amount ; + +#line 28 "app/batch/mg_bt_0005.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/mg_bt_0005.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_mg_bt_0005 cursor for select key , merch_id , amount from mg_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/mg_bt_0005.pgc" + +#line 42 "app/batch/mg_bt_0005.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_mg_bt_0005 cursor for select key , merch_id , amount from mg_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/mg_bt_0005.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_mg_bt_0005"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[mg_bt_0005] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_mg_bt_0005", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/mg_bt_0005.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_mg_bt_0005"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, MG_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, MG_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = mg_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mg_bt_0005] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_mg_bt_0005", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/mg_bt_0005.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[mg_bt_0005] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 전문게이트웨이 배치 결과 [mg_bt_0005] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[mg_bt_0005] 배치 시작 date=%s", biz_date); + + rc = mg_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mg_bt_0005] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_mg_bt_0005(biz_date); + + mg_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[mg_bt_0005] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/mg_bt_0005.pgc b/app/batch/mg_bt_0005.pgc new file mode 100644 index 0000000..1f915e5 --- /dev/null +++ b/app/batch/mg_bt_0005.pgc @@ -0,0 +1,138 @@ +/* @tier easy @module mg @transform msg-gateway-batch */ +/* + * mg_bt_0005.pgc - 전문게이트웨이 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: mg_bt_0005 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "mg_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_mg_bt_0005(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_mg_bt_0005 CURSOR FOR + SELECT key, merch_id, amount + FROM mg_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_mg_bt_0005; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_mg_bt_0005"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[mg_bt_0005] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_mg_bt_0005 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_mg_bt_0005"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, MG_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, MG_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = mg_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mg_bt_0005] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_mg_bt_0005; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[mg_bt_0005] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 전문게이트웨이 배치 결과 [mg_bt_0005] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[mg_bt_0005] 배치 시작 date=%s", biz_date); + + rc = mg_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mg_bt_0005] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_mg_bt_0005(biz_date); + + mg_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[mg_bt_0005] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/mg_bt_0006.c b/app/batch/mg_bt_0006.c new file mode 100644 index 0000000..8cb2010 --- /dev/null +++ b/app/batch/mg_bt_0006.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/mg_bt_0006.pgc" +/* @tier medium @module mg @transform msg-gateway-batch */ +/* + * mg_bt_0006.pgc - 전문게이트웨이 배치 (커서 순회 + 상태전이) [tier=medium] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: mg_bt_0006 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "mg_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/mg_bt_0006.pgc" + + +static int run_mg_bt_0006(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/mg_bt_0006.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/mg_bt_0006.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/mg_bt_0006.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/mg_bt_0006.pgc" + long h_amount ; + +#line 28 "app/batch/mg_bt_0006.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/mg_bt_0006.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_mg_bt_0006 cursor for select key , merch_id , amount from mg_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/mg_bt_0006.pgc" + +#line 42 "app/batch/mg_bt_0006.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_mg_bt_0006 cursor for select key , merch_id , amount from mg_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/mg_bt_0006.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_mg_bt_0006"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[mg_bt_0006] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_mg_bt_0006", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/mg_bt_0006.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_mg_bt_0006"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, MG_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, MG_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = mg_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mg_bt_0006] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_mg_bt_0006", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/mg_bt_0006.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[mg_bt_0006] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 전문게이트웨이 배치 결과 [mg_bt_0006] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[mg_bt_0006] 배치 시작 date=%s", biz_date); + + rc = mg_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mg_bt_0006] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_mg_bt_0006(biz_date); + + mg_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[mg_bt_0006] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/mg_bt_0006.pgc b/app/batch/mg_bt_0006.pgc new file mode 100644 index 0000000..beb8145 --- /dev/null +++ b/app/batch/mg_bt_0006.pgc @@ -0,0 +1,138 @@ +/* @tier medium @module mg @transform msg-gateway-batch */ +/* + * mg_bt_0006.pgc - 전문게이트웨이 배치 (커서 순회 + 상태전이) [tier=medium] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: mg_bt_0006 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "mg_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_mg_bt_0006(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_mg_bt_0006 CURSOR FOR + SELECT key, merch_id, amount + FROM mg_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_mg_bt_0006; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_mg_bt_0006"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[mg_bt_0006] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_mg_bt_0006 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_mg_bt_0006"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, MG_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, MG_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = mg_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mg_bt_0006] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_mg_bt_0006; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[mg_bt_0006] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 전문게이트웨이 배치 결과 [mg_bt_0006] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[mg_bt_0006] 배치 시작 date=%s", biz_date); + + rc = mg_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mg_bt_0006] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_mg_bt_0006(biz_date); + + mg_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[mg_bt_0006] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/mg_bt_0007.c b/app/batch/mg_bt_0007.c new file mode 100644 index 0000000..7cc46e4 --- /dev/null +++ b/app/batch/mg_bt_0007.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/mg_bt_0007.pgc" +/* @tier easy @module mg @transform msg-gateway-batch */ +/* + * mg_bt_0007.pgc - 전문게이트웨이 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: mg_bt_0007 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "mg_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/mg_bt_0007.pgc" + + +static int run_mg_bt_0007(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/mg_bt_0007.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/mg_bt_0007.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/mg_bt_0007.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/mg_bt_0007.pgc" + long h_amount ; + +#line 28 "app/batch/mg_bt_0007.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/mg_bt_0007.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_mg_bt_0007 cursor for select key , merch_id , amount from mg_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/mg_bt_0007.pgc" + +#line 42 "app/batch/mg_bt_0007.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_mg_bt_0007 cursor for select key , merch_id , amount from mg_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/mg_bt_0007.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_mg_bt_0007"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[mg_bt_0007] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_mg_bt_0007", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/mg_bt_0007.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_mg_bt_0007"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, MG_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, MG_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = mg_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mg_bt_0007] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_mg_bt_0007", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/mg_bt_0007.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[mg_bt_0007] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 전문게이트웨이 배치 결과 [mg_bt_0007] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[mg_bt_0007] 배치 시작 date=%s", biz_date); + + rc = mg_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mg_bt_0007] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_mg_bt_0007(biz_date); + + mg_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[mg_bt_0007] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/mg_bt_0007.pgc b/app/batch/mg_bt_0007.pgc new file mode 100644 index 0000000..e1d1b97 --- /dev/null +++ b/app/batch/mg_bt_0007.pgc @@ -0,0 +1,138 @@ +/* @tier easy @module mg @transform msg-gateway-batch */ +/* + * mg_bt_0007.pgc - 전문게이트웨이 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: mg_bt_0007 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "mg_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_mg_bt_0007(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_mg_bt_0007 CURSOR FOR + SELECT key, merch_id, amount + FROM mg_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_mg_bt_0007; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_mg_bt_0007"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[mg_bt_0007] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_mg_bt_0007 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_mg_bt_0007"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, MG_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, MG_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = mg_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mg_bt_0007] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_mg_bt_0007; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[mg_bt_0007] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 전문게이트웨이 배치 결과 [mg_bt_0007] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[mg_bt_0007] 배치 시작 date=%s", biz_date); + + rc = mg_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mg_bt_0007] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_mg_bt_0007(biz_date); + + mg_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[mg_bt_0007] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/mg_bt_0008.c b/app/batch/mg_bt_0008.c new file mode 100644 index 0000000..48d7b35 --- /dev/null +++ b/app/batch/mg_bt_0008.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/mg_bt_0008.pgc" +/* @tier hard @module mg @transform msg-gateway-batch */ +/* + * mg_bt_0008.pgc - 전문게이트웨이 배치 (커서 순회 + 상태전이) [tier=hard] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: mg_bt_0008 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "mg_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/mg_bt_0008.pgc" + + +static int run_mg_bt_0008(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/mg_bt_0008.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/mg_bt_0008.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/mg_bt_0008.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/mg_bt_0008.pgc" + long h_amount ; + +#line 28 "app/batch/mg_bt_0008.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/mg_bt_0008.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_mg_bt_0008 cursor for select key , merch_id , amount from mg_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/mg_bt_0008.pgc" + +#line 42 "app/batch/mg_bt_0008.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_mg_bt_0008 cursor for select key , merch_id , amount from mg_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/mg_bt_0008.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_mg_bt_0008"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[mg_bt_0008] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_mg_bt_0008", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/mg_bt_0008.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_mg_bt_0008"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, MG_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, MG_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = mg_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mg_bt_0008] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_mg_bt_0008", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/mg_bt_0008.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[mg_bt_0008] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 전문게이트웨이 배치 결과 [mg_bt_0008] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[mg_bt_0008] 배치 시작 date=%s", biz_date); + + rc = mg_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mg_bt_0008] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_mg_bt_0008(biz_date); + + mg_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[mg_bt_0008] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/mg_bt_0008.pgc b/app/batch/mg_bt_0008.pgc new file mode 100644 index 0000000..39c354f --- /dev/null +++ b/app/batch/mg_bt_0008.pgc @@ -0,0 +1,138 @@ +/* @tier hard @module mg @transform msg-gateway-batch */ +/* + * mg_bt_0008.pgc - 전문게이트웨이 배치 (커서 순회 + 상태전이) [tier=hard] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: mg_bt_0008 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "mg_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_mg_bt_0008(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_mg_bt_0008 CURSOR FOR + SELECT key, merch_id, amount + FROM mg_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_mg_bt_0008; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_mg_bt_0008"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[mg_bt_0008] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_mg_bt_0008 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_mg_bt_0008"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, MG_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, MG_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = mg_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mg_bt_0008] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_mg_bt_0008; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[mg_bt_0008] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 전문게이트웨이 배치 결과 [mg_bt_0008] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[mg_bt_0008] 배치 시작 date=%s", biz_date); + + rc = mg_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mg_bt_0008] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_mg_bt_0008(biz_date); + + mg_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[mg_bt_0008] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/mg_bt_0009.c b/app/batch/mg_bt_0009.c new file mode 100644 index 0000000..6dea119 --- /dev/null +++ b/app/batch/mg_bt_0009.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/mg_bt_0009.pgc" +/* @tier easy @module mg @transform msg-gateway-batch */ +/* + * mg_bt_0009.pgc - 전문게이트웨이 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: mg_bt_0009 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "mg_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/mg_bt_0009.pgc" + + +static int run_mg_bt_0009(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/mg_bt_0009.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/mg_bt_0009.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/mg_bt_0009.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/mg_bt_0009.pgc" + long h_amount ; + +#line 28 "app/batch/mg_bt_0009.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/mg_bt_0009.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_mg_bt_0009 cursor for select key , merch_id , amount from mg_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/mg_bt_0009.pgc" + +#line 42 "app/batch/mg_bt_0009.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_mg_bt_0009 cursor for select key , merch_id , amount from mg_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/mg_bt_0009.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_mg_bt_0009"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[mg_bt_0009] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_mg_bt_0009", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/mg_bt_0009.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_mg_bt_0009"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, MG_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, MG_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = mg_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mg_bt_0009] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_mg_bt_0009", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/mg_bt_0009.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[mg_bt_0009] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 전문게이트웨이 배치 결과 [mg_bt_0009] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[mg_bt_0009] 배치 시작 date=%s", biz_date); + + rc = mg_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mg_bt_0009] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_mg_bt_0009(biz_date); + + mg_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[mg_bt_0009] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/mg_bt_0009.pgc b/app/batch/mg_bt_0009.pgc new file mode 100644 index 0000000..bf32706 --- /dev/null +++ b/app/batch/mg_bt_0009.pgc @@ -0,0 +1,138 @@ +/* @tier easy @module mg @transform msg-gateway-batch */ +/* + * mg_bt_0009.pgc - 전문게이트웨이 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: mg_bt_0009 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "mg_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_mg_bt_0009(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_mg_bt_0009 CURSOR FOR + SELECT key, merch_id, amount + FROM mg_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_mg_bt_0009; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_mg_bt_0009"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[mg_bt_0009] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_mg_bt_0009 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_mg_bt_0009"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, MG_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, MG_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = mg_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mg_bt_0009] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_mg_bt_0009; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[mg_bt_0009] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 전문게이트웨이 배치 결과 [mg_bt_0009] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[mg_bt_0009] 배치 시작 date=%s", biz_date); + + rc = mg_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mg_bt_0009] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_mg_bt_0009(biz_date); + + mg_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[mg_bt_0009] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/mg_bt_0010.c b/app/batch/mg_bt_0010.c new file mode 100644 index 0000000..93690f8 --- /dev/null +++ b/app/batch/mg_bt_0010.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/mg_bt_0010.pgc" +/* @tier hard @module mg @transform msg-gateway-batch */ +/* + * mg_bt_0010.pgc - 전문게이트웨이 배치 (커서 순회 + 상태전이) [tier=hard] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: mg_bt_0010 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "mg_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/mg_bt_0010.pgc" + + +static int run_mg_bt_0010(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/mg_bt_0010.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/mg_bt_0010.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/mg_bt_0010.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/mg_bt_0010.pgc" + long h_amount ; + +#line 28 "app/batch/mg_bt_0010.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/mg_bt_0010.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_mg_bt_0010 cursor for select key , merch_id , amount from mg_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/mg_bt_0010.pgc" + +#line 42 "app/batch/mg_bt_0010.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_mg_bt_0010 cursor for select key , merch_id , amount from mg_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/mg_bt_0010.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_mg_bt_0010"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[mg_bt_0010] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_mg_bt_0010", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/mg_bt_0010.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_mg_bt_0010"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, MG_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, MG_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = mg_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mg_bt_0010] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_mg_bt_0010", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/mg_bt_0010.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[mg_bt_0010] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 전문게이트웨이 배치 결과 [mg_bt_0010] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[mg_bt_0010] 배치 시작 date=%s", biz_date); + + rc = mg_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mg_bt_0010] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_mg_bt_0010(biz_date); + + mg_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[mg_bt_0010] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/mg_bt_0010.pgc b/app/batch/mg_bt_0010.pgc new file mode 100644 index 0000000..f51e393 --- /dev/null +++ b/app/batch/mg_bt_0010.pgc @@ -0,0 +1,138 @@ +/* @tier hard @module mg @transform msg-gateway-batch */ +/* + * mg_bt_0010.pgc - 전문게이트웨이 배치 (커서 순회 + 상태전이) [tier=hard] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: mg_bt_0010 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "mg_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_mg_bt_0010(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_mg_bt_0010 CURSOR FOR + SELECT key, merch_id, amount + FROM mg_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_mg_bt_0010; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_mg_bt_0010"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[mg_bt_0010] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_mg_bt_0010 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_mg_bt_0010"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, MG_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, MG_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = mg_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mg_bt_0010] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_mg_bt_0010; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[mg_bt_0010] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 전문게이트웨이 배치 결과 [mg_bt_0010] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[mg_bt_0010] 배치 시작 date=%s", biz_date); + + rc = mg_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mg_bt_0010] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_mg_bt_0010(biz_date); + + mg_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[mg_bt_0010] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/mg_bt_0011.c b/app/batch/mg_bt_0011.c new file mode 100644 index 0000000..c1ab7e6 --- /dev/null +++ b/app/batch/mg_bt_0011.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/mg_bt_0011.pgc" +/* @tier easy @module mg @transform msg-gateway-batch */ +/* + * mg_bt_0011.pgc - 전문게이트웨이 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: mg_bt_0011 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "mg_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/mg_bt_0011.pgc" + + +static int run_mg_bt_0011(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/mg_bt_0011.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/mg_bt_0011.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/mg_bt_0011.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/mg_bt_0011.pgc" + long h_amount ; + +#line 28 "app/batch/mg_bt_0011.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/mg_bt_0011.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_mg_bt_0011 cursor for select key , merch_id , amount from mg_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/mg_bt_0011.pgc" + +#line 42 "app/batch/mg_bt_0011.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_mg_bt_0011 cursor for select key , merch_id , amount from mg_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/mg_bt_0011.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_mg_bt_0011"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[mg_bt_0011] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_mg_bt_0011", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/mg_bt_0011.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_mg_bt_0011"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, MG_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, MG_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = mg_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mg_bt_0011] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_mg_bt_0011", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/mg_bt_0011.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[mg_bt_0011] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 전문게이트웨이 배치 결과 [mg_bt_0011] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[mg_bt_0011] 배치 시작 date=%s", biz_date); + + rc = mg_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mg_bt_0011] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_mg_bt_0011(biz_date); + + mg_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[mg_bt_0011] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/mg_bt_0011.pgc b/app/batch/mg_bt_0011.pgc new file mode 100644 index 0000000..96ef4fd --- /dev/null +++ b/app/batch/mg_bt_0011.pgc @@ -0,0 +1,138 @@ +/* @tier easy @module mg @transform msg-gateway-batch */ +/* + * mg_bt_0011.pgc - 전문게이트웨이 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: mg_bt_0011 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "mg_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_mg_bt_0011(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_mg_bt_0011 CURSOR FOR + SELECT key, merch_id, amount + FROM mg_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_mg_bt_0011; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_mg_bt_0011"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[mg_bt_0011] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_mg_bt_0011 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_mg_bt_0011"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, MG_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, MG_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = mg_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mg_bt_0011] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_mg_bt_0011; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[mg_bt_0011] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 전문게이트웨이 배치 결과 [mg_bt_0011] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[mg_bt_0011] 배치 시작 date=%s", biz_date); + + rc = mg_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mg_bt_0011] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_mg_bt_0011(biz_date); + + mg_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[mg_bt_0011] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/mg_bt_0012.c b/app/batch/mg_bt_0012.c new file mode 100644 index 0000000..fabed96 --- /dev/null +++ b/app/batch/mg_bt_0012.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/mg_bt_0012.pgc" +/* @tier easy @module mg @transform msg-gateway-batch */ +/* + * mg_bt_0012.pgc - 전문게이트웨이 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: mg_bt_0012 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "mg_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/mg_bt_0012.pgc" + + +static int run_mg_bt_0012(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/mg_bt_0012.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/mg_bt_0012.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/mg_bt_0012.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/mg_bt_0012.pgc" + long h_amount ; + +#line 28 "app/batch/mg_bt_0012.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/mg_bt_0012.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_mg_bt_0012 cursor for select key , merch_id , amount from mg_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/mg_bt_0012.pgc" + +#line 42 "app/batch/mg_bt_0012.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_mg_bt_0012 cursor for select key , merch_id , amount from mg_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/mg_bt_0012.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_mg_bt_0012"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[mg_bt_0012] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_mg_bt_0012", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/mg_bt_0012.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_mg_bt_0012"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, MG_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, MG_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = mg_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mg_bt_0012] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_mg_bt_0012", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/mg_bt_0012.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[mg_bt_0012] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 전문게이트웨이 배치 결과 [mg_bt_0012] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[mg_bt_0012] 배치 시작 date=%s", biz_date); + + rc = mg_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mg_bt_0012] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_mg_bt_0012(biz_date); + + mg_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[mg_bt_0012] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/mg_bt_0012.pgc b/app/batch/mg_bt_0012.pgc new file mode 100644 index 0000000..ef69e64 --- /dev/null +++ b/app/batch/mg_bt_0012.pgc @@ -0,0 +1,138 @@ +/* @tier easy @module mg @transform msg-gateway-batch */ +/* + * mg_bt_0012.pgc - 전문게이트웨이 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: mg_bt_0012 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "mg_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_mg_bt_0012(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_mg_bt_0012 CURSOR FOR + SELECT key, merch_id, amount + FROM mg_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_mg_bt_0012; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_mg_bt_0012"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[mg_bt_0012] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_mg_bt_0012 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_mg_bt_0012"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, MG_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, MG_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = mg_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mg_bt_0012] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_mg_bt_0012; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[mg_bt_0012] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 전문게이트웨이 배치 결과 [mg_bt_0012] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[mg_bt_0012] 배치 시작 date=%s", biz_date); + + rc = mg_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mg_bt_0012] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_mg_bt_0012(biz_date); + + mg_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[mg_bt_0012] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/mg_bt_0013.c b/app/batch/mg_bt_0013.c new file mode 100644 index 0000000..e352f9a --- /dev/null +++ b/app/batch/mg_bt_0013.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/mg_bt_0013.pgc" +/* @tier medium @module mg @transform msg-gateway-batch */ +/* + * mg_bt_0013.pgc - 전문게이트웨이 배치 (커서 순회 + 상태전이) [tier=medium] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: mg_bt_0013 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "mg_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/mg_bt_0013.pgc" + + +static int run_mg_bt_0013(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/mg_bt_0013.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/mg_bt_0013.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/mg_bt_0013.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/mg_bt_0013.pgc" + long h_amount ; + +#line 28 "app/batch/mg_bt_0013.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/mg_bt_0013.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_mg_bt_0013 cursor for select key , merch_id , amount from mg_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/mg_bt_0013.pgc" + +#line 42 "app/batch/mg_bt_0013.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_mg_bt_0013 cursor for select key , merch_id , amount from mg_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/mg_bt_0013.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_mg_bt_0013"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[mg_bt_0013] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_mg_bt_0013", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/mg_bt_0013.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_mg_bt_0013"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, MG_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, MG_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = mg_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mg_bt_0013] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_mg_bt_0013", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/mg_bt_0013.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[mg_bt_0013] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 전문게이트웨이 배치 결과 [mg_bt_0013] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[mg_bt_0013] 배치 시작 date=%s", biz_date); + + rc = mg_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mg_bt_0013] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_mg_bt_0013(biz_date); + + mg_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[mg_bt_0013] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/mg_bt_0013.pgc b/app/batch/mg_bt_0013.pgc new file mode 100644 index 0000000..b9c760e --- /dev/null +++ b/app/batch/mg_bt_0013.pgc @@ -0,0 +1,138 @@ +/* @tier medium @module mg @transform msg-gateway-batch */ +/* + * mg_bt_0013.pgc - 전문게이트웨이 배치 (커서 순회 + 상태전이) [tier=medium] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: mg_bt_0013 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "mg_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_mg_bt_0013(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_mg_bt_0013 CURSOR FOR + SELECT key, merch_id, amount + FROM mg_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_mg_bt_0013; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_mg_bt_0013"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[mg_bt_0013] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_mg_bt_0013 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_mg_bt_0013"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, MG_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, MG_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = mg_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mg_bt_0013] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_mg_bt_0013; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[mg_bt_0013] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 전문게이트웨이 배치 결과 [mg_bt_0013] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[mg_bt_0013] 배치 시작 date=%s", biz_date); + + rc = mg_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mg_bt_0013] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_mg_bt_0013(biz_date); + + mg_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[mg_bt_0013] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/mg_bt_0014.c b/app/batch/mg_bt_0014.c new file mode 100644 index 0000000..c831036 --- /dev/null +++ b/app/batch/mg_bt_0014.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/mg_bt_0014.pgc" +/* @tier easy @module mg @transform msg-gateway-batch */ +/* + * mg_bt_0014.pgc - 전문게이트웨이 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: mg_bt_0014 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "mg_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/mg_bt_0014.pgc" + + +static int run_mg_bt_0014(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/mg_bt_0014.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/mg_bt_0014.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/mg_bt_0014.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/mg_bt_0014.pgc" + long h_amount ; + +#line 28 "app/batch/mg_bt_0014.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/mg_bt_0014.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_mg_bt_0014 cursor for select key , merch_id , amount from mg_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/mg_bt_0014.pgc" + +#line 42 "app/batch/mg_bt_0014.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_mg_bt_0014 cursor for select key , merch_id , amount from mg_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/mg_bt_0014.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_mg_bt_0014"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[mg_bt_0014] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_mg_bt_0014", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/mg_bt_0014.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_mg_bt_0014"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, MG_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, MG_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = mg_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mg_bt_0014] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_mg_bt_0014", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/mg_bt_0014.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[mg_bt_0014] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 전문게이트웨이 배치 결과 [mg_bt_0014] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[mg_bt_0014] 배치 시작 date=%s", biz_date); + + rc = mg_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mg_bt_0014] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_mg_bt_0014(biz_date); + + mg_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[mg_bt_0014] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/mg_bt_0014.pgc b/app/batch/mg_bt_0014.pgc new file mode 100644 index 0000000..6c52e49 --- /dev/null +++ b/app/batch/mg_bt_0014.pgc @@ -0,0 +1,138 @@ +/* @tier easy @module mg @transform msg-gateway-batch */ +/* + * mg_bt_0014.pgc - 전문게이트웨이 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: mg_bt_0014 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "mg_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_mg_bt_0014(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_mg_bt_0014 CURSOR FOR + SELECT key, merch_id, amount + FROM mg_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_mg_bt_0014; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_mg_bt_0014"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[mg_bt_0014] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_mg_bt_0014 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_mg_bt_0014"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, MG_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, MG_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = mg_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mg_bt_0014] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_mg_bt_0014; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[mg_bt_0014] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 전문게이트웨이 배치 결과 [mg_bt_0014] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[mg_bt_0014] 배치 시작 date=%s", biz_date); + + rc = mg_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mg_bt_0014] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_mg_bt_0014(biz_date); + + mg_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[mg_bt_0014] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/mg_bt_0015.c b/app/batch/mg_bt_0015.c new file mode 100644 index 0000000..2f317b1 --- /dev/null +++ b/app/batch/mg_bt_0015.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/mg_bt_0015.pgc" +/* @tier medium @module mg @transform msg-gateway-batch */ +/* + * mg_bt_0015.pgc - 전문게이트웨이 배치 (커서 순회 + 상태전이) [tier=medium] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: mg_bt_0015 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "mg_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/mg_bt_0015.pgc" + + +static int run_mg_bt_0015(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/mg_bt_0015.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/mg_bt_0015.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/mg_bt_0015.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/mg_bt_0015.pgc" + long h_amount ; + +#line 28 "app/batch/mg_bt_0015.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/mg_bt_0015.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_mg_bt_0015 cursor for select key , merch_id , amount from mg_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/mg_bt_0015.pgc" + +#line 42 "app/batch/mg_bt_0015.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_mg_bt_0015 cursor for select key , merch_id , amount from mg_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/mg_bt_0015.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_mg_bt_0015"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[mg_bt_0015] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_mg_bt_0015", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/mg_bt_0015.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_mg_bt_0015"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, MG_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, MG_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = mg_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mg_bt_0015] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_mg_bt_0015", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/mg_bt_0015.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[mg_bt_0015] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 전문게이트웨이 배치 결과 [mg_bt_0015] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[mg_bt_0015] 배치 시작 date=%s", biz_date); + + rc = mg_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mg_bt_0015] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_mg_bt_0015(biz_date); + + mg_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[mg_bt_0015] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/mg_bt_0015.pgc b/app/batch/mg_bt_0015.pgc new file mode 100644 index 0000000..cf3ccfd --- /dev/null +++ b/app/batch/mg_bt_0015.pgc @@ -0,0 +1,138 @@ +/* @tier medium @module mg @transform msg-gateway-batch */ +/* + * mg_bt_0015.pgc - 전문게이트웨이 배치 (커서 순회 + 상태전이) [tier=medium] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: mg_bt_0015 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "mg_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_mg_bt_0015(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_mg_bt_0015 CURSOR FOR + SELECT key, merch_id, amount + FROM mg_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_mg_bt_0015; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_mg_bt_0015"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[mg_bt_0015] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_mg_bt_0015 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_mg_bt_0015"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, MG_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, MG_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = mg_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mg_bt_0015] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_mg_bt_0015; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[mg_bt_0015] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 전문게이트웨이 배치 결과 [mg_bt_0015] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[mg_bt_0015] 배치 시작 date=%s", biz_date); + + rc = mg_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mg_bt_0015] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_mg_bt_0015(biz_date); + + mg_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[mg_bt_0015] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/mg_bt_0016.c b/app/batch/mg_bt_0016.c new file mode 100644 index 0000000..5c776fb --- /dev/null +++ b/app/batch/mg_bt_0016.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/mg_bt_0016.pgc" +/* @tier easy @module mg @transform msg-gateway-batch */ +/* + * mg_bt_0016.pgc - 전문게이트웨이 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: mg_bt_0016 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "mg_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/mg_bt_0016.pgc" + + +static int run_mg_bt_0016(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/mg_bt_0016.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/mg_bt_0016.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/mg_bt_0016.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/mg_bt_0016.pgc" + long h_amount ; + +#line 28 "app/batch/mg_bt_0016.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/mg_bt_0016.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_mg_bt_0016 cursor for select key , merch_id , amount from mg_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/mg_bt_0016.pgc" + +#line 42 "app/batch/mg_bt_0016.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_mg_bt_0016 cursor for select key , merch_id , amount from mg_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/mg_bt_0016.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_mg_bt_0016"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[mg_bt_0016] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_mg_bt_0016", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/mg_bt_0016.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_mg_bt_0016"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, MG_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, MG_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = mg_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mg_bt_0016] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_mg_bt_0016", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/mg_bt_0016.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[mg_bt_0016] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 전문게이트웨이 배치 결과 [mg_bt_0016] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[mg_bt_0016] 배치 시작 date=%s", biz_date); + + rc = mg_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mg_bt_0016] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_mg_bt_0016(biz_date); + + mg_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[mg_bt_0016] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/mg_bt_0016.pgc b/app/batch/mg_bt_0016.pgc new file mode 100644 index 0000000..937d69f --- /dev/null +++ b/app/batch/mg_bt_0016.pgc @@ -0,0 +1,138 @@ +/* @tier easy @module mg @transform msg-gateway-batch */ +/* + * mg_bt_0016.pgc - 전문게이트웨이 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: mg_bt_0016 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "mg_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_mg_bt_0016(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_mg_bt_0016 CURSOR FOR + SELECT key, merch_id, amount + FROM mg_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_mg_bt_0016; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_mg_bt_0016"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[mg_bt_0016] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_mg_bt_0016 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_mg_bt_0016"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, MG_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, MG_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = mg_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mg_bt_0016] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_mg_bt_0016; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[mg_bt_0016] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 전문게이트웨이 배치 결과 [mg_bt_0016] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[mg_bt_0016] 배치 시작 date=%s", biz_date); + + rc = mg_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mg_bt_0016] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_mg_bt_0016(biz_date); + + mg_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[mg_bt_0016] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/mg_bt_0017.c b/app/batch/mg_bt_0017.c new file mode 100644 index 0000000..8c26889 --- /dev/null +++ b/app/batch/mg_bt_0017.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/mg_bt_0017.pgc" +/* @tier medium @module mg @transform msg-gateway-batch */ +/* + * mg_bt_0017.pgc - 전문게이트웨이 배치 (커서 순회 + 상태전이) [tier=medium] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: mg_bt_0017 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "mg_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/mg_bt_0017.pgc" + + +static int run_mg_bt_0017(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/mg_bt_0017.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/mg_bt_0017.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/mg_bt_0017.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/mg_bt_0017.pgc" + long h_amount ; + +#line 28 "app/batch/mg_bt_0017.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/mg_bt_0017.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_mg_bt_0017 cursor for select key , merch_id , amount from mg_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/mg_bt_0017.pgc" + +#line 42 "app/batch/mg_bt_0017.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_mg_bt_0017 cursor for select key , merch_id , amount from mg_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/mg_bt_0017.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_mg_bt_0017"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[mg_bt_0017] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_mg_bt_0017", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/mg_bt_0017.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_mg_bt_0017"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, MG_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, MG_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = mg_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mg_bt_0017] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_mg_bt_0017", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/mg_bt_0017.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[mg_bt_0017] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 전문게이트웨이 배치 결과 [mg_bt_0017] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[mg_bt_0017] 배치 시작 date=%s", biz_date); + + rc = mg_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mg_bt_0017] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_mg_bt_0017(biz_date); + + mg_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[mg_bt_0017] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/mg_bt_0017.pgc b/app/batch/mg_bt_0017.pgc new file mode 100644 index 0000000..44866fa --- /dev/null +++ b/app/batch/mg_bt_0017.pgc @@ -0,0 +1,138 @@ +/* @tier medium @module mg @transform msg-gateway-batch */ +/* + * mg_bt_0017.pgc - 전문게이트웨이 배치 (커서 순회 + 상태전이) [tier=medium] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: mg_bt_0017 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "mg_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_mg_bt_0017(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_mg_bt_0017 CURSOR FOR + SELECT key, merch_id, amount + FROM mg_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_mg_bt_0017; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_mg_bt_0017"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[mg_bt_0017] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_mg_bt_0017 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_mg_bt_0017"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, MG_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, MG_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = mg_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mg_bt_0017] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_mg_bt_0017; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[mg_bt_0017] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 전문게이트웨이 배치 결과 [mg_bt_0017] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[mg_bt_0017] 배치 시작 date=%s", biz_date); + + rc = mg_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mg_bt_0017] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_mg_bt_0017(biz_date); + + mg_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[mg_bt_0017] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/mm_bt_0001.c b/app/batch/mm_bt_0001.c new file mode 100644 index 0000000..50fd18e --- /dev/null +++ b/app/batch/mm_bt_0001.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/mm_bt_0001.pgc" +/* @tier easy @module mm @transform master-batch */ +/* + * mm_bt_0001.pgc - 마스터 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: mm_bt_0001 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "mm_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/mm_bt_0001.pgc" + + +static int run_mm_bt_0001(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/mm_bt_0001.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/mm_bt_0001.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/mm_bt_0001.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/mm_bt_0001.pgc" + long h_amount ; + +#line 28 "app/batch/mm_bt_0001.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/mm_bt_0001.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_mm_bt_0001 cursor for select key , merch_id , amount from mm_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/mm_bt_0001.pgc" + +#line 42 "app/batch/mm_bt_0001.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_mm_bt_0001 cursor for select key , merch_id , amount from mm_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/mm_bt_0001.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_mm_bt_0001"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[mm_bt_0001] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_mm_bt_0001", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/mm_bt_0001.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_mm_bt_0001"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, MM_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, MM_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = mm_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mm_bt_0001] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_mm_bt_0001", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/mm_bt_0001.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[mm_bt_0001] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 마스터 배치 결과 [mm_bt_0001] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[mm_bt_0001] 배치 시작 date=%s", biz_date); + + rc = mm_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mm_bt_0001] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_mm_bt_0001(biz_date); + + mm_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[mm_bt_0001] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/mm_bt_0001.pgc b/app/batch/mm_bt_0001.pgc new file mode 100644 index 0000000..e63d1f1 --- /dev/null +++ b/app/batch/mm_bt_0001.pgc @@ -0,0 +1,138 @@ +/* @tier easy @module mm @transform master-batch */ +/* + * mm_bt_0001.pgc - 마스터 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: mm_bt_0001 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "mm_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_mm_bt_0001(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_mm_bt_0001 CURSOR FOR + SELECT key, merch_id, amount + FROM mm_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_mm_bt_0001; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_mm_bt_0001"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[mm_bt_0001] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_mm_bt_0001 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_mm_bt_0001"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, MM_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, MM_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = mm_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mm_bt_0001] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_mm_bt_0001; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[mm_bt_0001] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 마스터 배치 결과 [mm_bt_0001] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[mm_bt_0001] 배치 시작 date=%s", biz_date); + + rc = mm_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mm_bt_0001] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_mm_bt_0001(biz_date); + + mm_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[mm_bt_0001] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/mm_bt_0002.c b/app/batch/mm_bt_0002.c new file mode 100644 index 0000000..7c05ba4 --- /dev/null +++ b/app/batch/mm_bt_0002.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/mm_bt_0002.pgc" +/* @tier hard @module mm @transform master-batch */ +/* + * mm_bt_0002.pgc - 마스터 배치 (커서 순회 + 상태전이) [tier=hard] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: mm_bt_0002 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "mm_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/mm_bt_0002.pgc" + + +static int run_mm_bt_0002(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/mm_bt_0002.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/mm_bt_0002.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/mm_bt_0002.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/mm_bt_0002.pgc" + long h_amount ; + +#line 28 "app/batch/mm_bt_0002.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/mm_bt_0002.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_mm_bt_0002 cursor for select key , merch_id , amount from mm_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/mm_bt_0002.pgc" + +#line 42 "app/batch/mm_bt_0002.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_mm_bt_0002 cursor for select key , merch_id , amount from mm_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/mm_bt_0002.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_mm_bt_0002"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[mm_bt_0002] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_mm_bt_0002", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/mm_bt_0002.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_mm_bt_0002"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, MM_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, MM_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = mm_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mm_bt_0002] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_mm_bt_0002", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/mm_bt_0002.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[mm_bt_0002] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 마스터 배치 결과 [mm_bt_0002] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[mm_bt_0002] 배치 시작 date=%s", biz_date); + + rc = mm_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mm_bt_0002] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_mm_bt_0002(biz_date); + + mm_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[mm_bt_0002] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/mm_bt_0002.pgc b/app/batch/mm_bt_0002.pgc new file mode 100644 index 0000000..4ebfea3 --- /dev/null +++ b/app/batch/mm_bt_0002.pgc @@ -0,0 +1,138 @@ +/* @tier hard @module mm @transform master-batch */ +/* + * mm_bt_0002.pgc - 마스터 배치 (커서 순회 + 상태전이) [tier=hard] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: mm_bt_0002 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "mm_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_mm_bt_0002(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_mm_bt_0002 CURSOR FOR + SELECT key, merch_id, amount + FROM mm_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_mm_bt_0002; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_mm_bt_0002"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[mm_bt_0002] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_mm_bt_0002 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_mm_bt_0002"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, MM_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, MM_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = mm_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mm_bt_0002] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_mm_bt_0002; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[mm_bt_0002] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 마스터 배치 결과 [mm_bt_0002] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[mm_bt_0002] 배치 시작 date=%s", biz_date); + + rc = mm_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mm_bt_0002] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_mm_bt_0002(biz_date); + + mm_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[mm_bt_0002] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/mm_bt_0003.c b/app/batch/mm_bt_0003.c new file mode 100644 index 0000000..4800970 --- /dev/null +++ b/app/batch/mm_bt_0003.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/mm_bt_0003.pgc" +/* @tier easy @module mm @transform master-batch */ +/* + * mm_bt_0003.pgc - 마스터 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: mm_bt_0003 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "mm_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/mm_bt_0003.pgc" + + +static int run_mm_bt_0003(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/mm_bt_0003.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/mm_bt_0003.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/mm_bt_0003.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/mm_bt_0003.pgc" + long h_amount ; + +#line 28 "app/batch/mm_bt_0003.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/mm_bt_0003.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_mm_bt_0003 cursor for select key , merch_id , amount from mm_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/mm_bt_0003.pgc" + +#line 42 "app/batch/mm_bt_0003.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_mm_bt_0003 cursor for select key , merch_id , amount from mm_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/mm_bt_0003.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_mm_bt_0003"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[mm_bt_0003] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_mm_bt_0003", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/mm_bt_0003.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_mm_bt_0003"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, MM_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, MM_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = mm_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mm_bt_0003] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_mm_bt_0003", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/mm_bt_0003.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[mm_bt_0003] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 마스터 배치 결과 [mm_bt_0003] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[mm_bt_0003] 배치 시작 date=%s", biz_date); + + rc = mm_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mm_bt_0003] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_mm_bt_0003(biz_date); + + mm_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[mm_bt_0003] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/mm_bt_0003.pgc b/app/batch/mm_bt_0003.pgc new file mode 100644 index 0000000..57bcf05 --- /dev/null +++ b/app/batch/mm_bt_0003.pgc @@ -0,0 +1,138 @@ +/* @tier easy @module mm @transform master-batch */ +/* + * mm_bt_0003.pgc - 마스터 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: mm_bt_0003 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "mm_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_mm_bt_0003(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_mm_bt_0003 CURSOR FOR + SELECT key, merch_id, amount + FROM mm_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_mm_bt_0003; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_mm_bt_0003"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[mm_bt_0003] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_mm_bt_0003 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_mm_bt_0003"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, MM_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, MM_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = mm_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mm_bt_0003] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_mm_bt_0003; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[mm_bt_0003] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 마스터 배치 결과 [mm_bt_0003] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[mm_bt_0003] 배치 시작 date=%s", biz_date); + + rc = mm_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mm_bt_0003] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_mm_bt_0003(biz_date); + + mm_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[mm_bt_0003] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/mm_bt_0004.c b/app/batch/mm_bt_0004.c new file mode 100644 index 0000000..f70af41 --- /dev/null +++ b/app/batch/mm_bt_0004.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/mm_bt_0004.pgc" +/* @tier easy @module mm @transform master-batch */ +/* + * mm_bt_0004.pgc - 마스터 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: mm_bt_0004 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "mm_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/mm_bt_0004.pgc" + + +static int run_mm_bt_0004(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/mm_bt_0004.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/mm_bt_0004.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/mm_bt_0004.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/mm_bt_0004.pgc" + long h_amount ; + +#line 28 "app/batch/mm_bt_0004.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/mm_bt_0004.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_mm_bt_0004 cursor for select key , merch_id , amount from mm_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/mm_bt_0004.pgc" + +#line 42 "app/batch/mm_bt_0004.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_mm_bt_0004 cursor for select key , merch_id , amount from mm_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/mm_bt_0004.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_mm_bt_0004"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[mm_bt_0004] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_mm_bt_0004", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/mm_bt_0004.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_mm_bt_0004"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, MM_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, MM_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = mm_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mm_bt_0004] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_mm_bt_0004", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/mm_bt_0004.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[mm_bt_0004] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 마스터 배치 결과 [mm_bt_0004] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[mm_bt_0004] 배치 시작 date=%s", biz_date); + + rc = mm_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mm_bt_0004] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_mm_bt_0004(biz_date); + + mm_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[mm_bt_0004] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/mm_bt_0004.pgc b/app/batch/mm_bt_0004.pgc new file mode 100644 index 0000000..10b841e --- /dev/null +++ b/app/batch/mm_bt_0004.pgc @@ -0,0 +1,138 @@ +/* @tier easy @module mm @transform master-batch */ +/* + * mm_bt_0004.pgc - 마스터 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: mm_bt_0004 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "mm_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_mm_bt_0004(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_mm_bt_0004 CURSOR FOR + SELECT key, merch_id, amount + FROM mm_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_mm_bt_0004; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_mm_bt_0004"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[mm_bt_0004] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_mm_bt_0004 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_mm_bt_0004"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, MM_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, MM_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = mm_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mm_bt_0004] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_mm_bt_0004; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[mm_bt_0004] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 마스터 배치 결과 [mm_bt_0004] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[mm_bt_0004] 배치 시작 date=%s", biz_date); + + rc = mm_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mm_bt_0004] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_mm_bt_0004(biz_date); + + mm_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[mm_bt_0004] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/mm_bt_0005.c b/app/batch/mm_bt_0005.c new file mode 100644 index 0000000..22f8719 --- /dev/null +++ b/app/batch/mm_bt_0005.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/mm_bt_0005.pgc" +/* @tier medium @module mm @transform master-batch */ +/* + * mm_bt_0005.pgc - 마스터 배치 (커서 순회 + 상태전이) [tier=medium] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: mm_bt_0005 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "mm_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/mm_bt_0005.pgc" + + +static int run_mm_bt_0005(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/mm_bt_0005.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/mm_bt_0005.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/mm_bt_0005.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/mm_bt_0005.pgc" + long h_amount ; + +#line 28 "app/batch/mm_bt_0005.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/mm_bt_0005.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_mm_bt_0005 cursor for select key , merch_id , amount from mm_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/mm_bt_0005.pgc" + +#line 42 "app/batch/mm_bt_0005.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_mm_bt_0005 cursor for select key , merch_id , amount from mm_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/mm_bt_0005.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_mm_bt_0005"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[mm_bt_0005] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_mm_bt_0005", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/mm_bt_0005.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_mm_bt_0005"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, MM_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, MM_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = mm_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mm_bt_0005] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_mm_bt_0005", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/mm_bt_0005.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[mm_bt_0005] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 마스터 배치 결과 [mm_bt_0005] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[mm_bt_0005] 배치 시작 date=%s", biz_date); + + rc = mm_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mm_bt_0005] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_mm_bt_0005(biz_date); + + mm_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[mm_bt_0005] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/mm_bt_0005.pgc b/app/batch/mm_bt_0005.pgc new file mode 100644 index 0000000..d46dda8 --- /dev/null +++ b/app/batch/mm_bt_0005.pgc @@ -0,0 +1,138 @@ +/* @tier medium @module mm @transform master-batch */ +/* + * mm_bt_0005.pgc - 마스터 배치 (커서 순회 + 상태전이) [tier=medium] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: mm_bt_0005 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "mm_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_mm_bt_0005(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_mm_bt_0005 CURSOR FOR + SELECT key, merch_id, amount + FROM mm_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_mm_bt_0005; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_mm_bt_0005"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[mm_bt_0005] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_mm_bt_0005 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_mm_bt_0005"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, MM_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, MM_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = mm_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mm_bt_0005] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_mm_bt_0005; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[mm_bt_0005] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 마스터 배치 결과 [mm_bt_0005] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[mm_bt_0005] 배치 시작 date=%s", biz_date); + + rc = mm_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mm_bt_0005] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_mm_bt_0005(biz_date); + + mm_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[mm_bt_0005] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/mm_bt_0006.c b/app/batch/mm_bt_0006.c new file mode 100644 index 0000000..098c533 --- /dev/null +++ b/app/batch/mm_bt_0006.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/mm_bt_0006.pgc" +/* @tier easy @module mm @transform master-batch */ +/* + * mm_bt_0006.pgc - 마스터 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: mm_bt_0006 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "mm_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/mm_bt_0006.pgc" + + +static int run_mm_bt_0006(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/mm_bt_0006.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/mm_bt_0006.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/mm_bt_0006.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/mm_bt_0006.pgc" + long h_amount ; + +#line 28 "app/batch/mm_bt_0006.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/mm_bt_0006.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_mm_bt_0006 cursor for select key , merch_id , amount from mm_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/mm_bt_0006.pgc" + +#line 42 "app/batch/mm_bt_0006.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_mm_bt_0006 cursor for select key , merch_id , amount from mm_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/mm_bt_0006.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_mm_bt_0006"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[mm_bt_0006] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_mm_bt_0006", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/mm_bt_0006.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_mm_bt_0006"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, MM_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, MM_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = mm_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mm_bt_0006] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_mm_bt_0006", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/mm_bt_0006.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[mm_bt_0006] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 마스터 배치 결과 [mm_bt_0006] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[mm_bt_0006] 배치 시작 date=%s", biz_date); + + rc = mm_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mm_bt_0006] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_mm_bt_0006(biz_date); + + mm_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[mm_bt_0006] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/mm_bt_0006.pgc b/app/batch/mm_bt_0006.pgc new file mode 100644 index 0000000..388736d --- /dev/null +++ b/app/batch/mm_bt_0006.pgc @@ -0,0 +1,138 @@ +/* @tier easy @module mm @transform master-batch */ +/* + * mm_bt_0006.pgc - 마스터 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: mm_bt_0006 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "mm_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_mm_bt_0006(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_mm_bt_0006 CURSOR FOR + SELECT key, merch_id, amount + FROM mm_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_mm_bt_0006; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_mm_bt_0006"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[mm_bt_0006] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_mm_bt_0006 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_mm_bt_0006"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, MM_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, MM_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = mm_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mm_bt_0006] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_mm_bt_0006; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[mm_bt_0006] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 마스터 배치 결과 [mm_bt_0006] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[mm_bt_0006] 배치 시작 date=%s", biz_date); + + rc = mm_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mm_bt_0006] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_mm_bt_0006(biz_date); + + mm_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[mm_bt_0006] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/mm_bt_0007.c b/app/batch/mm_bt_0007.c new file mode 100644 index 0000000..ff5d2c8 --- /dev/null +++ b/app/batch/mm_bt_0007.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/mm_bt_0007.pgc" +/* @tier medium @module mm @transform master-batch */ +/* + * mm_bt_0007.pgc - 마스터 배치 (커서 순회 + 상태전이) [tier=medium] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: mm_bt_0007 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "mm_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/mm_bt_0007.pgc" + + +static int run_mm_bt_0007(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/mm_bt_0007.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/mm_bt_0007.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/mm_bt_0007.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/mm_bt_0007.pgc" + long h_amount ; + +#line 28 "app/batch/mm_bt_0007.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/mm_bt_0007.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_mm_bt_0007 cursor for select key , merch_id , amount from mm_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/mm_bt_0007.pgc" + +#line 42 "app/batch/mm_bt_0007.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_mm_bt_0007 cursor for select key , merch_id , amount from mm_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/mm_bt_0007.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_mm_bt_0007"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[mm_bt_0007] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_mm_bt_0007", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/mm_bt_0007.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_mm_bt_0007"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, MM_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, MM_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = mm_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mm_bt_0007] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_mm_bt_0007", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/mm_bt_0007.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[mm_bt_0007] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 마스터 배치 결과 [mm_bt_0007] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[mm_bt_0007] 배치 시작 date=%s", biz_date); + + rc = mm_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mm_bt_0007] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_mm_bt_0007(biz_date); + + mm_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[mm_bt_0007] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/mm_bt_0007.pgc b/app/batch/mm_bt_0007.pgc new file mode 100644 index 0000000..9870493 --- /dev/null +++ b/app/batch/mm_bt_0007.pgc @@ -0,0 +1,138 @@ +/* @tier medium @module mm @transform master-batch */ +/* + * mm_bt_0007.pgc - 마스터 배치 (커서 순회 + 상태전이) [tier=medium] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: mm_bt_0007 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "mm_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_mm_bt_0007(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_mm_bt_0007 CURSOR FOR + SELECT key, merch_id, amount + FROM mm_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_mm_bt_0007; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_mm_bt_0007"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[mm_bt_0007] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_mm_bt_0007 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_mm_bt_0007"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, MM_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, MM_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = mm_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mm_bt_0007] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_mm_bt_0007; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[mm_bt_0007] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 마스터 배치 결과 [mm_bt_0007] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[mm_bt_0007] 배치 시작 date=%s", biz_date); + + rc = mm_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mm_bt_0007] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_mm_bt_0007(biz_date); + + mm_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[mm_bt_0007] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/mm_bt_0008.c b/app/batch/mm_bt_0008.c new file mode 100644 index 0000000..385329b --- /dev/null +++ b/app/batch/mm_bt_0008.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/mm_bt_0008.pgc" +/* @tier easy @module mm @transform master-batch */ +/* + * mm_bt_0008.pgc - 마스터 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: mm_bt_0008 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "mm_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/mm_bt_0008.pgc" + + +static int run_mm_bt_0008(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/mm_bt_0008.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/mm_bt_0008.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/mm_bt_0008.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/mm_bt_0008.pgc" + long h_amount ; + +#line 28 "app/batch/mm_bt_0008.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/mm_bt_0008.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_mm_bt_0008 cursor for select key , merch_id , amount from mm_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/mm_bt_0008.pgc" + +#line 42 "app/batch/mm_bt_0008.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_mm_bt_0008 cursor for select key , merch_id , amount from mm_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/mm_bt_0008.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_mm_bt_0008"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[mm_bt_0008] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_mm_bt_0008", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/mm_bt_0008.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_mm_bt_0008"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, MM_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, MM_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = mm_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mm_bt_0008] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_mm_bt_0008", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/mm_bt_0008.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[mm_bt_0008] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 마스터 배치 결과 [mm_bt_0008] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[mm_bt_0008] 배치 시작 date=%s", biz_date); + + rc = mm_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mm_bt_0008] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_mm_bt_0008(biz_date); + + mm_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[mm_bt_0008] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/mm_bt_0008.pgc b/app/batch/mm_bt_0008.pgc new file mode 100644 index 0000000..60e52c5 --- /dev/null +++ b/app/batch/mm_bt_0008.pgc @@ -0,0 +1,138 @@ +/* @tier easy @module mm @transform master-batch */ +/* + * mm_bt_0008.pgc - 마스터 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: mm_bt_0008 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "mm_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_mm_bt_0008(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_mm_bt_0008 CURSOR FOR + SELECT key, merch_id, amount + FROM mm_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_mm_bt_0008; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_mm_bt_0008"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[mm_bt_0008] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_mm_bt_0008 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_mm_bt_0008"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, MM_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, MM_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = mm_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mm_bt_0008] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_mm_bt_0008; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[mm_bt_0008] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 마스터 배치 결과 [mm_bt_0008] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[mm_bt_0008] 배치 시작 date=%s", biz_date); + + rc = mm_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mm_bt_0008] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_mm_bt_0008(biz_date); + + mm_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[mm_bt_0008] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/mm_bt_0009.c b/app/batch/mm_bt_0009.c new file mode 100644 index 0000000..349c8ea --- /dev/null +++ b/app/batch/mm_bt_0009.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/mm_bt_0009.pgc" +/* @tier medium @module mm @transform master-batch */ +/* + * mm_bt_0009.pgc - 마스터 배치 (커서 순회 + 상태전이) [tier=medium] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: mm_bt_0009 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "mm_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/mm_bt_0009.pgc" + + +static int run_mm_bt_0009(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/mm_bt_0009.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/mm_bt_0009.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/mm_bt_0009.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/mm_bt_0009.pgc" + long h_amount ; + +#line 28 "app/batch/mm_bt_0009.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/mm_bt_0009.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_mm_bt_0009 cursor for select key , merch_id , amount from mm_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/mm_bt_0009.pgc" + +#line 42 "app/batch/mm_bt_0009.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_mm_bt_0009 cursor for select key , merch_id , amount from mm_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/mm_bt_0009.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_mm_bt_0009"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[mm_bt_0009] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_mm_bt_0009", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/mm_bt_0009.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_mm_bt_0009"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, MM_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, MM_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = mm_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mm_bt_0009] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_mm_bt_0009", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/mm_bt_0009.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[mm_bt_0009] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 마스터 배치 결과 [mm_bt_0009] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[mm_bt_0009] 배치 시작 date=%s", biz_date); + + rc = mm_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mm_bt_0009] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_mm_bt_0009(biz_date); + + mm_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[mm_bt_0009] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/mm_bt_0009.pgc b/app/batch/mm_bt_0009.pgc new file mode 100644 index 0000000..c9f5c46 --- /dev/null +++ b/app/batch/mm_bt_0009.pgc @@ -0,0 +1,138 @@ +/* @tier medium @module mm @transform master-batch */ +/* + * mm_bt_0009.pgc - 마스터 배치 (커서 순회 + 상태전이) [tier=medium] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: mm_bt_0009 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "mm_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_mm_bt_0009(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_mm_bt_0009 CURSOR FOR + SELECT key, merch_id, amount + FROM mm_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_mm_bt_0009; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_mm_bt_0009"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[mm_bt_0009] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_mm_bt_0009 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_mm_bt_0009"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, MM_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, MM_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = mm_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mm_bt_0009] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_mm_bt_0009; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[mm_bt_0009] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 마스터 배치 결과 [mm_bt_0009] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[mm_bt_0009] 배치 시작 date=%s", biz_date); + + rc = mm_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mm_bt_0009] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_mm_bt_0009(biz_date); + + mm_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[mm_bt_0009] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/mm_bt_0010.c b/app/batch/mm_bt_0010.c new file mode 100644 index 0000000..404696e --- /dev/null +++ b/app/batch/mm_bt_0010.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/mm_bt_0010.pgc" +/* @tier easy @module mm @transform master-batch */ +/* + * mm_bt_0010.pgc - 마스터 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: mm_bt_0010 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "mm_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/mm_bt_0010.pgc" + + +static int run_mm_bt_0010(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/mm_bt_0010.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/mm_bt_0010.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/mm_bt_0010.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/mm_bt_0010.pgc" + long h_amount ; + +#line 28 "app/batch/mm_bt_0010.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/mm_bt_0010.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_mm_bt_0010 cursor for select key , merch_id , amount from mm_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/mm_bt_0010.pgc" + +#line 42 "app/batch/mm_bt_0010.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_mm_bt_0010 cursor for select key , merch_id , amount from mm_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/mm_bt_0010.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_mm_bt_0010"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[mm_bt_0010] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_mm_bt_0010", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/mm_bt_0010.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_mm_bt_0010"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, MM_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, MM_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = mm_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mm_bt_0010] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_mm_bt_0010", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/mm_bt_0010.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[mm_bt_0010] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 마스터 배치 결과 [mm_bt_0010] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[mm_bt_0010] 배치 시작 date=%s", biz_date); + + rc = mm_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mm_bt_0010] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_mm_bt_0010(biz_date); + + mm_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[mm_bt_0010] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/mm_bt_0010.pgc b/app/batch/mm_bt_0010.pgc new file mode 100644 index 0000000..100bc33 --- /dev/null +++ b/app/batch/mm_bt_0010.pgc @@ -0,0 +1,138 @@ +/* @tier easy @module mm @transform master-batch */ +/* + * mm_bt_0010.pgc - 마스터 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: mm_bt_0010 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "mm_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_mm_bt_0010(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_mm_bt_0010 CURSOR FOR + SELECT key, merch_id, amount + FROM mm_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_mm_bt_0010; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_mm_bt_0010"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[mm_bt_0010] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_mm_bt_0010 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_mm_bt_0010"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, MM_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, MM_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = mm_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mm_bt_0010] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_mm_bt_0010; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[mm_bt_0010] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 마스터 배치 결과 [mm_bt_0010] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[mm_bt_0010] 배치 시작 date=%s", biz_date); + + rc = mm_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mm_bt_0010] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_mm_bt_0010(biz_date); + + mm_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[mm_bt_0010] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/mm_bt_0011.c b/app/batch/mm_bt_0011.c new file mode 100644 index 0000000..18fc9d4 --- /dev/null +++ b/app/batch/mm_bt_0011.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/mm_bt_0011.pgc" +/* @tier hard @module mm @transform master-batch */ +/* + * mm_bt_0011.pgc - 마스터 배치 (커서 순회 + 상태전이) [tier=hard] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: mm_bt_0011 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "mm_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/mm_bt_0011.pgc" + + +static int run_mm_bt_0011(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/mm_bt_0011.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/mm_bt_0011.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/mm_bt_0011.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/mm_bt_0011.pgc" + long h_amount ; + +#line 28 "app/batch/mm_bt_0011.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/mm_bt_0011.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_mm_bt_0011 cursor for select key , merch_id , amount from mm_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/mm_bt_0011.pgc" + +#line 42 "app/batch/mm_bt_0011.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_mm_bt_0011 cursor for select key , merch_id , amount from mm_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/mm_bt_0011.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_mm_bt_0011"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[mm_bt_0011] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_mm_bt_0011", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/mm_bt_0011.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_mm_bt_0011"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, MM_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, MM_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = mm_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mm_bt_0011] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_mm_bt_0011", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/mm_bt_0011.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[mm_bt_0011] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 마스터 배치 결과 [mm_bt_0011] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[mm_bt_0011] 배치 시작 date=%s", biz_date); + + rc = mm_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mm_bt_0011] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_mm_bt_0011(biz_date); + + mm_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[mm_bt_0011] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/mm_bt_0011.pgc b/app/batch/mm_bt_0011.pgc new file mode 100644 index 0000000..48a6ec3 --- /dev/null +++ b/app/batch/mm_bt_0011.pgc @@ -0,0 +1,138 @@ +/* @tier hard @module mm @transform master-batch */ +/* + * mm_bt_0011.pgc - 마스터 배치 (커서 순회 + 상태전이) [tier=hard] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: mm_bt_0011 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "mm_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_mm_bt_0011(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_mm_bt_0011 CURSOR FOR + SELECT key, merch_id, amount + FROM mm_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_mm_bt_0011; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_mm_bt_0011"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[mm_bt_0011] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_mm_bt_0011 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_mm_bt_0011"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, MM_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, MM_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = mm_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mm_bt_0011] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_mm_bt_0011; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[mm_bt_0011] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 마스터 배치 결과 [mm_bt_0011] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[mm_bt_0011] 배치 시작 date=%s", biz_date); + + rc = mm_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mm_bt_0011] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_mm_bt_0011(biz_date); + + mm_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[mm_bt_0011] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/mm_bt_0012.c b/app/batch/mm_bt_0012.c new file mode 100644 index 0000000..f815f69 --- /dev/null +++ b/app/batch/mm_bt_0012.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/mm_bt_0012.pgc" +/* @tier easy @module mm @transform master-batch */ +/* + * mm_bt_0012.pgc - 마스터 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: mm_bt_0012 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "mm_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/mm_bt_0012.pgc" + + +static int run_mm_bt_0012(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/mm_bt_0012.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/mm_bt_0012.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/mm_bt_0012.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/mm_bt_0012.pgc" + long h_amount ; + +#line 28 "app/batch/mm_bt_0012.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/mm_bt_0012.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_mm_bt_0012 cursor for select key , merch_id , amount from mm_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/mm_bt_0012.pgc" + +#line 42 "app/batch/mm_bt_0012.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_mm_bt_0012 cursor for select key , merch_id , amount from mm_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/mm_bt_0012.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_mm_bt_0012"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[mm_bt_0012] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_mm_bt_0012", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/mm_bt_0012.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_mm_bt_0012"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, MM_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, MM_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = mm_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mm_bt_0012] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_mm_bt_0012", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/mm_bt_0012.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[mm_bt_0012] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 마스터 배치 결과 [mm_bt_0012] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[mm_bt_0012] 배치 시작 date=%s", biz_date); + + rc = mm_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mm_bt_0012] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_mm_bt_0012(biz_date); + + mm_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[mm_bt_0012] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/mm_bt_0012.pgc b/app/batch/mm_bt_0012.pgc new file mode 100644 index 0000000..552bc52 --- /dev/null +++ b/app/batch/mm_bt_0012.pgc @@ -0,0 +1,138 @@ +/* @tier easy @module mm @transform master-batch */ +/* + * mm_bt_0012.pgc - 마스터 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: mm_bt_0012 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "mm_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_mm_bt_0012(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_mm_bt_0012 CURSOR FOR + SELECT key, merch_id, amount + FROM mm_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_mm_bt_0012; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_mm_bt_0012"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[mm_bt_0012] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_mm_bt_0012 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_mm_bt_0012"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, MM_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, MM_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = mm_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mm_bt_0012] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_mm_bt_0012; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[mm_bt_0012] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 마스터 배치 결과 [mm_bt_0012] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[mm_bt_0012] 배치 시작 date=%s", biz_date); + + rc = mm_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mm_bt_0012] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_mm_bt_0012(biz_date); + + mm_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[mm_bt_0012] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/mm_bt_0013.c b/app/batch/mm_bt_0013.c new file mode 100644 index 0000000..7c3f27e --- /dev/null +++ b/app/batch/mm_bt_0013.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/mm_bt_0013.pgc" +/* @tier easy @module mm @transform master-batch */ +/* + * mm_bt_0013.pgc - 마스터 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: mm_bt_0013 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "mm_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/mm_bt_0013.pgc" + + +static int run_mm_bt_0013(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/mm_bt_0013.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/mm_bt_0013.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/mm_bt_0013.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/mm_bt_0013.pgc" + long h_amount ; + +#line 28 "app/batch/mm_bt_0013.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/mm_bt_0013.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_mm_bt_0013 cursor for select key , merch_id , amount from mm_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/mm_bt_0013.pgc" + +#line 42 "app/batch/mm_bt_0013.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_mm_bt_0013 cursor for select key , merch_id , amount from mm_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/mm_bt_0013.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_mm_bt_0013"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[mm_bt_0013] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_mm_bt_0013", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/mm_bt_0013.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_mm_bt_0013"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, MM_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, MM_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = mm_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mm_bt_0013] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_mm_bt_0013", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/mm_bt_0013.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[mm_bt_0013] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 마스터 배치 결과 [mm_bt_0013] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[mm_bt_0013] 배치 시작 date=%s", biz_date); + + rc = mm_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mm_bt_0013] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_mm_bt_0013(biz_date); + + mm_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[mm_bt_0013] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/mm_bt_0013.pgc b/app/batch/mm_bt_0013.pgc new file mode 100644 index 0000000..1f953d8 --- /dev/null +++ b/app/batch/mm_bt_0013.pgc @@ -0,0 +1,138 @@ +/* @tier easy @module mm @transform master-batch */ +/* + * mm_bt_0013.pgc - 마스터 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: mm_bt_0013 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "mm_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_mm_bt_0013(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_mm_bt_0013 CURSOR FOR + SELECT key, merch_id, amount + FROM mm_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_mm_bt_0013; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_mm_bt_0013"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[mm_bt_0013] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_mm_bt_0013 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_mm_bt_0013"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, MM_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, MM_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = mm_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mm_bt_0013] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_mm_bt_0013; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[mm_bt_0013] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 마스터 배치 결과 [mm_bt_0013] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[mm_bt_0013] 배치 시작 date=%s", biz_date); + + rc = mm_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mm_bt_0013] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_mm_bt_0013(biz_date); + + mm_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[mm_bt_0013] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/mm_bt_0014.c b/app/batch/mm_bt_0014.c new file mode 100644 index 0000000..a76d4ea --- /dev/null +++ b/app/batch/mm_bt_0014.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/mm_bt_0014.pgc" +/* @tier medium @module mm @transform master-batch */ +/* + * mm_bt_0014.pgc - 마스터 배치 (커서 순회 + 상태전이) [tier=medium] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: mm_bt_0014 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "mm_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/mm_bt_0014.pgc" + + +static int run_mm_bt_0014(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/mm_bt_0014.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/mm_bt_0014.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/mm_bt_0014.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/mm_bt_0014.pgc" + long h_amount ; + +#line 28 "app/batch/mm_bt_0014.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/mm_bt_0014.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_mm_bt_0014 cursor for select key , merch_id , amount from mm_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/mm_bt_0014.pgc" + +#line 42 "app/batch/mm_bt_0014.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_mm_bt_0014 cursor for select key , merch_id , amount from mm_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/mm_bt_0014.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_mm_bt_0014"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[mm_bt_0014] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_mm_bt_0014", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/mm_bt_0014.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_mm_bt_0014"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, MM_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, MM_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = mm_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mm_bt_0014] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_mm_bt_0014", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/mm_bt_0014.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[mm_bt_0014] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 마스터 배치 결과 [mm_bt_0014] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[mm_bt_0014] 배치 시작 date=%s", biz_date); + + rc = mm_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mm_bt_0014] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_mm_bt_0014(biz_date); + + mm_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[mm_bt_0014] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/mm_bt_0014.pgc b/app/batch/mm_bt_0014.pgc new file mode 100644 index 0000000..79e5d4e --- /dev/null +++ b/app/batch/mm_bt_0014.pgc @@ -0,0 +1,138 @@ +/* @tier medium @module mm @transform master-batch */ +/* + * mm_bt_0014.pgc - 마스터 배치 (커서 순회 + 상태전이) [tier=medium] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: mm_bt_0014 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "mm_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_mm_bt_0014(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_mm_bt_0014 CURSOR FOR + SELECT key, merch_id, amount + FROM mm_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_mm_bt_0014; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_mm_bt_0014"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[mm_bt_0014] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_mm_bt_0014 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_mm_bt_0014"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, MM_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, MM_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = mm_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mm_bt_0014] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_mm_bt_0014; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[mm_bt_0014] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 마스터 배치 결과 [mm_bt_0014] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[mm_bt_0014] 배치 시작 date=%s", biz_date); + + rc = mm_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mm_bt_0014] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_mm_bt_0014(biz_date); + + mm_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[mm_bt_0014] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/mm_bt_0015.c b/app/batch/mm_bt_0015.c new file mode 100644 index 0000000..3700175 --- /dev/null +++ b/app/batch/mm_bt_0015.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/mm_bt_0015.pgc" +/* @tier easy @module mm @transform master-batch */ +/* + * mm_bt_0015.pgc - 마스터 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: mm_bt_0015 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "mm_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/mm_bt_0015.pgc" + + +static int run_mm_bt_0015(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/mm_bt_0015.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/mm_bt_0015.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/mm_bt_0015.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/mm_bt_0015.pgc" + long h_amount ; + +#line 28 "app/batch/mm_bt_0015.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/mm_bt_0015.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_mm_bt_0015 cursor for select key , merch_id , amount from mm_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/mm_bt_0015.pgc" + +#line 42 "app/batch/mm_bt_0015.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_mm_bt_0015 cursor for select key , merch_id , amount from mm_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/mm_bt_0015.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_mm_bt_0015"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[mm_bt_0015] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_mm_bt_0015", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/mm_bt_0015.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_mm_bt_0015"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, MM_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, MM_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = mm_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mm_bt_0015] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_mm_bt_0015", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/mm_bt_0015.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[mm_bt_0015] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 마스터 배치 결과 [mm_bt_0015] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[mm_bt_0015] 배치 시작 date=%s", biz_date); + + rc = mm_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mm_bt_0015] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_mm_bt_0015(biz_date); + + mm_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[mm_bt_0015] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/mm_bt_0015.pgc b/app/batch/mm_bt_0015.pgc new file mode 100644 index 0000000..84db1a6 --- /dev/null +++ b/app/batch/mm_bt_0015.pgc @@ -0,0 +1,138 @@ +/* @tier easy @module mm @transform master-batch */ +/* + * mm_bt_0015.pgc - 마스터 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: mm_bt_0015 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "mm_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_mm_bt_0015(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_mm_bt_0015 CURSOR FOR + SELECT key, merch_id, amount + FROM mm_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_mm_bt_0015; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_mm_bt_0015"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[mm_bt_0015] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_mm_bt_0015 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_mm_bt_0015"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, MM_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, MM_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = mm_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mm_bt_0015] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_mm_bt_0015; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[mm_bt_0015] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 마스터 배치 결과 [mm_bt_0015] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[mm_bt_0015] 배치 시작 date=%s", biz_date); + + rc = mm_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mm_bt_0015] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_mm_bt_0015(biz_date); + + mm_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[mm_bt_0015] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/mm_bt_0016.c b/app/batch/mm_bt_0016.c new file mode 100644 index 0000000..1703690 --- /dev/null +++ b/app/batch/mm_bt_0016.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/mm_bt_0016.pgc" +/* @tier medium @module mm @transform master-batch */ +/* + * mm_bt_0016.pgc - 마스터 배치 (커서 순회 + 상태전이) [tier=medium] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: mm_bt_0016 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "mm_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/mm_bt_0016.pgc" + + +static int run_mm_bt_0016(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/mm_bt_0016.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/mm_bt_0016.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/mm_bt_0016.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/mm_bt_0016.pgc" + long h_amount ; + +#line 28 "app/batch/mm_bt_0016.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/mm_bt_0016.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_mm_bt_0016 cursor for select key , merch_id , amount from mm_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/mm_bt_0016.pgc" + +#line 42 "app/batch/mm_bt_0016.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_mm_bt_0016 cursor for select key , merch_id , amount from mm_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/mm_bt_0016.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_mm_bt_0016"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[mm_bt_0016] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_mm_bt_0016", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/mm_bt_0016.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_mm_bt_0016"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, MM_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, MM_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = mm_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mm_bt_0016] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_mm_bt_0016", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/mm_bt_0016.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[mm_bt_0016] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 마스터 배치 결과 [mm_bt_0016] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[mm_bt_0016] 배치 시작 date=%s", biz_date); + + rc = mm_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mm_bt_0016] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_mm_bt_0016(biz_date); + + mm_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[mm_bt_0016] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/mm_bt_0016.pgc b/app/batch/mm_bt_0016.pgc new file mode 100644 index 0000000..7c51447 --- /dev/null +++ b/app/batch/mm_bt_0016.pgc @@ -0,0 +1,138 @@ +/* @tier medium @module mm @transform master-batch */ +/* + * mm_bt_0016.pgc - 마스터 배치 (커서 순회 + 상태전이) [tier=medium] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: mm_bt_0016 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "mm_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_mm_bt_0016(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_mm_bt_0016 CURSOR FOR + SELECT key, merch_id, amount + FROM mm_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_mm_bt_0016; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_mm_bt_0016"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[mm_bt_0016] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_mm_bt_0016 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_mm_bt_0016"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, MM_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, MM_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = mm_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mm_bt_0016] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_mm_bt_0016; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[mm_bt_0016] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 마스터 배치 결과 [mm_bt_0016] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[mm_bt_0016] 배치 시작 date=%s", biz_date); + + rc = mm_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[mm_bt_0016] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_mm_bt_0016(biz_date); + + mm_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[mm_bt_0016] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/py_bt_0001.c b/app/batch/py_bt_0001.c new file mode 100644 index 0000000..2284e8b --- /dev/null +++ b/app/batch/py_bt_0001.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/py_bt_0001.pgc" +/* @tier easy @module py @transform payment-batch */ +/* + * py_bt_0001.pgc - 지급 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: py_bt_0001 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "py_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/py_bt_0001.pgc" + + +static int run_py_bt_0001(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/py_bt_0001.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/py_bt_0001.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/py_bt_0001.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/py_bt_0001.pgc" + long h_amount ; + +#line 28 "app/batch/py_bt_0001.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/py_bt_0001.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_py_bt_0001 cursor for select key , merch_id , amount from py_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/py_bt_0001.pgc" + +#line 42 "app/batch/py_bt_0001.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_py_bt_0001 cursor for select key , merch_id , amount from py_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/py_bt_0001.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_py_bt_0001"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[py_bt_0001] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_py_bt_0001", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/py_bt_0001.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_py_bt_0001"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, PY_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, PY_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = py_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[py_bt_0001] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_py_bt_0001", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/py_bt_0001.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[py_bt_0001] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 지급 배치 결과 [py_bt_0001] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[py_bt_0001] 배치 시작 date=%s", biz_date); + + rc = py_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[py_bt_0001] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_py_bt_0001(biz_date); + + py_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[py_bt_0001] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/py_bt_0001.pgc b/app/batch/py_bt_0001.pgc new file mode 100644 index 0000000..ec59b18 --- /dev/null +++ b/app/batch/py_bt_0001.pgc @@ -0,0 +1,138 @@ +/* @tier easy @module py @transform payment-batch */ +/* + * py_bt_0001.pgc - 지급 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: py_bt_0001 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "py_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_py_bt_0001(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_py_bt_0001 CURSOR FOR + SELECT key, merch_id, amount + FROM py_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_py_bt_0001; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_py_bt_0001"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[py_bt_0001] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_py_bt_0001 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_py_bt_0001"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, PY_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, PY_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = py_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[py_bt_0001] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_py_bt_0001; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[py_bt_0001] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 지급 배치 결과 [py_bt_0001] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[py_bt_0001] 배치 시작 date=%s", biz_date); + + rc = py_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[py_bt_0001] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_py_bt_0001(biz_date); + + py_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[py_bt_0001] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/py_bt_0002.c b/app/batch/py_bt_0002.c new file mode 100644 index 0000000..77c0117 --- /dev/null +++ b/app/batch/py_bt_0002.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/py_bt_0002.pgc" +/* @tier hard @module py @transform payment-batch */ +/* + * py_bt_0002.pgc - 지급 배치 (커서 순회 + 상태전이) [tier=hard] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: py_bt_0002 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "py_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/py_bt_0002.pgc" + + +static int run_py_bt_0002(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/py_bt_0002.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/py_bt_0002.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/py_bt_0002.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/py_bt_0002.pgc" + long h_amount ; + +#line 28 "app/batch/py_bt_0002.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/py_bt_0002.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_py_bt_0002 cursor for select key , merch_id , amount from py_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/py_bt_0002.pgc" + +#line 42 "app/batch/py_bt_0002.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_py_bt_0002 cursor for select key , merch_id , amount from py_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/py_bt_0002.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_py_bt_0002"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[py_bt_0002] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_py_bt_0002", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/py_bt_0002.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_py_bt_0002"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, PY_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, PY_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = py_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[py_bt_0002] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_py_bt_0002", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/py_bt_0002.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[py_bt_0002] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 지급 배치 결과 [py_bt_0002] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[py_bt_0002] 배치 시작 date=%s", biz_date); + + rc = py_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[py_bt_0002] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_py_bt_0002(biz_date); + + py_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[py_bt_0002] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/py_bt_0002.pgc b/app/batch/py_bt_0002.pgc new file mode 100644 index 0000000..b908524 --- /dev/null +++ b/app/batch/py_bt_0002.pgc @@ -0,0 +1,138 @@ +/* @tier hard @module py @transform payment-batch */ +/* + * py_bt_0002.pgc - 지급 배치 (커서 순회 + 상태전이) [tier=hard] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: py_bt_0002 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "py_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_py_bt_0002(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_py_bt_0002 CURSOR FOR + SELECT key, merch_id, amount + FROM py_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_py_bt_0002; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_py_bt_0002"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[py_bt_0002] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_py_bt_0002 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_py_bt_0002"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, PY_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, PY_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = py_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[py_bt_0002] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_py_bt_0002; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[py_bt_0002] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 지급 배치 결과 [py_bt_0002] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[py_bt_0002] 배치 시작 date=%s", biz_date); + + rc = py_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[py_bt_0002] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_py_bt_0002(biz_date); + + py_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[py_bt_0002] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/py_bt_0003.c b/app/batch/py_bt_0003.c new file mode 100644 index 0000000..4f7826a --- /dev/null +++ b/app/batch/py_bt_0003.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/py_bt_0003.pgc" +/* @tier easy @module py @transform payment-batch */ +/* + * py_bt_0003.pgc - 지급 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: py_bt_0003 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "py_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/py_bt_0003.pgc" + + +static int run_py_bt_0003(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/py_bt_0003.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/py_bt_0003.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/py_bt_0003.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/py_bt_0003.pgc" + long h_amount ; + +#line 28 "app/batch/py_bt_0003.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/py_bt_0003.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_py_bt_0003 cursor for select key , merch_id , amount from py_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/py_bt_0003.pgc" + +#line 42 "app/batch/py_bt_0003.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_py_bt_0003 cursor for select key , merch_id , amount from py_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/py_bt_0003.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_py_bt_0003"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[py_bt_0003] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_py_bt_0003", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/py_bt_0003.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_py_bt_0003"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, PY_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, PY_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = py_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[py_bt_0003] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_py_bt_0003", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/py_bt_0003.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[py_bt_0003] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 지급 배치 결과 [py_bt_0003] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[py_bt_0003] 배치 시작 date=%s", biz_date); + + rc = py_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[py_bt_0003] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_py_bt_0003(biz_date); + + py_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[py_bt_0003] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/py_bt_0003.pgc b/app/batch/py_bt_0003.pgc new file mode 100644 index 0000000..a7dd5ac --- /dev/null +++ b/app/batch/py_bt_0003.pgc @@ -0,0 +1,138 @@ +/* @tier easy @module py @transform payment-batch */ +/* + * py_bt_0003.pgc - 지급 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: py_bt_0003 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "py_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_py_bt_0003(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_py_bt_0003 CURSOR FOR + SELECT key, merch_id, amount + FROM py_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_py_bt_0003; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_py_bt_0003"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[py_bt_0003] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_py_bt_0003 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_py_bt_0003"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, PY_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, PY_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = py_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[py_bt_0003] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_py_bt_0003; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[py_bt_0003] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 지급 배치 결과 [py_bt_0003] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[py_bt_0003] 배치 시작 date=%s", biz_date); + + rc = py_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[py_bt_0003] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_py_bt_0003(biz_date); + + py_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[py_bt_0003] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/py_bt_0004.c b/app/batch/py_bt_0004.c new file mode 100644 index 0000000..820d36c --- /dev/null +++ b/app/batch/py_bt_0004.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/py_bt_0004.pgc" +/* @tier hard @module py @transform payment-batch */ +/* + * py_bt_0004.pgc - 지급 배치 (커서 순회 + 상태전이) [tier=hard] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: py_bt_0004 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "py_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/py_bt_0004.pgc" + + +static int run_py_bt_0004(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/py_bt_0004.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/py_bt_0004.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/py_bt_0004.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/py_bt_0004.pgc" + long h_amount ; + +#line 28 "app/batch/py_bt_0004.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/py_bt_0004.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_py_bt_0004 cursor for select key , merch_id , amount from py_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/py_bt_0004.pgc" + +#line 42 "app/batch/py_bt_0004.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_py_bt_0004 cursor for select key , merch_id , amount from py_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/py_bt_0004.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_py_bt_0004"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[py_bt_0004] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_py_bt_0004", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/py_bt_0004.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_py_bt_0004"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, PY_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, PY_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = py_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[py_bt_0004] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_py_bt_0004", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/py_bt_0004.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[py_bt_0004] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 지급 배치 결과 [py_bt_0004] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[py_bt_0004] 배치 시작 date=%s", biz_date); + + rc = py_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[py_bt_0004] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_py_bt_0004(biz_date); + + py_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[py_bt_0004] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/py_bt_0004.pgc b/app/batch/py_bt_0004.pgc new file mode 100644 index 0000000..f43c42c --- /dev/null +++ b/app/batch/py_bt_0004.pgc @@ -0,0 +1,138 @@ +/* @tier hard @module py @transform payment-batch */ +/* + * py_bt_0004.pgc - 지급 배치 (커서 순회 + 상태전이) [tier=hard] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: py_bt_0004 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "py_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_py_bt_0004(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_py_bt_0004 CURSOR FOR + SELECT key, merch_id, amount + FROM py_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_py_bt_0004; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_py_bt_0004"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[py_bt_0004] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_py_bt_0004 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_py_bt_0004"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, PY_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, PY_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = py_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[py_bt_0004] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_py_bt_0004; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[py_bt_0004] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 지급 배치 결과 [py_bt_0004] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[py_bt_0004] 배치 시작 date=%s", biz_date); + + rc = py_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[py_bt_0004] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_py_bt_0004(biz_date); + + py_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[py_bt_0004] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/py_bt_0005.c b/app/batch/py_bt_0005.c new file mode 100644 index 0000000..c6a38f9 --- /dev/null +++ b/app/batch/py_bt_0005.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/py_bt_0005.pgc" +/* @tier easy @module py @transform payment-batch */ +/* + * py_bt_0005.pgc - 지급 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: py_bt_0005 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "py_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/py_bt_0005.pgc" + + +static int run_py_bt_0005(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/py_bt_0005.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/py_bt_0005.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/py_bt_0005.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/py_bt_0005.pgc" + long h_amount ; + +#line 28 "app/batch/py_bt_0005.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/py_bt_0005.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_py_bt_0005 cursor for select key , merch_id , amount from py_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/py_bt_0005.pgc" + +#line 42 "app/batch/py_bt_0005.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_py_bt_0005 cursor for select key , merch_id , amount from py_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/py_bt_0005.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_py_bt_0005"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[py_bt_0005] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_py_bt_0005", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/py_bt_0005.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_py_bt_0005"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, PY_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, PY_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = py_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[py_bt_0005] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_py_bt_0005", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/py_bt_0005.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[py_bt_0005] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 지급 배치 결과 [py_bt_0005] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[py_bt_0005] 배치 시작 date=%s", biz_date); + + rc = py_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[py_bt_0005] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_py_bt_0005(biz_date); + + py_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[py_bt_0005] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/py_bt_0005.pgc b/app/batch/py_bt_0005.pgc new file mode 100644 index 0000000..16f3833 --- /dev/null +++ b/app/batch/py_bt_0005.pgc @@ -0,0 +1,138 @@ +/* @tier easy @module py @transform payment-batch */ +/* + * py_bt_0005.pgc - 지급 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: py_bt_0005 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "py_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_py_bt_0005(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_py_bt_0005 CURSOR FOR + SELECT key, merch_id, amount + FROM py_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_py_bt_0005; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_py_bt_0005"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[py_bt_0005] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_py_bt_0005 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_py_bt_0005"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, PY_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, PY_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = py_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[py_bt_0005] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_py_bt_0005; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[py_bt_0005] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 지급 배치 결과 [py_bt_0005] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[py_bt_0005] 배치 시작 date=%s", biz_date); + + rc = py_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[py_bt_0005] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_py_bt_0005(biz_date); + + py_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[py_bt_0005] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/py_bt_0006.c b/app/batch/py_bt_0006.c new file mode 100644 index 0000000..b14156f --- /dev/null +++ b/app/batch/py_bt_0006.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/py_bt_0006.pgc" +/* @tier easy @module py @transform payment-batch */ +/* + * py_bt_0006.pgc - 지급 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: py_bt_0006 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "py_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/py_bt_0006.pgc" + + +static int run_py_bt_0006(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/py_bt_0006.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/py_bt_0006.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/py_bt_0006.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/py_bt_0006.pgc" + long h_amount ; + +#line 28 "app/batch/py_bt_0006.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/py_bt_0006.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_py_bt_0006 cursor for select key , merch_id , amount from py_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/py_bt_0006.pgc" + +#line 42 "app/batch/py_bt_0006.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_py_bt_0006 cursor for select key , merch_id , amount from py_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/py_bt_0006.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_py_bt_0006"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[py_bt_0006] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_py_bt_0006", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/py_bt_0006.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_py_bt_0006"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, PY_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, PY_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = py_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[py_bt_0006] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_py_bt_0006", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/py_bt_0006.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[py_bt_0006] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 지급 배치 결과 [py_bt_0006] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[py_bt_0006] 배치 시작 date=%s", biz_date); + + rc = py_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[py_bt_0006] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_py_bt_0006(biz_date); + + py_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[py_bt_0006] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/py_bt_0006.pgc b/app/batch/py_bt_0006.pgc new file mode 100644 index 0000000..6a18784 --- /dev/null +++ b/app/batch/py_bt_0006.pgc @@ -0,0 +1,138 @@ +/* @tier easy @module py @transform payment-batch */ +/* + * py_bt_0006.pgc - 지급 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: py_bt_0006 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "py_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_py_bt_0006(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_py_bt_0006 CURSOR FOR + SELECT key, merch_id, amount + FROM py_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_py_bt_0006; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_py_bt_0006"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[py_bt_0006] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_py_bt_0006 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_py_bt_0006"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, PY_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, PY_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = py_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[py_bt_0006] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_py_bt_0006; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[py_bt_0006] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 지급 배치 결과 [py_bt_0006] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[py_bt_0006] 배치 시작 date=%s", biz_date); + + rc = py_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[py_bt_0006] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_py_bt_0006(biz_date); + + py_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[py_bt_0006] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/py_bt_0007.c b/app/batch/py_bt_0007.c new file mode 100644 index 0000000..db054ab --- /dev/null +++ b/app/batch/py_bt_0007.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/py_bt_0007.pgc" +/* @tier medium @module py @transform payment-batch */ +/* + * py_bt_0007.pgc - 지급 배치 (커서 순회 + 상태전이) [tier=medium] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: py_bt_0007 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "py_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/py_bt_0007.pgc" + + +static int run_py_bt_0007(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/py_bt_0007.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/py_bt_0007.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/py_bt_0007.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/py_bt_0007.pgc" + long h_amount ; + +#line 28 "app/batch/py_bt_0007.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/py_bt_0007.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_py_bt_0007 cursor for select key , merch_id , amount from py_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/py_bt_0007.pgc" + +#line 42 "app/batch/py_bt_0007.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_py_bt_0007 cursor for select key , merch_id , amount from py_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/py_bt_0007.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_py_bt_0007"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[py_bt_0007] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_py_bt_0007", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/py_bt_0007.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_py_bt_0007"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, PY_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, PY_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = py_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[py_bt_0007] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_py_bt_0007", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/py_bt_0007.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[py_bt_0007] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 지급 배치 결과 [py_bt_0007] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[py_bt_0007] 배치 시작 date=%s", biz_date); + + rc = py_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[py_bt_0007] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_py_bt_0007(biz_date); + + py_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[py_bt_0007] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/py_bt_0007.pgc b/app/batch/py_bt_0007.pgc new file mode 100644 index 0000000..81ec393 --- /dev/null +++ b/app/batch/py_bt_0007.pgc @@ -0,0 +1,138 @@ +/* @tier medium @module py @transform payment-batch */ +/* + * py_bt_0007.pgc - 지급 배치 (커서 순회 + 상태전이) [tier=medium] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: py_bt_0007 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "py_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_py_bt_0007(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_py_bt_0007 CURSOR FOR + SELECT key, merch_id, amount + FROM py_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_py_bt_0007; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_py_bt_0007"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[py_bt_0007] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_py_bt_0007 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_py_bt_0007"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, PY_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, PY_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = py_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[py_bt_0007] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_py_bt_0007; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[py_bt_0007] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 지급 배치 결과 [py_bt_0007] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[py_bt_0007] 배치 시작 date=%s", biz_date); + + rc = py_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[py_bt_0007] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_py_bt_0007(biz_date); + + py_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[py_bt_0007] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/py_bt_0008.c b/app/batch/py_bt_0008.c new file mode 100644 index 0000000..6d7e412 --- /dev/null +++ b/app/batch/py_bt_0008.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/py_bt_0008.pgc" +/* @tier easy @module py @transform payment-batch */ +/* + * py_bt_0008.pgc - 지급 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: py_bt_0008 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "py_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/py_bt_0008.pgc" + + +static int run_py_bt_0008(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/py_bt_0008.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/py_bt_0008.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/py_bt_0008.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/py_bt_0008.pgc" + long h_amount ; + +#line 28 "app/batch/py_bt_0008.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/py_bt_0008.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_py_bt_0008 cursor for select key , merch_id , amount from py_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/py_bt_0008.pgc" + +#line 42 "app/batch/py_bt_0008.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_py_bt_0008 cursor for select key , merch_id , amount from py_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/py_bt_0008.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_py_bt_0008"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[py_bt_0008] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_py_bt_0008", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/py_bt_0008.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_py_bt_0008"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, PY_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, PY_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = py_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[py_bt_0008] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_py_bt_0008", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/py_bt_0008.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[py_bt_0008] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 지급 배치 결과 [py_bt_0008] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[py_bt_0008] 배치 시작 date=%s", biz_date); + + rc = py_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[py_bt_0008] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_py_bt_0008(biz_date); + + py_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[py_bt_0008] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/py_bt_0008.pgc b/app/batch/py_bt_0008.pgc new file mode 100644 index 0000000..ea0c4a0 --- /dev/null +++ b/app/batch/py_bt_0008.pgc @@ -0,0 +1,138 @@ +/* @tier easy @module py @transform payment-batch */ +/* + * py_bt_0008.pgc - 지급 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: py_bt_0008 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "py_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_py_bt_0008(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_py_bt_0008 CURSOR FOR + SELECT key, merch_id, amount + FROM py_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_py_bt_0008; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_py_bt_0008"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[py_bt_0008] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_py_bt_0008 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_py_bt_0008"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, PY_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, PY_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = py_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[py_bt_0008] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_py_bt_0008; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[py_bt_0008] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 지급 배치 결과 [py_bt_0008] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[py_bt_0008] 배치 시작 date=%s", biz_date); + + rc = py_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[py_bt_0008] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_py_bt_0008(biz_date); + + py_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[py_bt_0008] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/py_bt_0009.c b/app/batch/py_bt_0009.c new file mode 100644 index 0000000..07827d1 --- /dev/null +++ b/app/batch/py_bt_0009.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/py_bt_0009.pgc" +/* @tier medium @module py @transform payment-batch */ +/* + * py_bt_0009.pgc - 지급 배치 (커서 순회 + 상태전이) [tier=medium] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: py_bt_0009 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "py_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/py_bt_0009.pgc" + + +static int run_py_bt_0009(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/py_bt_0009.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/py_bt_0009.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/py_bt_0009.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/py_bt_0009.pgc" + long h_amount ; + +#line 28 "app/batch/py_bt_0009.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/py_bt_0009.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_py_bt_0009 cursor for select key , merch_id , amount from py_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/py_bt_0009.pgc" + +#line 42 "app/batch/py_bt_0009.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_py_bt_0009 cursor for select key , merch_id , amount from py_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/py_bt_0009.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_py_bt_0009"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[py_bt_0009] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_py_bt_0009", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/py_bt_0009.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_py_bt_0009"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, PY_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, PY_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = py_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[py_bt_0009] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_py_bt_0009", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/py_bt_0009.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[py_bt_0009] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 지급 배치 결과 [py_bt_0009] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[py_bt_0009] 배치 시작 date=%s", biz_date); + + rc = py_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[py_bt_0009] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_py_bt_0009(biz_date); + + py_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[py_bt_0009] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/py_bt_0009.pgc b/app/batch/py_bt_0009.pgc new file mode 100644 index 0000000..2b6e21e --- /dev/null +++ b/app/batch/py_bt_0009.pgc @@ -0,0 +1,138 @@ +/* @tier medium @module py @transform payment-batch */ +/* + * py_bt_0009.pgc - 지급 배치 (커서 순회 + 상태전이) [tier=medium] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: py_bt_0009 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "py_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_py_bt_0009(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_py_bt_0009 CURSOR FOR + SELECT key, merch_id, amount + FROM py_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_py_bt_0009; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_py_bt_0009"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[py_bt_0009] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_py_bt_0009 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_py_bt_0009"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, PY_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, PY_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = py_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[py_bt_0009] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_py_bt_0009; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[py_bt_0009] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 지급 배치 결과 [py_bt_0009] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[py_bt_0009] 배치 시작 date=%s", biz_date); + + rc = py_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[py_bt_0009] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_py_bt_0009(biz_date); + + py_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[py_bt_0009] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/py_bt_0010.c b/app/batch/py_bt_0010.c new file mode 100644 index 0000000..cf355a0 --- /dev/null +++ b/app/batch/py_bt_0010.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/py_bt_0010.pgc" +/* @tier easy @module py @transform payment-batch */ +/* + * py_bt_0010.pgc - 지급 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: py_bt_0010 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "py_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/py_bt_0010.pgc" + + +static int run_py_bt_0010(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/py_bt_0010.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/py_bt_0010.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/py_bt_0010.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/py_bt_0010.pgc" + long h_amount ; + +#line 28 "app/batch/py_bt_0010.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/py_bt_0010.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_py_bt_0010 cursor for select key , merch_id , amount from py_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/py_bt_0010.pgc" + +#line 42 "app/batch/py_bt_0010.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_py_bt_0010 cursor for select key , merch_id , amount from py_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/py_bt_0010.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_py_bt_0010"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[py_bt_0010] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_py_bt_0010", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/py_bt_0010.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_py_bt_0010"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, PY_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, PY_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = py_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[py_bt_0010] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_py_bt_0010", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/py_bt_0010.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[py_bt_0010] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 지급 배치 결과 [py_bt_0010] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[py_bt_0010] 배치 시작 date=%s", biz_date); + + rc = py_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[py_bt_0010] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_py_bt_0010(biz_date); + + py_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[py_bt_0010] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/py_bt_0010.pgc b/app/batch/py_bt_0010.pgc new file mode 100644 index 0000000..ceb0f8f --- /dev/null +++ b/app/batch/py_bt_0010.pgc @@ -0,0 +1,138 @@ +/* @tier easy @module py @transform payment-batch */ +/* + * py_bt_0010.pgc - 지급 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: py_bt_0010 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "py_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_py_bt_0010(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_py_bt_0010 CURSOR FOR + SELECT key, merch_id, amount + FROM py_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_py_bt_0010; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_py_bt_0010"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[py_bt_0010] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_py_bt_0010 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_py_bt_0010"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, PY_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, PY_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = py_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[py_bt_0010] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_py_bt_0010; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[py_bt_0010] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 지급 배치 결과 [py_bt_0010] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[py_bt_0010] 배치 시작 date=%s", biz_date); + + rc = py_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[py_bt_0010] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_py_bt_0010(biz_date); + + py_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[py_bt_0010] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/py_bt_0011.c b/app/batch/py_bt_0011.c new file mode 100644 index 0000000..1de4538 --- /dev/null +++ b/app/batch/py_bt_0011.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/py_bt_0011.pgc" +/* @tier medium @module py @transform payment-batch */ +/* + * py_bt_0011.pgc - 지급 배치 (커서 순회 + 상태전이) [tier=medium] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: py_bt_0011 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "py_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/py_bt_0011.pgc" + + +static int run_py_bt_0011(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/py_bt_0011.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/py_bt_0011.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/py_bt_0011.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/py_bt_0011.pgc" + long h_amount ; + +#line 28 "app/batch/py_bt_0011.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/py_bt_0011.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_py_bt_0011 cursor for select key , merch_id , amount from py_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/py_bt_0011.pgc" + +#line 42 "app/batch/py_bt_0011.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_py_bt_0011 cursor for select key , merch_id , amount from py_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/py_bt_0011.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_py_bt_0011"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[py_bt_0011] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_py_bt_0011", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/py_bt_0011.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_py_bt_0011"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, PY_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, PY_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = py_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[py_bt_0011] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_py_bt_0011", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/py_bt_0011.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[py_bt_0011] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 지급 배치 결과 [py_bt_0011] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[py_bt_0011] 배치 시작 date=%s", biz_date); + + rc = py_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[py_bt_0011] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_py_bt_0011(biz_date); + + py_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[py_bt_0011] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/py_bt_0011.pgc b/app/batch/py_bt_0011.pgc new file mode 100644 index 0000000..e3a48a6 --- /dev/null +++ b/app/batch/py_bt_0011.pgc @@ -0,0 +1,138 @@ +/* @tier medium @module py @transform payment-batch */ +/* + * py_bt_0011.pgc - 지급 배치 (커서 순회 + 상태전이) [tier=medium] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: py_bt_0011 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "py_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_py_bt_0011(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_py_bt_0011 CURSOR FOR + SELECT key, merch_id, amount + FROM py_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_py_bt_0011; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_py_bt_0011"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[py_bt_0011] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_py_bt_0011 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_py_bt_0011"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, PY_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, PY_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = py_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[py_bt_0011] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_py_bt_0011; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[py_bt_0011] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 지급 배치 결과 [py_bt_0011] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[py_bt_0011] 배치 시작 date=%s", biz_date); + + rc = py_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[py_bt_0011] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_py_bt_0011(biz_date); + + py_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[py_bt_0011] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/py_bt_0012.c b/app/batch/py_bt_0012.c new file mode 100644 index 0000000..6a13089 --- /dev/null +++ b/app/batch/py_bt_0012.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/py_bt_0012.pgc" +/* @tier easy @module py @transform payment-batch */ +/* + * py_bt_0012.pgc - 지급 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: py_bt_0012 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "py_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/py_bt_0012.pgc" + + +static int run_py_bt_0012(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/py_bt_0012.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/py_bt_0012.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/py_bt_0012.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/py_bt_0012.pgc" + long h_amount ; + +#line 28 "app/batch/py_bt_0012.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/py_bt_0012.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_py_bt_0012 cursor for select key , merch_id , amount from py_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/py_bt_0012.pgc" + +#line 42 "app/batch/py_bt_0012.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_py_bt_0012 cursor for select key , merch_id , amount from py_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/py_bt_0012.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_py_bt_0012"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[py_bt_0012] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_py_bt_0012", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/py_bt_0012.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_py_bt_0012"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, PY_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, PY_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = py_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[py_bt_0012] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_py_bt_0012", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/py_bt_0012.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[py_bt_0012] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 지급 배치 결과 [py_bt_0012] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[py_bt_0012] 배치 시작 date=%s", biz_date); + + rc = py_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[py_bt_0012] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_py_bt_0012(biz_date); + + py_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[py_bt_0012] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/py_bt_0012.pgc b/app/batch/py_bt_0012.pgc new file mode 100644 index 0000000..136beb6 --- /dev/null +++ b/app/batch/py_bt_0012.pgc @@ -0,0 +1,138 @@ +/* @tier easy @module py @transform payment-batch */ +/* + * py_bt_0012.pgc - 지급 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: py_bt_0012 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "py_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_py_bt_0012(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_py_bt_0012 CURSOR FOR + SELECT key, merch_id, amount + FROM py_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_py_bt_0012; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_py_bt_0012"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[py_bt_0012] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_py_bt_0012 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_py_bt_0012"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, PY_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, PY_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = py_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[py_bt_0012] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_py_bt_0012; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[py_bt_0012] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 지급 배치 결과 [py_bt_0012] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[py_bt_0012] 배치 시작 date=%s", biz_date); + + rc = py_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[py_bt_0012] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_py_bt_0012(biz_date); + + py_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[py_bt_0012] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/py_bt_0013.c b/app/batch/py_bt_0013.c new file mode 100644 index 0000000..81d2c22 --- /dev/null +++ b/app/batch/py_bt_0013.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/py_bt_0013.pgc" +/* @tier hard @module py @transform payment-batch */ +/* + * py_bt_0013.pgc - 지급 배치 (커서 순회 + 상태전이) [tier=hard] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: py_bt_0013 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "py_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/py_bt_0013.pgc" + + +static int run_py_bt_0013(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/py_bt_0013.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/py_bt_0013.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/py_bt_0013.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/py_bt_0013.pgc" + long h_amount ; + +#line 28 "app/batch/py_bt_0013.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/py_bt_0013.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_py_bt_0013 cursor for select key , merch_id , amount from py_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/py_bt_0013.pgc" + +#line 42 "app/batch/py_bt_0013.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_py_bt_0013 cursor for select key , merch_id , amount from py_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/py_bt_0013.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_py_bt_0013"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[py_bt_0013] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_py_bt_0013", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/py_bt_0013.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_py_bt_0013"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, PY_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, PY_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = py_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[py_bt_0013] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_py_bt_0013", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/py_bt_0013.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[py_bt_0013] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 지급 배치 결과 [py_bt_0013] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[py_bt_0013] 배치 시작 date=%s", biz_date); + + rc = py_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[py_bt_0013] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_py_bt_0013(biz_date); + + py_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[py_bt_0013] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/py_bt_0013.pgc b/app/batch/py_bt_0013.pgc new file mode 100644 index 0000000..cdd71c6 --- /dev/null +++ b/app/batch/py_bt_0013.pgc @@ -0,0 +1,138 @@ +/* @tier hard @module py @transform payment-batch */ +/* + * py_bt_0013.pgc - 지급 배치 (커서 순회 + 상태전이) [tier=hard] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: py_bt_0013 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "py_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_py_bt_0013(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_py_bt_0013 CURSOR FOR + SELECT key, merch_id, amount + FROM py_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_py_bt_0013; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_py_bt_0013"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[py_bt_0013] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_py_bt_0013 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_py_bt_0013"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, PY_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, PY_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = py_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[py_bt_0013] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_py_bt_0013; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[py_bt_0013] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 지급 배치 결과 [py_bt_0013] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[py_bt_0013] 배치 시작 date=%s", biz_date); + + rc = py_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[py_bt_0013] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_py_bt_0013(biz_date); + + py_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[py_bt_0013] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/py_bt_0014.c b/app/batch/py_bt_0014.c new file mode 100644 index 0000000..b154a3d --- /dev/null +++ b/app/batch/py_bt_0014.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/py_bt_0014.pgc" +/* @tier easy @module py @transform payment-batch */ +/* + * py_bt_0014.pgc - 지급 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: py_bt_0014 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "py_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/py_bt_0014.pgc" + + +static int run_py_bt_0014(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/py_bt_0014.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/py_bt_0014.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/py_bt_0014.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/py_bt_0014.pgc" + long h_amount ; + +#line 28 "app/batch/py_bt_0014.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/py_bt_0014.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_py_bt_0014 cursor for select key , merch_id , amount from py_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/py_bt_0014.pgc" + +#line 42 "app/batch/py_bt_0014.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_py_bt_0014 cursor for select key , merch_id , amount from py_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/py_bt_0014.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_py_bt_0014"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[py_bt_0014] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_py_bt_0014", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/py_bt_0014.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_py_bt_0014"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, PY_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, PY_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = py_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[py_bt_0014] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_py_bt_0014", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/py_bt_0014.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[py_bt_0014] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 지급 배치 결과 [py_bt_0014] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[py_bt_0014] 배치 시작 date=%s", biz_date); + + rc = py_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[py_bt_0014] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_py_bt_0014(biz_date); + + py_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[py_bt_0014] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/py_bt_0014.pgc b/app/batch/py_bt_0014.pgc new file mode 100644 index 0000000..5172d3a --- /dev/null +++ b/app/batch/py_bt_0014.pgc @@ -0,0 +1,138 @@ +/* @tier easy @module py @transform payment-batch */ +/* + * py_bt_0014.pgc - 지급 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: py_bt_0014 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "py_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_py_bt_0014(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_py_bt_0014 CURSOR FOR + SELECT key, merch_id, amount + FROM py_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_py_bt_0014; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_py_bt_0014"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[py_bt_0014] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_py_bt_0014 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_py_bt_0014"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, PY_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, PY_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = py_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[py_bt_0014] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_py_bt_0014; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[py_bt_0014] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 지급 배치 결과 [py_bt_0014] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[py_bt_0014] 배치 시작 date=%s", biz_date); + + rc = py_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[py_bt_0014] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_py_bt_0014(biz_date); + + py_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[py_bt_0014] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/py_bt_0015.c b/app/batch/py_bt_0015.c new file mode 100644 index 0000000..5ea307f --- /dev/null +++ b/app/batch/py_bt_0015.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/py_bt_0015.pgc" +/* @tier easy @module py @transform payment-batch */ +/* + * py_bt_0015.pgc - 지급 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: py_bt_0015 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "py_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/py_bt_0015.pgc" + + +static int run_py_bt_0015(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/py_bt_0015.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/py_bt_0015.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/py_bt_0015.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/py_bt_0015.pgc" + long h_amount ; + +#line 28 "app/batch/py_bt_0015.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/py_bt_0015.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_py_bt_0015 cursor for select key , merch_id , amount from py_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/py_bt_0015.pgc" + +#line 42 "app/batch/py_bt_0015.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_py_bt_0015 cursor for select key , merch_id , amount from py_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/py_bt_0015.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_py_bt_0015"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[py_bt_0015] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_py_bt_0015", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/py_bt_0015.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_py_bt_0015"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, PY_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, PY_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = py_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[py_bt_0015] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_py_bt_0015", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/py_bt_0015.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[py_bt_0015] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 지급 배치 결과 [py_bt_0015] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[py_bt_0015] 배치 시작 date=%s", biz_date); + + rc = py_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[py_bt_0015] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_py_bt_0015(biz_date); + + py_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[py_bt_0015] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/py_bt_0015.pgc b/app/batch/py_bt_0015.pgc new file mode 100644 index 0000000..8dc4c9d --- /dev/null +++ b/app/batch/py_bt_0015.pgc @@ -0,0 +1,138 @@ +/* @tier easy @module py @transform payment-batch */ +/* + * py_bt_0015.pgc - 지급 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: py_bt_0015 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "py_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_py_bt_0015(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_py_bt_0015 CURSOR FOR + SELECT key, merch_id, amount + FROM py_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_py_bt_0015; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_py_bt_0015"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[py_bt_0015] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_py_bt_0015 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_py_bt_0015"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, PY_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, PY_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = py_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[py_bt_0015] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_py_bt_0015; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[py_bt_0015] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 지급 배치 결과 [py_bt_0015] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[py_bt_0015] 배치 시작 date=%s", biz_date); + + rc = py_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[py_bt_0015] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_py_bt_0015(biz_date); + + py_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[py_bt_0015] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/py_bt_0016.c b/app/batch/py_bt_0016.c new file mode 100644 index 0000000..463b446 --- /dev/null +++ b/app/batch/py_bt_0016.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/py_bt_0016.pgc" +/* @tier medium @module py @transform payment-batch */ +/* + * py_bt_0016.pgc - 지급 배치 (커서 순회 + 상태전이) [tier=medium] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: py_bt_0016 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "py_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/py_bt_0016.pgc" + + +static int run_py_bt_0016(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/py_bt_0016.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/py_bt_0016.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/py_bt_0016.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/py_bt_0016.pgc" + long h_amount ; + +#line 28 "app/batch/py_bt_0016.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/py_bt_0016.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_py_bt_0016 cursor for select key , merch_id , amount from py_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/py_bt_0016.pgc" + +#line 42 "app/batch/py_bt_0016.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_py_bt_0016 cursor for select key , merch_id , amount from py_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/py_bt_0016.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_py_bt_0016"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[py_bt_0016] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_py_bt_0016", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/py_bt_0016.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_py_bt_0016"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, PY_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, PY_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = py_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[py_bt_0016] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_py_bt_0016", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/py_bt_0016.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[py_bt_0016] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 지급 배치 결과 [py_bt_0016] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[py_bt_0016] 배치 시작 date=%s", biz_date); + + rc = py_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[py_bt_0016] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_py_bt_0016(biz_date); + + py_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[py_bt_0016] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/py_bt_0016.pgc b/app/batch/py_bt_0016.pgc new file mode 100644 index 0000000..e1d1973 --- /dev/null +++ b/app/batch/py_bt_0016.pgc @@ -0,0 +1,138 @@ +/* @tier medium @module py @transform payment-batch */ +/* + * py_bt_0016.pgc - 지급 배치 (커서 순회 + 상태전이) [tier=medium] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: py_bt_0016 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "py_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_py_bt_0016(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_py_bt_0016 CURSOR FOR + SELECT key, merch_id, amount + FROM py_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_py_bt_0016; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_py_bt_0016"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[py_bt_0016] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_py_bt_0016 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_py_bt_0016"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, PY_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, PY_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = py_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[py_bt_0016] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_py_bt_0016; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[py_bt_0016] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 지급 배치 결과 [py_bt_0016] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[py_bt_0016] 배치 시작 date=%s", biz_date); + + rc = py_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[py_bt_0016] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_py_bt_0016(biz_date); + + py_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[py_bt_0016] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/rc_bt_0001.c b/app/batch/rc_bt_0001.c new file mode 100644 index 0000000..bf9289d --- /dev/null +++ b/app/batch/rc_bt_0001.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/rc_bt_0001.pgc" +/* @tier easy @module rc @transform reconciliation-batch */ +/* + * rc_bt_0001.pgc - 대사 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: rc_bt_0001 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "rc_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/rc_bt_0001.pgc" + + +static int run_rc_bt_0001(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/rc_bt_0001.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/rc_bt_0001.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/rc_bt_0001.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/rc_bt_0001.pgc" + long h_amount ; + +#line 28 "app/batch/rc_bt_0001.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/rc_bt_0001.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_rc_bt_0001 cursor for select key , merch_id , amount from rc_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/rc_bt_0001.pgc" + +#line 42 "app/batch/rc_bt_0001.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_rc_bt_0001 cursor for select key , merch_id , amount from rc_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/rc_bt_0001.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_rc_bt_0001"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[rc_bt_0001] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_rc_bt_0001", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/rc_bt_0001.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_rc_bt_0001"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, RC_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, RC_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = rc_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[rc_bt_0001] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_rc_bt_0001", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/rc_bt_0001.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[rc_bt_0001] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 대사 배치 결과 [rc_bt_0001] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[rc_bt_0001] 배치 시작 date=%s", biz_date); + + rc = rc_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[rc_bt_0001] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_rc_bt_0001(biz_date); + + rc_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[rc_bt_0001] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/rc_bt_0001.pgc b/app/batch/rc_bt_0001.pgc new file mode 100644 index 0000000..109b118 --- /dev/null +++ b/app/batch/rc_bt_0001.pgc @@ -0,0 +1,138 @@ +/* @tier easy @module rc @transform reconciliation-batch */ +/* + * rc_bt_0001.pgc - 대사 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: rc_bt_0001 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "rc_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_rc_bt_0001(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_rc_bt_0001 CURSOR FOR + SELECT key, merch_id, amount + FROM rc_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_rc_bt_0001; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_rc_bt_0001"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[rc_bt_0001] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_rc_bt_0001 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_rc_bt_0001"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, RC_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, RC_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = rc_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[rc_bt_0001] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_rc_bt_0001; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[rc_bt_0001] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 대사 배치 결과 [rc_bt_0001] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[rc_bt_0001] 배치 시작 date=%s", biz_date); + + rc = rc_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[rc_bt_0001] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_rc_bt_0001(biz_date); + + rc_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[rc_bt_0001] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/rc_bt_0002.c b/app/batch/rc_bt_0002.c new file mode 100644 index 0000000..1096805 --- /dev/null +++ b/app/batch/rc_bt_0002.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/rc_bt_0002.pgc" +/* @tier medium @module rc @transform reconciliation-batch */ +/* + * rc_bt_0002.pgc - 대사 배치 (커서 순회 + 상태전이) [tier=medium] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: rc_bt_0002 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "rc_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/rc_bt_0002.pgc" + + +static int run_rc_bt_0002(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/rc_bt_0002.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/rc_bt_0002.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/rc_bt_0002.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/rc_bt_0002.pgc" + long h_amount ; + +#line 28 "app/batch/rc_bt_0002.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/rc_bt_0002.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_rc_bt_0002 cursor for select key , merch_id , amount from rc_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/rc_bt_0002.pgc" + +#line 42 "app/batch/rc_bt_0002.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_rc_bt_0002 cursor for select key , merch_id , amount from rc_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/rc_bt_0002.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_rc_bt_0002"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[rc_bt_0002] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_rc_bt_0002", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/rc_bt_0002.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_rc_bt_0002"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, RC_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, RC_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = rc_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[rc_bt_0002] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_rc_bt_0002", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/rc_bt_0002.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[rc_bt_0002] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 대사 배치 결과 [rc_bt_0002] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[rc_bt_0002] 배치 시작 date=%s", biz_date); + + rc = rc_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[rc_bt_0002] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_rc_bt_0002(biz_date); + + rc_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[rc_bt_0002] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/rc_bt_0002.pgc b/app/batch/rc_bt_0002.pgc new file mode 100644 index 0000000..3a430c8 --- /dev/null +++ b/app/batch/rc_bt_0002.pgc @@ -0,0 +1,138 @@ +/* @tier medium @module rc @transform reconciliation-batch */ +/* + * rc_bt_0002.pgc - 대사 배치 (커서 순회 + 상태전이) [tier=medium] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: rc_bt_0002 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "rc_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_rc_bt_0002(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_rc_bt_0002 CURSOR FOR + SELECT key, merch_id, amount + FROM rc_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_rc_bt_0002; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_rc_bt_0002"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[rc_bt_0002] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_rc_bt_0002 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_rc_bt_0002"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, RC_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, RC_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = rc_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[rc_bt_0002] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_rc_bt_0002; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[rc_bt_0002] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 대사 배치 결과 [rc_bt_0002] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[rc_bt_0002] 배치 시작 date=%s", biz_date); + + rc = rc_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[rc_bt_0002] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_rc_bt_0002(biz_date); + + rc_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[rc_bt_0002] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/rc_bt_0003.c b/app/batch/rc_bt_0003.c new file mode 100644 index 0000000..09ad3b3 --- /dev/null +++ b/app/batch/rc_bt_0003.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/rc_bt_0003.pgc" +/* @tier easy @module rc @transform reconciliation-batch */ +/* + * rc_bt_0003.pgc - 대사 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: rc_bt_0003 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "rc_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/rc_bt_0003.pgc" + + +static int run_rc_bt_0003(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/rc_bt_0003.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/rc_bt_0003.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/rc_bt_0003.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/rc_bt_0003.pgc" + long h_amount ; + +#line 28 "app/batch/rc_bt_0003.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/rc_bt_0003.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_rc_bt_0003 cursor for select key , merch_id , amount from rc_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/rc_bt_0003.pgc" + +#line 42 "app/batch/rc_bt_0003.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_rc_bt_0003 cursor for select key , merch_id , amount from rc_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/rc_bt_0003.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_rc_bt_0003"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[rc_bt_0003] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_rc_bt_0003", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/rc_bt_0003.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_rc_bt_0003"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, RC_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, RC_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = rc_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[rc_bt_0003] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_rc_bt_0003", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/rc_bt_0003.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[rc_bt_0003] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 대사 배치 결과 [rc_bt_0003] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[rc_bt_0003] 배치 시작 date=%s", biz_date); + + rc = rc_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[rc_bt_0003] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_rc_bt_0003(biz_date); + + rc_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[rc_bt_0003] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/rc_bt_0003.pgc b/app/batch/rc_bt_0003.pgc new file mode 100644 index 0000000..6bc42f4 --- /dev/null +++ b/app/batch/rc_bt_0003.pgc @@ -0,0 +1,138 @@ +/* @tier easy @module rc @transform reconciliation-batch */ +/* + * rc_bt_0003.pgc - 대사 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: rc_bt_0003 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "rc_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_rc_bt_0003(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_rc_bt_0003 CURSOR FOR + SELECT key, merch_id, amount + FROM rc_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_rc_bt_0003; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_rc_bt_0003"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[rc_bt_0003] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_rc_bt_0003 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_rc_bt_0003"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, RC_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, RC_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = rc_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[rc_bt_0003] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_rc_bt_0003; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[rc_bt_0003] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 대사 배치 결과 [rc_bt_0003] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[rc_bt_0003] 배치 시작 date=%s", biz_date); + + rc = rc_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[rc_bt_0003] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_rc_bt_0003(biz_date); + + rc_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[rc_bt_0003] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/rc_bt_0004.c b/app/batch/rc_bt_0004.c new file mode 100644 index 0000000..149a20a --- /dev/null +++ b/app/batch/rc_bt_0004.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/rc_bt_0004.pgc" +/* @tier medium @module rc @transform reconciliation-batch */ +/* + * rc_bt_0004.pgc - 대사 배치 (커서 순회 + 상태전이) [tier=medium] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: rc_bt_0004 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "rc_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/rc_bt_0004.pgc" + + +static int run_rc_bt_0004(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/rc_bt_0004.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/rc_bt_0004.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/rc_bt_0004.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/rc_bt_0004.pgc" + long h_amount ; + +#line 28 "app/batch/rc_bt_0004.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/rc_bt_0004.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_rc_bt_0004 cursor for select key , merch_id , amount from rc_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/rc_bt_0004.pgc" + +#line 42 "app/batch/rc_bt_0004.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_rc_bt_0004 cursor for select key , merch_id , amount from rc_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/rc_bt_0004.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_rc_bt_0004"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[rc_bt_0004] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_rc_bt_0004", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/rc_bt_0004.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_rc_bt_0004"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, RC_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, RC_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = rc_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[rc_bt_0004] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_rc_bt_0004", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/rc_bt_0004.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[rc_bt_0004] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 대사 배치 결과 [rc_bt_0004] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[rc_bt_0004] 배치 시작 date=%s", biz_date); + + rc = rc_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[rc_bt_0004] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_rc_bt_0004(biz_date); + + rc_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[rc_bt_0004] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/rc_bt_0004.pgc b/app/batch/rc_bt_0004.pgc new file mode 100644 index 0000000..f6b2a11 --- /dev/null +++ b/app/batch/rc_bt_0004.pgc @@ -0,0 +1,138 @@ +/* @tier medium @module rc @transform reconciliation-batch */ +/* + * rc_bt_0004.pgc - 대사 배치 (커서 순회 + 상태전이) [tier=medium] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: rc_bt_0004 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "rc_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_rc_bt_0004(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_rc_bt_0004 CURSOR FOR + SELECT key, merch_id, amount + FROM rc_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_rc_bt_0004; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_rc_bt_0004"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[rc_bt_0004] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_rc_bt_0004 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_rc_bt_0004"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, RC_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, RC_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = rc_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[rc_bt_0004] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_rc_bt_0004; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[rc_bt_0004] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 대사 배치 결과 [rc_bt_0004] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[rc_bt_0004] 배치 시작 date=%s", biz_date); + + rc = rc_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[rc_bt_0004] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_rc_bt_0004(biz_date); + + rc_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[rc_bt_0004] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/rc_bt_0005.c b/app/batch/rc_bt_0005.c new file mode 100644 index 0000000..1799294 --- /dev/null +++ b/app/batch/rc_bt_0005.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/rc_bt_0005.pgc" +/* @tier easy @module rc @transform reconciliation-batch */ +/* + * rc_bt_0005.pgc - 대사 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: rc_bt_0005 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "rc_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/rc_bt_0005.pgc" + + +static int run_rc_bt_0005(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/rc_bt_0005.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/rc_bt_0005.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/rc_bt_0005.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/rc_bt_0005.pgc" + long h_amount ; + +#line 28 "app/batch/rc_bt_0005.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/rc_bt_0005.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_rc_bt_0005 cursor for select key , merch_id , amount from rc_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/rc_bt_0005.pgc" + +#line 42 "app/batch/rc_bt_0005.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_rc_bt_0005 cursor for select key , merch_id , amount from rc_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/rc_bt_0005.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_rc_bt_0005"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[rc_bt_0005] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_rc_bt_0005", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/rc_bt_0005.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_rc_bt_0005"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, RC_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, RC_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = rc_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[rc_bt_0005] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_rc_bt_0005", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/rc_bt_0005.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[rc_bt_0005] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 대사 배치 결과 [rc_bt_0005] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[rc_bt_0005] 배치 시작 date=%s", biz_date); + + rc = rc_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[rc_bt_0005] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_rc_bt_0005(biz_date); + + rc_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[rc_bt_0005] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/rc_bt_0005.pgc b/app/batch/rc_bt_0005.pgc new file mode 100644 index 0000000..43ae332 --- /dev/null +++ b/app/batch/rc_bt_0005.pgc @@ -0,0 +1,138 @@ +/* @tier easy @module rc @transform reconciliation-batch */ +/* + * rc_bt_0005.pgc - 대사 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: rc_bt_0005 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "rc_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_rc_bt_0005(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_rc_bt_0005 CURSOR FOR + SELECT key, merch_id, amount + FROM rc_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_rc_bt_0005; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_rc_bt_0005"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[rc_bt_0005] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_rc_bt_0005 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_rc_bt_0005"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, RC_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, RC_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = rc_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[rc_bt_0005] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_rc_bt_0005; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[rc_bt_0005] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 대사 배치 결과 [rc_bt_0005] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[rc_bt_0005] 배치 시작 date=%s", biz_date); + + rc = rc_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[rc_bt_0005] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_rc_bt_0005(biz_date); + + rc_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[rc_bt_0005] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/rc_bt_0006.c b/app/batch/rc_bt_0006.c new file mode 100644 index 0000000..4f4d33f --- /dev/null +++ b/app/batch/rc_bt_0006.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/rc_bt_0006.pgc" +/* @tier hard @module rc @transform reconciliation-batch */ +/* + * rc_bt_0006.pgc - 대사 배치 (커서 순회 + 상태전이) [tier=hard] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: rc_bt_0006 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "rc_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/rc_bt_0006.pgc" + + +static int run_rc_bt_0006(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/rc_bt_0006.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/rc_bt_0006.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/rc_bt_0006.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/rc_bt_0006.pgc" + long h_amount ; + +#line 28 "app/batch/rc_bt_0006.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/rc_bt_0006.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_rc_bt_0006 cursor for select key , merch_id , amount from rc_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/rc_bt_0006.pgc" + +#line 42 "app/batch/rc_bt_0006.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_rc_bt_0006 cursor for select key , merch_id , amount from rc_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/rc_bt_0006.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_rc_bt_0006"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[rc_bt_0006] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_rc_bt_0006", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/rc_bt_0006.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_rc_bt_0006"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, RC_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, RC_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = rc_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[rc_bt_0006] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_rc_bt_0006", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/rc_bt_0006.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[rc_bt_0006] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 대사 배치 결과 [rc_bt_0006] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[rc_bt_0006] 배치 시작 date=%s", biz_date); + + rc = rc_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[rc_bt_0006] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_rc_bt_0006(biz_date); + + rc_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[rc_bt_0006] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/rc_bt_0006.pgc b/app/batch/rc_bt_0006.pgc new file mode 100644 index 0000000..b6cce54 --- /dev/null +++ b/app/batch/rc_bt_0006.pgc @@ -0,0 +1,138 @@ +/* @tier hard @module rc @transform reconciliation-batch */ +/* + * rc_bt_0006.pgc - 대사 배치 (커서 순회 + 상태전이) [tier=hard] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: rc_bt_0006 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "rc_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_rc_bt_0006(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_rc_bt_0006 CURSOR FOR + SELECT key, merch_id, amount + FROM rc_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_rc_bt_0006; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_rc_bt_0006"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[rc_bt_0006] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_rc_bt_0006 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_rc_bt_0006"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, RC_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, RC_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = rc_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[rc_bt_0006] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_rc_bt_0006; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[rc_bt_0006] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 대사 배치 결과 [rc_bt_0006] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[rc_bt_0006] 배치 시작 date=%s", biz_date); + + rc = rc_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[rc_bt_0006] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_rc_bt_0006(biz_date); + + rc_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[rc_bt_0006] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/rc_bt_0007.c b/app/batch/rc_bt_0007.c new file mode 100644 index 0000000..4d675f3 --- /dev/null +++ b/app/batch/rc_bt_0007.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/rc_bt_0007.pgc" +/* @tier easy @module rc @transform reconciliation-batch */ +/* + * rc_bt_0007.pgc - 대사 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: rc_bt_0007 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "rc_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/rc_bt_0007.pgc" + + +static int run_rc_bt_0007(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/rc_bt_0007.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/rc_bt_0007.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/rc_bt_0007.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/rc_bt_0007.pgc" + long h_amount ; + +#line 28 "app/batch/rc_bt_0007.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/rc_bt_0007.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_rc_bt_0007 cursor for select key , merch_id , amount from rc_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/rc_bt_0007.pgc" + +#line 42 "app/batch/rc_bt_0007.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_rc_bt_0007 cursor for select key , merch_id , amount from rc_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/rc_bt_0007.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_rc_bt_0007"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[rc_bt_0007] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_rc_bt_0007", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/rc_bt_0007.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_rc_bt_0007"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, RC_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, RC_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = rc_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[rc_bt_0007] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_rc_bt_0007", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/rc_bt_0007.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[rc_bt_0007] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 대사 배치 결과 [rc_bt_0007] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[rc_bt_0007] 배치 시작 date=%s", biz_date); + + rc = rc_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[rc_bt_0007] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_rc_bt_0007(biz_date); + + rc_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[rc_bt_0007] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/rc_bt_0007.pgc b/app/batch/rc_bt_0007.pgc new file mode 100644 index 0000000..9aec9b7 --- /dev/null +++ b/app/batch/rc_bt_0007.pgc @@ -0,0 +1,138 @@ +/* @tier easy @module rc @transform reconciliation-batch */ +/* + * rc_bt_0007.pgc - 대사 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: rc_bt_0007 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "rc_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_rc_bt_0007(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_rc_bt_0007 CURSOR FOR + SELECT key, merch_id, amount + FROM rc_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_rc_bt_0007; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_rc_bt_0007"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[rc_bt_0007] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_rc_bt_0007 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_rc_bt_0007"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, RC_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, RC_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = rc_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[rc_bt_0007] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_rc_bt_0007; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[rc_bt_0007] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 대사 배치 결과 [rc_bt_0007] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[rc_bt_0007] 배치 시작 date=%s", biz_date); + + rc = rc_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[rc_bt_0007] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_rc_bt_0007(biz_date); + + rc_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[rc_bt_0007] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/rc_bt_0008.c b/app/batch/rc_bt_0008.c new file mode 100644 index 0000000..2f8dff6 --- /dev/null +++ b/app/batch/rc_bt_0008.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/rc_bt_0008.pgc" +/* @tier easy @module rc @transform reconciliation-batch */ +/* + * rc_bt_0008.pgc - 대사 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: rc_bt_0008 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "rc_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/rc_bt_0008.pgc" + + +static int run_rc_bt_0008(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/rc_bt_0008.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/rc_bt_0008.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/rc_bt_0008.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/rc_bt_0008.pgc" + long h_amount ; + +#line 28 "app/batch/rc_bt_0008.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/rc_bt_0008.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_rc_bt_0008 cursor for select key , merch_id , amount from rc_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/rc_bt_0008.pgc" + +#line 42 "app/batch/rc_bt_0008.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_rc_bt_0008 cursor for select key , merch_id , amount from rc_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/rc_bt_0008.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_rc_bt_0008"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[rc_bt_0008] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_rc_bt_0008", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/rc_bt_0008.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_rc_bt_0008"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, RC_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, RC_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = rc_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[rc_bt_0008] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_rc_bt_0008", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/rc_bt_0008.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[rc_bt_0008] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 대사 배치 결과 [rc_bt_0008] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[rc_bt_0008] 배치 시작 date=%s", biz_date); + + rc = rc_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[rc_bt_0008] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_rc_bt_0008(biz_date); + + rc_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[rc_bt_0008] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/rc_bt_0008.pgc b/app/batch/rc_bt_0008.pgc new file mode 100644 index 0000000..5d60702 --- /dev/null +++ b/app/batch/rc_bt_0008.pgc @@ -0,0 +1,138 @@ +/* @tier easy @module rc @transform reconciliation-batch */ +/* + * rc_bt_0008.pgc - 대사 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: rc_bt_0008 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "rc_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_rc_bt_0008(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_rc_bt_0008 CURSOR FOR + SELECT key, merch_id, amount + FROM rc_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_rc_bt_0008; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_rc_bt_0008"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[rc_bt_0008] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_rc_bt_0008 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_rc_bt_0008"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, RC_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, RC_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = rc_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[rc_bt_0008] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_rc_bt_0008; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[rc_bt_0008] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 대사 배치 결과 [rc_bt_0008] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[rc_bt_0008] 배치 시작 date=%s", biz_date); + + rc = rc_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[rc_bt_0008] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_rc_bt_0008(biz_date); + + rc_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[rc_bt_0008] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/rc_bt_0009.c b/app/batch/rc_bt_0009.c new file mode 100644 index 0000000..002febb --- /dev/null +++ b/app/batch/rc_bt_0009.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/rc_bt_0009.pgc" +/* @tier medium @module rc @transform reconciliation-batch */ +/* + * rc_bt_0009.pgc - 대사 배치 (커서 순회 + 상태전이) [tier=medium] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: rc_bt_0009 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "rc_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/rc_bt_0009.pgc" + + +static int run_rc_bt_0009(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/rc_bt_0009.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/rc_bt_0009.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/rc_bt_0009.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/rc_bt_0009.pgc" + long h_amount ; + +#line 28 "app/batch/rc_bt_0009.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/rc_bt_0009.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_rc_bt_0009 cursor for select key , merch_id , amount from rc_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/rc_bt_0009.pgc" + +#line 42 "app/batch/rc_bt_0009.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_rc_bt_0009 cursor for select key , merch_id , amount from rc_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/rc_bt_0009.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_rc_bt_0009"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[rc_bt_0009] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_rc_bt_0009", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/rc_bt_0009.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_rc_bt_0009"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, RC_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, RC_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = rc_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[rc_bt_0009] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_rc_bt_0009", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/rc_bt_0009.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[rc_bt_0009] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 대사 배치 결과 [rc_bt_0009] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[rc_bt_0009] 배치 시작 date=%s", biz_date); + + rc = rc_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[rc_bt_0009] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_rc_bt_0009(biz_date); + + rc_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[rc_bt_0009] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/rc_bt_0009.pgc b/app/batch/rc_bt_0009.pgc new file mode 100644 index 0000000..d8af220 --- /dev/null +++ b/app/batch/rc_bt_0009.pgc @@ -0,0 +1,138 @@ +/* @tier medium @module rc @transform reconciliation-batch */ +/* + * rc_bt_0009.pgc - 대사 배치 (커서 순회 + 상태전이) [tier=medium] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: rc_bt_0009 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "rc_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_rc_bt_0009(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_rc_bt_0009 CURSOR FOR + SELECT key, merch_id, amount + FROM rc_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_rc_bt_0009; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_rc_bt_0009"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[rc_bt_0009] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_rc_bt_0009 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_rc_bt_0009"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, RC_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, RC_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = rc_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[rc_bt_0009] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_rc_bt_0009; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[rc_bt_0009] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 대사 배치 결과 [rc_bt_0009] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[rc_bt_0009] 배치 시작 date=%s", biz_date); + + rc = rc_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[rc_bt_0009] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_rc_bt_0009(biz_date); + + rc_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[rc_bt_0009] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/rc_bt_0010.c b/app/batch/rc_bt_0010.c new file mode 100644 index 0000000..b204b14 --- /dev/null +++ b/app/batch/rc_bt_0010.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/rc_bt_0010.pgc" +/* @tier easy @module rc @transform reconciliation-batch */ +/* + * rc_bt_0010.pgc - 대사 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: rc_bt_0010 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "rc_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/rc_bt_0010.pgc" + + +static int run_rc_bt_0010(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/rc_bt_0010.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/rc_bt_0010.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/rc_bt_0010.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/rc_bt_0010.pgc" + long h_amount ; + +#line 28 "app/batch/rc_bt_0010.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/rc_bt_0010.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_rc_bt_0010 cursor for select key , merch_id , amount from rc_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/rc_bt_0010.pgc" + +#line 42 "app/batch/rc_bt_0010.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_rc_bt_0010 cursor for select key , merch_id , amount from rc_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/rc_bt_0010.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_rc_bt_0010"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[rc_bt_0010] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_rc_bt_0010", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/rc_bt_0010.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_rc_bt_0010"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, RC_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, RC_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = rc_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[rc_bt_0010] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_rc_bt_0010", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/rc_bt_0010.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[rc_bt_0010] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 대사 배치 결과 [rc_bt_0010] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[rc_bt_0010] 배치 시작 date=%s", biz_date); + + rc = rc_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[rc_bt_0010] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_rc_bt_0010(biz_date); + + rc_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[rc_bt_0010] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/rc_bt_0010.pgc b/app/batch/rc_bt_0010.pgc new file mode 100644 index 0000000..1116596 --- /dev/null +++ b/app/batch/rc_bt_0010.pgc @@ -0,0 +1,138 @@ +/* @tier easy @module rc @transform reconciliation-batch */ +/* + * rc_bt_0010.pgc - 대사 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: rc_bt_0010 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "rc_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_rc_bt_0010(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_rc_bt_0010 CURSOR FOR + SELECT key, merch_id, amount + FROM rc_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_rc_bt_0010; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_rc_bt_0010"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[rc_bt_0010] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_rc_bt_0010 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_rc_bt_0010"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, RC_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, RC_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = rc_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[rc_bt_0010] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_rc_bt_0010; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[rc_bt_0010] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 대사 배치 결과 [rc_bt_0010] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[rc_bt_0010] 배치 시작 date=%s", biz_date); + + rc = rc_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[rc_bt_0010] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_rc_bt_0010(biz_date); + + rc_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[rc_bt_0010] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/rc_bt_0011.c b/app/batch/rc_bt_0011.c new file mode 100644 index 0000000..36e1eb9 --- /dev/null +++ b/app/batch/rc_bt_0011.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/rc_bt_0011.pgc" +/* @tier medium @module rc @transform reconciliation-batch */ +/* + * rc_bt_0011.pgc - 대사 배치 (커서 순회 + 상태전이) [tier=medium] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: rc_bt_0011 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "rc_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/rc_bt_0011.pgc" + + +static int run_rc_bt_0011(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/rc_bt_0011.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/rc_bt_0011.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/rc_bt_0011.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/rc_bt_0011.pgc" + long h_amount ; + +#line 28 "app/batch/rc_bt_0011.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/rc_bt_0011.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_rc_bt_0011 cursor for select key , merch_id , amount from rc_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/rc_bt_0011.pgc" + +#line 42 "app/batch/rc_bt_0011.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_rc_bt_0011 cursor for select key , merch_id , amount from rc_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/rc_bt_0011.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_rc_bt_0011"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[rc_bt_0011] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_rc_bt_0011", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/rc_bt_0011.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_rc_bt_0011"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, RC_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, RC_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = rc_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[rc_bt_0011] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_rc_bt_0011", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/rc_bt_0011.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[rc_bt_0011] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 대사 배치 결과 [rc_bt_0011] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[rc_bt_0011] 배치 시작 date=%s", biz_date); + + rc = rc_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[rc_bt_0011] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_rc_bt_0011(biz_date); + + rc_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[rc_bt_0011] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/rc_bt_0011.pgc b/app/batch/rc_bt_0011.pgc new file mode 100644 index 0000000..123cc80 --- /dev/null +++ b/app/batch/rc_bt_0011.pgc @@ -0,0 +1,138 @@ +/* @tier medium @module rc @transform reconciliation-batch */ +/* + * rc_bt_0011.pgc - 대사 배치 (커서 순회 + 상태전이) [tier=medium] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: rc_bt_0011 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "rc_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_rc_bt_0011(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_rc_bt_0011 CURSOR FOR + SELECT key, merch_id, amount + FROM rc_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_rc_bt_0011; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_rc_bt_0011"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[rc_bt_0011] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_rc_bt_0011 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_rc_bt_0011"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, RC_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, RC_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = rc_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[rc_bt_0011] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_rc_bt_0011; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[rc_bt_0011] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 대사 배치 결과 [rc_bt_0011] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[rc_bt_0011] 배치 시작 date=%s", biz_date); + + rc = rc_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[rc_bt_0011] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_rc_bt_0011(biz_date); + + rc_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[rc_bt_0011] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/rc_bt_0012.c b/app/batch/rc_bt_0012.c new file mode 100644 index 0000000..adc47e3 --- /dev/null +++ b/app/batch/rc_bt_0012.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/rc_bt_0012.pgc" +/* @tier easy @module rc @transform reconciliation-batch */ +/* + * rc_bt_0012.pgc - 대사 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: rc_bt_0012 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "rc_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/rc_bt_0012.pgc" + + +static int run_rc_bt_0012(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/rc_bt_0012.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/rc_bt_0012.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/rc_bt_0012.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/rc_bt_0012.pgc" + long h_amount ; + +#line 28 "app/batch/rc_bt_0012.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/rc_bt_0012.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_rc_bt_0012 cursor for select key , merch_id , amount from rc_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/rc_bt_0012.pgc" + +#line 42 "app/batch/rc_bt_0012.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_rc_bt_0012 cursor for select key , merch_id , amount from rc_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/rc_bt_0012.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_rc_bt_0012"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[rc_bt_0012] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_rc_bt_0012", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/rc_bt_0012.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_rc_bt_0012"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, RC_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, RC_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = rc_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[rc_bt_0012] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_rc_bt_0012", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/rc_bt_0012.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[rc_bt_0012] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 대사 배치 결과 [rc_bt_0012] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[rc_bt_0012] 배치 시작 date=%s", biz_date); + + rc = rc_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[rc_bt_0012] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_rc_bt_0012(biz_date); + + rc_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[rc_bt_0012] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/rc_bt_0012.pgc b/app/batch/rc_bt_0012.pgc new file mode 100644 index 0000000..b9b2e7a --- /dev/null +++ b/app/batch/rc_bt_0012.pgc @@ -0,0 +1,138 @@ +/* @tier easy @module rc @transform reconciliation-batch */ +/* + * rc_bt_0012.pgc - 대사 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: rc_bt_0012 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "rc_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_rc_bt_0012(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_rc_bt_0012 CURSOR FOR + SELECT key, merch_id, amount + FROM rc_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_rc_bt_0012; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_rc_bt_0012"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[rc_bt_0012] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_rc_bt_0012 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_rc_bt_0012"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, RC_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, RC_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = rc_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[rc_bt_0012] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_rc_bt_0012; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[rc_bt_0012] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 대사 배치 결과 [rc_bt_0012] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[rc_bt_0012] 배치 시작 date=%s", biz_date); + + rc = rc_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[rc_bt_0012] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_rc_bt_0012(biz_date); + + rc_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[rc_bt_0012] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/rc_bt_0013.c b/app/batch/rc_bt_0013.c new file mode 100644 index 0000000..f7838ef --- /dev/null +++ b/app/batch/rc_bt_0013.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/rc_bt_0013.pgc" +/* @tier medium @module rc @transform reconciliation-batch */ +/* + * rc_bt_0013.pgc - 대사 배치 (커서 순회 + 상태전이) [tier=medium] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: rc_bt_0013 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "rc_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/rc_bt_0013.pgc" + + +static int run_rc_bt_0013(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/rc_bt_0013.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/rc_bt_0013.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/rc_bt_0013.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/rc_bt_0013.pgc" + long h_amount ; + +#line 28 "app/batch/rc_bt_0013.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/rc_bt_0013.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_rc_bt_0013 cursor for select key , merch_id , amount from rc_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/rc_bt_0013.pgc" + +#line 42 "app/batch/rc_bt_0013.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_rc_bt_0013 cursor for select key , merch_id , amount from rc_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/rc_bt_0013.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_rc_bt_0013"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[rc_bt_0013] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_rc_bt_0013", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/rc_bt_0013.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_rc_bt_0013"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, RC_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, RC_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = rc_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[rc_bt_0013] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_rc_bt_0013", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/rc_bt_0013.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[rc_bt_0013] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 대사 배치 결과 [rc_bt_0013] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[rc_bt_0013] 배치 시작 date=%s", biz_date); + + rc = rc_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[rc_bt_0013] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_rc_bt_0013(biz_date); + + rc_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[rc_bt_0013] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/rc_bt_0013.pgc b/app/batch/rc_bt_0013.pgc new file mode 100644 index 0000000..8ec2842 --- /dev/null +++ b/app/batch/rc_bt_0013.pgc @@ -0,0 +1,138 @@ +/* @tier medium @module rc @transform reconciliation-batch */ +/* + * rc_bt_0013.pgc - 대사 배치 (커서 순회 + 상태전이) [tier=medium] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: rc_bt_0013 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "rc_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_rc_bt_0013(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_rc_bt_0013 CURSOR FOR + SELECT key, merch_id, amount + FROM rc_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_rc_bt_0013; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_rc_bt_0013"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[rc_bt_0013] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_rc_bt_0013 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_rc_bt_0013"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, RC_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, RC_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = rc_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[rc_bt_0013] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_rc_bt_0013; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[rc_bt_0013] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 대사 배치 결과 [rc_bt_0013] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[rc_bt_0013] 배치 시작 date=%s", biz_date); + + rc = rc_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[rc_bt_0013] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_rc_bt_0013(biz_date); + + rc_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[rc_bt_0013] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/rc_bt_0014.c b/app/batch/rc_bt_0014.c new file mode 100644 index 0000000..2ced64e --- /dev/null +++ b/app/batch/rc_bt_0014.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/rc_bt_0014.pgc" +/* @tier easy @module rc @transform reconciliation-batch */ +/* + * rc_bt_0014.pgc - 대사 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: rc_bt_0014 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "rc_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/rc_bt_0014.pgc" + + +static int run_rc_bt_0014(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/rc_bt_0014.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/rc_bt_0014.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/rc_bt_0014.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/rc_bt_0014.pgc" + long h_amount ; + +#line 28 "app/batch/rc_bt_0014.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/rc_bt_0014.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_rc_bt_0014 cursor for select key , merch_id , amount from rc_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/rc_bt_0014.pgc" + +#line 42 "app/batch/rc_bt_0014.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_rc_bt_0014 cursor for select key , merch_id , amount from rc_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/rc_bt_0014.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_rc_bt_0014"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[rc_bt_0014] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_rc_bt_0014", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/rc_bt_0014.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_rc_bt_0014"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, RC_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, RC_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = rc_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[rc_bt_0014] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_rc_bt_0014", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/rc_bt_0014.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[rc_bt_0014] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 대사 배치 결과 [rc_bt_0014] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[rc_bt_0014] 배치 시작 date=%s", biz_date); + + rc = rc_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[rc_bt_0014] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_rc_bt_0014(biz_date); + + rc_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[rc_bt_0014] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/rc_bt_0014.pgc b/app/batch/rc_bt_0014.pgc new file mode 100644 index 0000000..722f2f3 --- /dev/null +++ b/app/batch/rc_bt_0014.pgc @@ -0,0 +1,138 @@ +/* @tier easy @module rc @transform reconciliation-batch */ +/* + * rc_bt_0014.pgc - 대사 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: rc_bt_0014 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "rc_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_rc_bt_0014(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_rc_bt_0014 CURSOR FOR + SELECT key, merch_id, amount + FROM rc_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_rc_bt_0014; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_rc_bt_0014"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[rc_bt_0014] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_rc_bt_0014 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_rc_bt_0014"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, RC_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, RC_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = rc_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[rc_bt_0014] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_rc_bt_0014; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[rc_bt_0014] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 대사 배치 결과 [rc_bt_0014] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[rc_bt_0014] 배치 시작 date=%s", biz_date); + + rc = rc_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[rc_bt_0014] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_rc_bt_0014(biz_date); + + rc_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[rc_bt_0014] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/rc_bt_0015.c b/app/batch/rc_bt_0015.c new file mode 100644 index 0000000..1d14eed --- /dev/null +++ b/app/batch/rc_bt_0015.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/rc_bt_0015.pgc" +/* @tier hard @module rc @transform reconciliation-batch */ +/* + * rc_bt_0015.pgc - 대사 배치 (커서 순회 + 상태전이) [tier=hard] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: rc_bt_0015 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "rc_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/rc_bt_0015.pgc" + + +static int run_rc_bt_0015(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/rc_bt_0015.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/rc_bt_0015.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/rc_bt_0015.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/rc_bt_0015.pgc" + long h_amount ; + +#line 28 "app/batch/rc_bt_0015.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/rc_bt_0015.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_rc_bt_0015 cursor for select key , merch_id , amount from rc_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/rc_bt_0015.pgc" + +#line 42 "app/batch/rc_bt_0015.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_rc_bt_0015 cursor for select key , merch_id , amount from rc_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/rc_bt_0015.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_rc_bt_0015"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[rc_bt_0015] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_rc_bt_0015", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/rc_bt_0015.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_rc_bt_0015"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, RC_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, RC_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = rc_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[rc_bt_0015] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_rc_bt_0015", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/rc_bt_0015.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[rc_bt_0015] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 대사 배치 결과 [rc_bt_0015] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[rc_bt_0015] 배치 시작 date=%s", biz_date); + + rc = rc_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[rc_bt_0015] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_rc_bt_0015(biz_date); + + rc_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[rc_bt_0015] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/rc_bt_0015.pgc b/app/batch/rc_bt_0015.pgc new file mode 100644 index 0000000..e3b94f3 --- /dev/null +++ b/app/batch/rc_bt_0015.pgc @@ -0,0 +1,138 @@ +/* @tier hard @module rc @transform reconciliation-batch */ +/* + * rc_bt_0015.pgc - 대사 배치 (커서 순회 + 상태전이) [tier=hard] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: rc_bt_0015 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "rc_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_rc_bt_0015(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_rc_bt_0015 CURSOR FOR + SELECT key, merch_id, amount + FROM rc_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_rc_bt_0015; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_rc_bt_0015"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[rc_bt_0015] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_rc_bt_0015 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_rc_bt_0015"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, RC_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, RC_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = rc_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[rc_bt_0015] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_rc_bt_0015; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[rc_bt_0015] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 대사 배치 결과 [rc_bt_0015] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[rc_bt_0015] 배치 시작 date=%s", biz_date); + + rc = rc_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[rc_bt_0015] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_rc_bt_0015(biz_date); + + rc_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[rc_bt_0015] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/rc_bt_0016.c b/app/batch/rc_bt_0016.c new file mode 100644 index 0000000..80288e5 --- /dev/null +++ b/app/batch/rc_bt_0016.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/rc_bt_0016.pgc" +/* @tier easy @module rc @transform reconciliation-batch */ +/* + * rc_bt_0016.pgc - 대사 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: rc_bt_0016 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "rc_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/rc_bt_0016.pgc" + + +static int run_rc_bt_0016(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/rc_bt_0016.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/rc_bt_0016.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/rc_bt_0016.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/rc_bt_0016.pgc" + long h_amount ; + +#line 28 "app/batch/rc_bt_0016.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/rc_bt_0016.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_rc_bt_0016 cursor for select key , merch_id , amount from rc_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/rc_bt_0016.pgc" + +#line 42 "app/batch/rc_bt_0016.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_rc_bt_0016 cursor for select key , merch_id , amount from rc_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/rc_bt_0016.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_rc_bt_0016"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[rc_bt_0016] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_rc_bt_0016", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/rc_bt_0016.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_rc_bt_0016"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, RC_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, RC_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = rc_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[rc_bt_0016] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_rc_bt_0016", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/rc_bt_0016.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[rc_bt_0016] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 대사 배치 결과 [rc_bt_0016] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[rc_bt_0016] 배치 시작 date=%s", biz_date); + + rc = rc_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[rc_bt_0016] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_rc_bt_0016(biz_date); + + rc_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[rc_bt_0016] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/rc_bt_0016.pgc b/app/batch/rc_bt_0016.pgc new file mode 100644 index 0000000..1d92013 --- /dev/null +++ b/app/batch/rc_bt_0016.pgc @@ -0,0 +1,138 @@ +/* @tier easy @module rc @transform reconciliation-batch */ +/* + * rc_bt_0016.pgc - 대사 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: rc_bt_0016 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "rc_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_rc_bt_0016(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_rc_bt_0016 CURSOR FOR + SELECT key, merch_id, amount + FROM rc_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_rc_bt_0016; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_rc_bt_0016"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[rc_bt_0016] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_rc_bt_0016 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_rc_bt_0016"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, RC_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, RC_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = rc_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[rc_bt_0016] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_rc_bt_0016; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[rc_bt_0016] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 대사 배치 결과 [rc_bt_0016] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[rc_bt_0016] 배치 시작 date=%s", biz_date); + + rc = rc_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[rc_bt_0016] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_rc_bt_0016(biz_date); + + rc_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[rc_bt_0016] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/rc_bt_0017.c b/app/batch/rc_bt_0017.c new file mode 100644 index 0000000..db4915b --- /dev/null +++ b/app/batch/rc_bt_0017.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/rc_bt_0017.pgc" +/* @tier hard @module rc @transform reconciliation-batch */ +/* + * rc_bt_0017.pgc - 대사 배치 (커서 순회 + 상태전이) [tier=hard] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: rc_bt_0017 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "rc_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/rc_bt_0017.pgc" + + +static int run_rc_bt_0017(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/rc_bt_0017.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/rc_bt_0017.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/rc_bt_0017.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/rc_bt_0017.pgc" + long h_amount ; + +#line 28 "app/batch/rc_bt_0017.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/rc_bt_0017.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_rc_bt_0017 cursor for select key , merch_id , amount from rc_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/rc_bt_0017.pgc" + +#line 42 "app/batch/rc_bt_0017.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_rc_bt_0017 cursor for select key , merch_id , amount from rc_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/rc_bt_0017.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_rc_bt_0017"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[rc_bt_0017] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_rc_bt_0017", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/rc_bt_0017.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_rc_bt_0017"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, RC_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, RC_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = rc_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[rc_bt_0017] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_rc_bt_0017", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/rc_bt_0017.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[rc_bt_0017] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 대사 배치 결과 [rc_bt_0017] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[rc_bt_0017] 배치 시작 date=%s", biz_date); + + rc = rc_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[rc_bt_0017] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_rc_bt_0017(biz_date); + + rc_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[rc_bt_0017] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/rc_bt_0017.pgc b/app/batch/rc_bt_0017.pgc new file mode 100644 index 0000000..cbca078 --- /dev/null +++ b/app/batch/rc_bt_0017.pgc @@ -0,0 +1,138 @@ +/* @tier hard @module rc @transform reconciliation-batch */ +/* + * rc_bt_0017.pgc - 대사 배치 (커서 순회 + 상태전이) [tier=hard] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: rc_bt_0017 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "rc_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_rc_bt_0017(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_rc_bt_0017 CURSOR FOR + SELECT key, merch_id, amount + FROM rc_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_rc_bt_0017; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_rc_bt_0017"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[rc_bt_0017] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_rc_bt_0017 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_rc_bt_0017"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, RC_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, RC_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = rc_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[rc_bt_0017] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_rc_bt_0017; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[rc_bt_0017] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 대사 배치 결과 [rc_bt_0017] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[rc_bt_0017] 배치 시작 date=%s", biz_date); + + rc = rc_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[rc_bt_0017] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_rc_bt_0017(biz_date); + + rc_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[rc_bt_0017] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/st_bt_0001.c b/app/batch/st_bt_0001.c new file mode 100644 index 0000000..918cacc --- /dev/null +++ b/app/batch/st_bt_0001.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/st_bt_0001.pgc" +/* @tier easy @module st @transform settlement-batch */ +/* + * st_bt_0001.pgc - 정산수수료 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: st_bt_0001 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "st_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/st_bt_0001.pgc" + + +static int run_st_bt_0001(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/st_bt_0001.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/st_bt_0001.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/st_bt_0001.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/st_bt_0001.pgc" + long h_amount ; + +#line 28 "app/batch/st_bt_0001.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/st_bt_0001.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_st_bt_0001 cursor for select key , merch_id , amount from st_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/st_bt_0001.pgc" + +#line 42 "app/batch/st_bt_0001.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_st_bt_0001 cursor for select key , merch_id , amount from st_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/st_bt_0001.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_st_bt_0001"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[st_bt_0001] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_st_bt_0001", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/st_bt_0001.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_st_bt_0001"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, ST_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, ST_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = st_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[st_bt_0001] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_st_bt_0001", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/st_bt_0001.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[st_bt_0001] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 정산수수료 배치 결과 [st_bt_0001] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[st_bt_0001] 배치 시작 date=%s", biz_date); + + rc = st_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[st_bt_0001] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_st_bt_0001(biz_date); + + st_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[st_bt_0001] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/st_bt_0001.pgc b/app/batch/st_bt_0001.pgc new file mode 100644 index 0000000..c952adf --- /dev/null +++ b/app/batch/st_bt_0001.pgc @@ -0,0 +1,138 @@ +/* @tier easy @module st @transform settlement-batch */ +/* + * st_bt_0001.pgc - 정산수수료 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: st_bt_0001 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "st_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_st_bt_0001(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_st_bt_0001 CURSOR FOR + SELECT key, merch_id, amount + FROM st_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_st_bt_0001; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_st_bt_0001"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[st_bt_0001] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_st_bt_0001 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_st_bt_0001"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, ST_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, ST_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = st_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[st_bt_0001] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_st_bt_0001; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[st_bt_0001] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 정산수수료 배치 결과 [st_bt_0001] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[st_bt_0001] 배치 시작 date=%s", biz_date); + + rc = st_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[st_bt_0001] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_st_bt_0001(biz_date); + + st_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[st_bt_0001] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/st_bt_0002.c b/app/batch/st_bt_0002.c new file mode 100644 index 0000000..5f7b249 --- /dev/null +++ b/app/batch/st_bt_0002.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/st_bt_0002.pgc" +/* @tier medium @module st @transform settlement-batch */ +/* + * st_bt_0002.pgc - 정산수수료 배치 (커서 순회 + 상태전이) [tier=medium] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: st_bt_0002 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "st_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/st_bt_0002.pgc" + + +static int run_st_bt_0002(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/st_bt_0002.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/st_bt_0002.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/st_bt_0002.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/st_bt_0002.pgc" + long h_amount ; + +#line 28 "app/batch/st_bt_0002.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/st_bt_0002.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_st_bt_0002 cursor for select key , merch_id , amount from st_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/st_bt_0002.pgc" + +#line 42 "app/batch/st_bt_0002.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_st_bt_0002 cursor for select key , merch_id , amount from st_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/st_bt_0002.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_st_bt_0002"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[st_bt_0002] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_st_bt_0002", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/st_bt_0002.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_st_bt_0002"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, ST_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, ST_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = st_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[st_bt_0002] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_st_bt_0002", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/st_bt_0002.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[st_bt_0002] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 정산수수료 배치 결과 [st_bt_0002] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[st_bt_0002] 배치 시작 date=%s", biz_date); + + rc = st_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[st_bt_0002] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_st_bt_0002(biz_date); + + st_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[st_bt_0002] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/st_bt_0002.pgc b/app/batch/st_bt_0002.pgc new file mode 100644 index 0000000..535e2ad --- /dev/null +++ b/app/batch/st_bt_0002.pgc @@ -0,0 +1,138 @@ +/* @tier medium @module st @transform settlement-batch */ +/* + * st_bt_0002.pgc - 정산수수료 배치 (커서 순회 + 상태전이) [tier=medium] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: st_bt_0002 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "st_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_st_bt_0002(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_st_bt_0002 CURSOR FOR + SELECT key, merch_id, amount + FROM st_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_st_bt_0002; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_st_bt_0002"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[st_bt_0002] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_st_bt_0002 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_st_bt_0002"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, ST_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, ST_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = st_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[st_bt_0002] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_st_bt_0002; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[st_bt_0002] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 정산수수료 배치 결과 [st_bt_0002] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[st_bt_0002] 배치 시작 date=%s", biz_date); + + rc = st_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[st_bt_0002] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_st_bt_0002(biz_date); + + st_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[st_bt_0002] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/st_bt_0003.c b/app/batch/st_bt_0003.c new file mode 100644 index 0000000..6618c89 --- /dev/null +++ b/app/batch/st_bt_0003.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/st_bt_0003.pgc" +/* @tier easy @module st @transform settlement-batch */ +/* + * st_bt_0003.pgc - 정산수수료 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: st_bt_0003 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "st_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/st_bt_0003.pgc" + + +static int run_st_bt_0003(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/st_bt_0003.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/st_bt_0003.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/st_bt_0003.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/st_bt_0003.pgc" + long h_amount ; + +#line 28 "app/batch/st_bt_0003.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/st_bt_0003.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_st_bt_0003 cursor for select key , merch_id , amount from st_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/st_bt_0003.pgc" + +#line 42 "app/batch/st_bt_0003.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_st_bt_0003 cursor for select key , merch_id , amount from st_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/st_bt_0003.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_st_bt_0003"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[st_bt_0003] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_st_bt_0003", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/st_bt_0003.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_st_bt_0003"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, ST_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, ST_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = st_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[st_bt_0003] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_st_bt_0003", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/st_bt_0003.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[st_bt_0003] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 정산수수료 배치 결과 [st_bt_0003] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[st_bt_0003] 배치 시작 date=%s", biz_date); + + rc = st_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[st_bt_0003] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_st_bt_0003(biz_date); + + st_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[st_bt_0003] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/st_bt_0003.pgc b/app/batch/st_bt_0003.pgc new file mode 100644 index 0000000..ea8a6fb --- /dev/null +++ b/app/batch/st_bt_0003.pgc @@ -0,0 +1,138 @@ +/* @tier easy @module st @transform settlement-batch */ +/* + * st_bt_0003.pgc - 정산수수료 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: st_bt_0003 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "st_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_st_bt_0003(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_st_bt_0003 CURSOR FOR + SELECT key, merch_id, amount + FROM st_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_st_bt_0003; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_st_bt_0003"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[st_bt_0003] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_st_bt_0003 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_st_bt_0003"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, ST_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, ST_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = st_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[st_bt_0003] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_st_bt_0003; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[st_bt_0003] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 정산수수료 배치 결과 [st_bt_0003] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[st_bt_0003] 배치 시작 date=%s", biz_date); + + rc = st_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[st_bt_0003] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_st_bt_0003(biz_date); + + st_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[st_bt_0003] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/st_bt_0004.c b/app/batch/st_bt_0004.c new file mode 100644 index 0000000..ef54c52 --- /dev/null +++ b/app/batch/st_bt_0004.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/st_bt_0004.pgc" +/* @tier hard @module st @transform settlement-batch */ +/* + * st_bt_0004.pgc - 정산수수료 배치 (커서 순회 + 상태전이) [tier=hard] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: st_bt_0004 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "st_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/st_bt_0004.pgc" + + +static int run_st_bt_0004(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/st_bt_0004.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/st_bt_0004.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/st_bt_0004.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/st_bt_0004.pgc" + long h_amount ; + +#line 28 "app/batch/st_bt_0004.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/st_bt_0004.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_st_bt_0004 cursor for select key , merch_id , amount from st_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/st_bt_0004.pgc" + +#line 42 "app/batch/st_bt_0004.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_st_bt_0004 cursor for select key , merch_id , amount from st_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/st_bt_0004.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_st_bt_0004"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[st_bt_0004] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_st_bt_0004", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/st_bt_0004.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_st_bt_0004"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, ST_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, ST_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = st_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[st_bt_0004] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_st_bt_0004", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/st_bt_0004.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[st_bt_0004] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 정산수수료 배치 결과 [st_bt_0004] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[st_bt_0004] 배치 시작 date=%s", biz_date); + + rc = st_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[st_bt_0004] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_st_bt_0004(biz_date); + + st_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[st_bt_0004] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/st_bt_0004.pgc b/app/batch/st_bt_0004.pgc new file mode 100644 index 0000000..9bd7077 --- /dev/null +++ b/app/batch/st_bt_0004.pgc @@ -0,0 +1,138 @@ +/* @tier hard @module st @transform settlement-batch */ +/* + * st_bt_0004.pgc - 정산수수료 배치 (커서 순회 + 상태전이) [tier=hard] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: st_bt_0004 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "st_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_st_bt_0004(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_st_bt_0004 CURSOR FOR + SELECT key, merch_id, amount + FROM st_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_st_bt_0004; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_st_bt_0004"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[st_bt_0004] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_st_bt_0004 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_st_bt_0004"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, ST_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, ST_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = st_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[st_bt_0004] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_st_bt_0004; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[st_bt_0004] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 정산수수료 배치 결과 [st_bt_0004] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[st_bt_0004] 배치 시작 date=%s", biz_date); + + rc = st_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[st_bt_0004] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_st_bt_0004(biz_date); + + st_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[st_bt_0004] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/st_bt_0005.c b/app/batch/st_bt_0005.c new file mode 100644 index 0000000..7d86bce --- /dev/null +++ b/app/batch/st_bt_0005.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/st_bt_0005.pgc" +/* @tier easy @module st @transform settlement-batch */ +/* + * st_bt_0005.pgc - 정산수수료 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: st_bt_0005 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "st_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/st_bt_0005.pgc" + + +static int run_st_bt_0005(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/st_bt_0005.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/st_bt_0005.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/st_bt_0005.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/st_bt_0005.pgc" + long h_amount ; + +#line 28 "app/batch/st_bt_0005.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/st_bt_0005.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_st_bt_0005 cursor for select key , merch_id , amount from st_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/st_bt_0005.pgc" + +#line 42 "app/batch/st_bt_0005.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_st_bt_0005 cursor for select key , merch_id , amount from st_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/st_bt_0005.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_st_bt_0005"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[st_bt_0005] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_st_bt_0005", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/st_bt_0005.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_st_bt_0005"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, ST_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, ST_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = st_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[st_bt_0005] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_st_bt_0005", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/st_bt_0005.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[st_bt_0005] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 정산수수료 배치 결과 [st_bt_0005] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[st_bt_0005] 배치 시작 date=%s", biz_date); + + rc = st_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[st_bt_0005] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_st_bt_0005(biz_date); + + st_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[st_bt_0005] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/st_bt_0005.pgc b/app/batch/st_bt_0005.pgc new file mode 100644 index 0000000..64a98f9 --- /dev/null +++ b/app/batch/st_bt_0005.pgc @@ -0,0 +1,138 @@ +/* @tier easy @module st @transform settlement-batch */ +/* + * st_bt_0005.pgc - 정산수수료 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: st_bt_0005 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "st_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_st_bt_0005(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_st_bt_0005 CURSOR FOR + SELECT key, merch_id, amount + FROM st_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_st_bt_0005; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_st_bt_0005"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[st_bt_0005] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_st_bt_0005 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_st_bt_0005"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, ST_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, ST_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = st_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[st_bt_0005] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_st_bt_0005; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[st_bt_0005] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 정산수수료 배치 결과 [st_bt_0005] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[st_bt_0005] 배치 시작 date=%s", biz_date); + + rc = st_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[st_bt_0005] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_st_bt_0005(biz_date); + + st_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[st_bt_0005] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/st_bt_0006.c b/app/batch/st_bt_0006.c new file mode 100644 index 0000000..cfbcfec --- /dev/null +++ b/app/batch/st_bt_0006.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/st_bt_0006.pgc" +/* @tier easy @module st @transform settlement-batch */ +/* + * st_bt_0006.pgc - 정산수수료 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: st_bt_0006 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "st_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/st_bt_0006.pgc" + + +static int run_st_bt_0006(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/st_bt_0006.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/st_bt_0006.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/st_bt_0006.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/st_bt_0006.pgc" + long h_amount ; + +#line 28 "app/batch/st_bt_0006.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/st_bt_0006.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_st_bt_0006 cursor for select key , merch_id , amount from st_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/st_bt_0006.pgc" + +#line 42 "app/batch/st_bt_0006.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_st_bt_0006 cursor for select key , merch_id , amount from st_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/st_bt_0006.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_st_bt_0006"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[st_bt_0006] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_st_bt_0006", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/st_bt_0006.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_st_bt_0006"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, ST_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, ST_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = st_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[st_bt_0006] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_st_bt_0006", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/st_bt_0006.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[st_bt_0006] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 정산수수료 배치 결과 [st_bt_0006] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[st_bt_0006] 배치 시작 date=%s", biz_date); + + rc = st_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[st_bt_0006] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_st_bt_0006(biz_date); + + st_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[st_bt_0006] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/st_bt_0006.pgc b/app/batch/st_bt_0006.pgc new file mode 100644 index 0000000..3265d25 --- /dev/null +++ b/app/batch/st_bt_0006.pgc @@ -0,0 +1,138 @@ +/* @tier easy @module st @transform settlement-batch */ +/* + * st_bt_0006.pgc - 정산수수료 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: st_bt_0006 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "st_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_st_bt_0006(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_st_bt_0006 CURSOR FOR + SELECT key, merch_id, amount + FROM st_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_st_bt_0006; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_st_bt_0006"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[st_bt_0006] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_st_bt_0006 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_st_bt_0006"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, ST_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, ST_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = st_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[st_bt_0006] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_st_bt_0006; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[st_bt_0006] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 정산수수료 배치 결과 [st_bt_0006] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[st_bt_0006] 배치 시작 date=%s", biz_date); + + rc = st_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[st_bt_0006] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_st_bt_0006(biz_date); + + st_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[st_bt_0006] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/st_bt_0007.c b/app/batch/st_bt_0007.c new file mode 100644 index 0000000..e64972f --- /dev/null +++ b/app/batch/st_bt_0007.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/st_bt_0007.pgc" +/* @tier medium @module st @transform settlement-batch */ +/* + * st_bt_0007.pgc - 정산수수료 배치 (커서 순회 + 상태전이) [tier=medium] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: st_bt_0007 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "st_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/st_bt_0007.pgc" + + +static int run_st_bt_0007(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/st_bt_0007.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/st_bt_0007.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/st_bt_0007.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/st_bt_0007.pgc" + long h_amount ; + +#line 28 "app/batch/st_bt_0007.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/st_bt_0007.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_st_bt_0007 cursor for select key , merch_id , amount from st_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/st_bt_0007.pgc" + +#line 42 "app/batch/st_bt_0007.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_st_bt_0007 cursor for select key , merch_id , amount from st_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/st_bt_0007.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_st_bt_0007"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[st_bt_0007] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_st_bt_0007", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/st_bt_0007.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_st_bt_0007"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, ST_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, ST_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = st_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[st_bt_0007] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_st_bt_0007", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/st_bt_0007.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[st_bt_0007] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 정산수수료 배치 결과 [st_bt_0007] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[st_bt_0007] 배치 시작 date=%s", biz_date); + + rc = st_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[st_bt_0007] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_st_bt_0007(biz_date); + + st_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[st_bt_0007] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/st_bt_0007.pgc b/app/batch/st_bt_0007.pgc new file mode 100644 index 0000000..408da85 --- /dev/null +++ b/app/batch/st_bt_0007.pgc @@ -0,0 +1,138 @@ +/* @tier medium @module st @transform settlement-batch */ +/* + * st_bt_0007.pgc - 정산수수료 배치 (커서 순회 + 상태전이) [tier=medium] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: st_bt_0007 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "st_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_st_bt_0007(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_st_bt_0007 CURSOR FOR + SELECT key, merch_id, amount + FROM st_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_st_bt_0007; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_st_bt_0007"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[st_bt_0007] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_st_bt_0007 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_st_bt_0007"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, ST_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, ST_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = st_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[st_bt_0007] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_st_bt_0007; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[st_bt_0007] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 정산수수료 배치 결과 [st_bt_0007] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[st_bt_0007] 배치 시작 date=%s", biz_date); + + rc = st_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[st_bt_0007] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_st_bt_0007(biz_date); + + st_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[st_bt_0007] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/st_bt_0008.c b/app/batch/st_bt_0008.c new file mode 100644 index 0000000..865fde7 --- /dev/null +++ b/app/batch/st_bt_0008.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/st_bt_0008.pgc" +/* @tier easy @module st @transform settlement-batch */ +/* + * st_bt_0008.pgc - 정산수수료 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: st_bt_0008 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "st_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/st_bt_0008.pgc" + + +static int run_st_bt_0008(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/st_bt_0008.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/st_bt_0008.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/st_bt_0008.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/st_bt_0008.pgc" + long h_amount ; + +#line 28 "app/batch/st_bt_0008.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/st_bt_0008.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_st_bt_0008 cursor for select key , merch_id , amount from st_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/st_bt_0008.pgc" + +#line 42 "app/batch/st_bt_0008.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_st_bt_0008 cursor for select key , merch_id , amount from st_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/st_bt_0008.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_st_bt_0008"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[st_bt_0008] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_st_bt_0008", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/st_bt_0008.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_st_bt_0008"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, ST_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, ST_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = st_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[st_bt_0008] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_st_bt_0008", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/st_bt_0008.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[st_bt_0008] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 정산수수료 배치 결과 [st_bt_0008] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[st_bt_0008] 배치 시작 date=%s", biz_date); + + rc = st_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[st_bt_0008] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_st_bt_0008(biz_date); + + st_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[st_bt_0008] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/st_bt_0008.pgc b/app/batch/st_bt_0008.pgc new file mode 100644 index 0000000..d1644a6 --- /dev/null +++ b/app/batch/st_bt_0008.pgc @@ -0,0 +1,138 @@ +/* @tier easy @module st @transform settlement-batch */ +/* + * st_bt_0008.pgc - 정산수수료 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: st_bt_0008 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "st_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_st_bt_0008(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_st_bt_0008 CURSOR FOR + SELECT key, merch_id, amount + FROM st_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_st_bt_0008; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_st_bt_0008"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[st_bt_0008] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_st_bt_0008 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_st_bt_0008"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, ST_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, ST_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = st_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[st_bt_0008] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_st_bt_0008; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[st_bt_0008] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 정산수수료 배치 결과 [st_bt_0008] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[st_bt_0008] 배치 시작 date=%s", biz_date); + + rc = st_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[st_bt_0008] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_st_bt_0008(biz_date); + + st_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[st_bt_0008] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/st_bt_0009.c b/app/batch/st_bt_0009.c new file mode 100644 index 0000000..7db603d --- /dev/null +++ b/app/batch/st_bt_0009.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/st_bt_0009.pgc" +/* @tier medium @module st @transform settlement-batch */ +/* + * st_bt_0009.pgc - 정산수수료 배치 (커서 순회 + 상태전이) [tier=medium] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: st_bt_0009 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "st_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/st_bt_0009.pgc" + + +static int run_st_bt_0009(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/st_bt_0009.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/st_bt_0009.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/st_bt_0009.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/st_bt_0009.pgc" + long h_amount ; + +#line 28 "app/batch/st_bt_0009.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/st_bt_0009.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_st_bt_0009 cursor for select key , merch_id , amount from st_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/st_bt_0009.pgc" + +#line 42 "app/batch/st_bt_0009.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_st_bt_0009 cursor for select key , merch_id , amount from st_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/st_bt_0009.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_st_bt_0009"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[st_bt_0009] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_st_bt_0009", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/st_bt_0009.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_st_bt_0009"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, ST_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, ST_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = st_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[st_bt_0009] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_st_bt_0009", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/st_bt_0009.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[st_bt_0009] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 정산수수료 배치 결과 [st_bt_0009] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[st_bt_0009] 배치 시작 date=%s", biz_date); + + rc = st_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[st_bt_0009] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_st_bt_0009(biz_date); + + st_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[st_bt_0009] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/st_bt_0009.pgc b/app/batch/st_bt_0009.pgc new file mode 100644 index 0000000..d6a7563 --- /dev/null +++ b/app/batch/st_bt_0009.pgc @@ -0,0 +1,138 @@ +/* @tier medium @module st @transform settlement-batch */ +/* + * st_bt_0009.pgc - 정산수수료 배치 (커서 순회 + 상태전이) [tier=medium] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: st_bt_0009 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "st_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_st_bt_0009(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_st_bt_0009 CURSOR FOR + SELECT key, merch_id, amount + FROM st_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_st_bt_0009; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_st_bt_0009"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[st_bt_0009] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_st_bt_0009 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_st_bt_0009"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, ST_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, ST_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = st_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[st_bt_0009] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_st_bt_0009; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[st_bt_0009] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 정산수수료 배치 결과 [st_bt_0009] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[st_bt_0009] 배치 시작 date=%s", biz_date); + + rc = st_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[st_bt_0009] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_st_bt_0009(biz_date); + + st_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[st_bt_0009] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/st_bt_0010.c b/app/batch/st_bt_0010.c new file mode 100644 index 0000000..999cfad --- /dev/null +++ b/app/batch/st_bt_0010.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/st_bt_0010.pgc" +/* @tier easy @module st @transform settlement-batch */ +/* + * st_bt_0010.pgc - 정산수수료 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: st_bt_0010 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "st_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/st_bt_0010.pgc" + + +static int run_st_bt_0010(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/st_bt_0010.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/st_bt_0010.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/st_bt_0010.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/st_bt_0010.pgc" + long h_amount ; + +#line 28 "app/batch/st_bt_0010.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/st_bt_0010.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_st_bt_0010 cursor for select key , merch_id , amount from st_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/st_bt_0010.pgc" + +#line 42 "app/batch/st_bt_0010.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_st_bt_0010 cursor for select key , merch_id , amount from st_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/st_bt_0010.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_st_bt_0010"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[st_bt_0010] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_st_bt_0010", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/st_bt_0010.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_st_bt_0010"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, ST_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, ST_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = st_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[st_bt_0010] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_st_bt_0010", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/st_bt_0010.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[st_bt_0010] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 정산수수료 배치 결과 [st_bt_0010] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[st_bt_0010] 배치 시작 date=%s", biz_date); + + rc = st_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[st_bt_0010] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_st_bt_0010(biz_date); + + st_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[st_bt_0010] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/st_bt_0010.pgc b/app/batch/st_bt_0010.pgc new file mode 100644 index 0000000..b01aee0 --- /dev/null +++ b/app/batch/st_bt_0010.pgc @@ -0,0 +1,138 @@ +/* @tier easy @module st @transform settlement-batch */ +/* + * st_bt_0010.pgc - 정산수수료 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: st_bt_0010 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "st_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_st_bt_0010(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_st_bt_0010 CURSOR FOR + SELECT key, merch_id, amount + FROM st_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_st_bt_0010; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_st_bt_0010"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[st_bt_0010] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_st_bt_0010 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_st_bt_0010"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, ST_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, ST_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = st_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[st_bt_0010] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_st_bt_0010; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[st_bt_0010] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 정산수수료 배치 결과 [st_bt_0010] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[st_bt_0010] 배치 시작 date=%s", biz_date); + + rc = st_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[st_bt_0010] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_st_bt_0010(biz_date); + + st_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[st_bt_0010] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/st_bt_0011.c b/app/batch/st_bt_0011.c new file mode 100644 index 0000000..9ec1d63 --- /dev/null +++ b/app/batch/st_bt_0011.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/st_bt_0011.pgc" +/* @tier medium @module st @transform settlement-batch */ +/* + * st_bt_0011.pgc - 정산수수료 배치 (커서 순회 + 상태전이) [tier=medium] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: st_bt_0011 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "st_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/st_bt_0011.pgc" + + +static int run_st_bt_0011(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/st_bt_0011.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/st_bt_0011.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/st_bt_0011.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/st_bt_0011.pgc" + long h_amount ; + +#line 28 "app/batch/st_bt_0011.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/st_bt_0011.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_st_bt_0011 cursor for select key , merch_id , amount from st_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/st_bt_0011.pgc" + +#line 42 "app/batch/st_bt_0011.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_st_bt_0011 cursor for select key , merch_id , amount from st_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/st_bt_0011.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_st_bt_0011"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[st_bt_0011] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_st_bt_0011", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/st_bt_0011.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_st_bt_0011"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, ST_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, ST_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = st_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[st_bt_0011] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_st_bt_0011", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/st_bt_0011.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[st_bt_0011] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 정산수수료 배치 결과 [st_bt_0011] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[st_bt_0011] 배치 시작 date=%s", biz_date); + + rc = st_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[st_bt_0011] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_st_bt_0011(biz_date); + + st_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[st_bt_0011] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/st_bt_0011.pgc b/app/batch/st_bt_0011.pgc new file mode 100644 index 0000000..a5e9862 --- /dev/null +++ b/app/batch/st_bt_0011.pgc @@ -0,0 +1,138 @@ +/* @tier medium @module st @transform settlement-batch */ +/* + * st_bt_0011.pgc - 정산수수료 배치 (커서 순회 + 상태전이) [tier=medium] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: st_bt_0011 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "st_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_st_bt_0011(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_st_bt_0011 CURSOR FOR + SELECT key, merch_id, amount + FROM st_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_st_bt_0011; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_st_bt_0011"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[st_bt_0011] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_st_bt_0011 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_st_bt_0011"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, ST_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, ST_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = st_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[st_bt_0011] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_st_bt_0011; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[st_bt_0011] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 정산수수료 배치 결과 [st_bt_0011] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[st_bt_0011] 배치 시작 date=%s", biz_date); + + rc = st_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[st_bt_0011] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_st_bt_0011(biz_date); + + st_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[st_bt_0011] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/st_bt_0012.c b/app/batch/st_bt_0012.c new file mode 100644 index 0000000..42d2636 --- /dev/null +++ b/app/batch/st_bt_0012.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/st_bt_0012.pgc" +/* @tier easy @module st @transform settlement-batch */ +/* + * st_bt_0012.pgc - 정산수수료 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: st_bt_0012 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "st_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/st_bt_0012.pgc" + + +static int run_st_bt_0012(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/st_bt_0012.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/st_bt_0012.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/st_bt_0012.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/st_bt_0012.pgc" + long h_amount ; + +#line 28 "app/batch/st_bt_0012.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/st_bt_0012.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_st_bt_0012 cursor for select key , merch_id , amount from st_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/st_bt_0012.pgc" + +#line 42 "app/batch/st_bt_0012.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_st_bt_0012 cursor for select key , merch_id , amount from st_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/st_bt_0012.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_st_bt_0012"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[st_bt_0012] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_st_bt_0012", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/st_bt_0012.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_st_bt_0012"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, ST_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, ST_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = st_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[st_bt_0012] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_st_bt_0012", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/st_bt_0012.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[st_bt_0012] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 정산수수료 배치 결과 [st_bt_0012] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[st_bt_0012] 배치 시작 date=%s", biz_date); + + rc = st_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[st_bt_0012] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_st_bt_0012(biz_date); + + st_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[st_bt_0012] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/st_bt_0012.pgc b/app/batch/st_bt_0012.pgc new file mode 100644 index 0000000..cda3a2b --- /dev/null +++ b/app/batch/st_bt_0012.pgc @@ -0,0 +1,138 @@ +/* @tier easy @module st @transform settlement-batch */ +/* + * st_bt_0012.pgc - 정산수수료 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: st_bt_0012 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "st_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_st_bt_0012(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_st_bt_0012 CURSOR FOR + SELECT key, merch_id, amount + FROM st_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_st_bt_0012; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_st_bt_0012"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[st_bt_0012] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_st_bt_0012 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_st_bt_0012"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, ST_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, ST_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = st_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[st_bt_0012] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_st_bt_0012; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[st_bt_0012] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 정산수수료 배치 결과 [st_bt_0012] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[st_bt_0012] 배치 시작 date=%s", biz_date); + + rc = st_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[st_bt_0012] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_st_bt_0012(biz_date); + + st_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[st_bt_0012] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/st_bt_0013.c b/app/batch/st_bt_0013.c new file mode 100644 index 0000000..14f4ff9 --- /dev/null +++ b/app/batch/st_bt_0013.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/st_bt_0013.pgc" +/* @tier hard @module st @transform settlement-batch */ +/* + * st_bt_0013.pgc - 정산수수료 배치 (커서 순회 + 상태전이) [tier=hard] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: st_bt_0013 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "st_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/st_bt_0013.pgc" + + +static int run_st_bt_0013(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/st_bt_0013.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/st_bt_0013.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/st_bt_0013.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/st_bt_0013.pgc" + long h_amount ; + +#line 28 "app/batch/st_bt_0013.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/st_bt_0013.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_st_bt_0013 cursor for select key , merch_id , amount from st_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/st_bt_0013.pgc" + +#line 42 "app/batch/st_bt_0013.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_st_bt_0013 cursor for select key , merch_id , amount from st_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/st_bt_0013.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_st_bt_0013"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[st_bt_0013] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_st_bt_0013", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/st_bt_0013.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_st_bt_0013"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, ST_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, ST_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = st_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[st_bt_0013] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_st_bt_0013", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/st_bt_0013.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[st_bt_0013] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 정산수수료 배치 결과 [st_bt_0013] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[st_bt_0013] 배치 시작 date=%s", biz_date); + + rc = st_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[st_bt_0013] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_st_bt_0013(biz_date); + + st_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[st_bt_0013] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/st_bt_0013.pgc b/app/batch/st_bt_0013.pgc new file mode 100644 index 0000000..ad37136 --- /dev/null +++ b/app/batch/st_bt_0013.pgc @@ -0,0 +1,138 @@ +/* @tier hard @module st @transform settlement-batch */ +/* + * st_bt_0013.pgc - 정산수수료 배치 (커서 순회 + 상태전이) [tier=hard] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: st_bt_0013 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "st_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_st_bt_0013(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_st_bt_0013 CURSOR FOR + SELECT key, merch_id, amount + FROM st_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_st_bt_0013; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_st_bt_0013"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[st_bt_0013] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_st_bt_0013 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_st_bt_0013"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, ST_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, ST_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = st_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[st_bt_0013] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_st_bt_0013; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[st_bt_0013] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 정산수수료 배치 결과 [st_bt_0013] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[st_bt_0013] 배치 시작 date=%s", biz_date); + + rc = st_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[st_bt_0013] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_st_bt_0013(biz_date); + + st_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[st_bt_0013] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/st_bt_0014.c b/app/batch/st_bt_0014.c new file mode 100644 index 0000000..f471808 --- /dev/null +++ b/app/batch/st_bt_0014.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/st_bt_0014.pgc" +/* @tier easy @module st @transform settlement-batch */ +/* + * st_bt_0014.pgc - 정산수수료 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: st_bt_0014 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "st_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/st_bt_0014.pgc" + + +static int run_st_bt_0014(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/st_bt_0014.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/st_bt_0014.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/st_bt_0014.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/st_bt_0014.pgc" + long h_amount ; + +#line 28 "app/batch/st_bt_0014.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/st_bt_0014.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_st_bt_0014 cursor for select key , merch_id , amount from st_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/st_bt_0014.pgc" + +#line 42 "app/batch/st_bt_0014.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_st_bt_0014 cursor for select key , merch_id , amount from st_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/st_bt_0014.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_st_bt_0014"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[st_bt_0014] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_st_bt_0014", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/st_bt_0014.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_st_bt_0014"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, ST_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, ST_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = st_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[st_bt_0014] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_st_bt_0014", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/st_bt_0014.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[st_bt_0014] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 정산수수료 배치 결과 [st_bt_0014] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[st_bt_0014] 배치 시작 date=%s", biz_date); + + rc = st_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[st_bt_0014] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_st_bt_0014(biz_date); + + st_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[st_bt_0014] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/st_bt_0014.pgc b/app/batch/st_bt_0014.pgc new file mode 100644 index 0000000..20de443 --- /dev/null +++ b/app/batch/st_bt_0014.pgc @@ -0,0 +1,138 @@ +/* @tier easy @module st @transform settlement-batch */ +/* + * st_bt_0014.pgc - 정산수수료 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: st_bt_0014 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "st_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_st_bt_0014(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_st_bt_0014 CURSOR FOR + SELECT key, merch_id, amount + FROM st_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_st_bt_0014; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_st_bt_0014"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[st_bt_0014] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_st_bt_0014 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_st_bt_0014"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, ST_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, ST_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = st_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[st_bt_0014] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_st_bt_0014; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[st_bt_0014] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 정산수수료 배치 결과 [st_bt_0014] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[st_bt_0014] 배치 시작 date=%s", biz_date); + + rc = st_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[st_bt_0014] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_st_bt_0014(biz_date); + + st_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[st_bt_0014] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/st_bt_0015.c b/app/batch/st_bt_0015.c new file mode 100644 index 0000000..dea2490 --- /dev/null +++ b/app/batch/st_bt_0015.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/st_bt_0015.pgc" +/* @tier hard @module st @transform settlement-batch */ +/* + * st_bt_0015.pgc - 정산수수료 배치 (커서 순회 + 상태전이) [tier=hard] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: st_bt_0015 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "st_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/st_bt_0015.pgc" + + +static int run_st_bt_0015(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/st_bt_0015.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/st_bt_0015.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/st_bt_0015.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/st_bt_0015.pgc" + long h_amount ; + +#line 28 "app/batch/st_bt_0015.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/st_bt_0015.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_st_bt_0015 cursor for select key , merch_id , amount from st_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/st_bt_0015.pgc" + +#line 42 "app/batch/st_bt_0015.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_st_bt_0015 cursor for select key , merch_id , amount from st_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/st_bt_0015.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_st_bt_0015"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[st_bt_0015] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_st_bt_0015", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/st_bt_0015.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_st_bt_0015"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, ST_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, ST_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = st_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[st_bt_0015] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_st_bt_0015", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/st_bt_0015.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[st_bt_0015] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 정산수수료 배치 결과 [st_bt_0015] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[st_bt_0015] 배치 시작 date=%s", biz_date); + + rc = st_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[st_bt_0015] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_st_bt_0015(biz_date); + + st_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[st_bt_0015] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/st_bt_0015.pgc b/app/batch/st_bt_0015.pgc new file mode 100644 index 0000000..28f2f68 --- /dev/null +++ b/app/batch/st_bt_0015.pgc @@ -0,0 +1,138 @@ +/* @tier hard @module st @transform settlement-batch */ +/* + * st_bt_0015.pgc - 정산수수료 배치 (커서 순회 + 상태전이) [tier=hard] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: st_bt_0015 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "st_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_st_bt_0015(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_st_bt_0015 CURSOR FOR + SELECT key, merch_id, amount + FROM st_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_st_bt_0015; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_st_bt_0015"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[st_bt_0015] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_st_bt_0015 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_st_bt_0015"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, ST_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, ST_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = st_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[st_bt_0015] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_st_bt_0015; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[st_bt_0015] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 정산수수료 배치 결과 [st_bt_0015] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[st_bt_0015] 배치 시작 date=%s", biz_date); + + rc = st_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[st_bt_0015] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_st_bt_0015(biz_date); + + st_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[st_bt_0015] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/st_bt_0016.c b/app/batch/st_bt_0016.c new file mode 100644 index 0000000..2e5b350 --- /dev/null +++ b/app/batch/st_bt_0016.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/st_bt_0016.pgc" +/* @tier easy @module st @transform settlement-batch */ +/* + * st_bt_0016.pgc - 정산수수료 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: st_bt_0016 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "st_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/st_bt_0016.pgc" + + +static int run_st_bt_0016(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/st_bt_0016.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/st_bt_0016.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/st_bt_0016.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/st_bt_0016.pgc" + long h_amount ; + +#line 28 "app/batch/st_bt_0016.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/st_bt_0016.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_st_bt_0016 cursor for select key , merch_id , amount from st_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/st_bt_0016.pgc" + +#line 42 "app/batch/st_bt_0016.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_st_bt_0016 cursor for select key , merch_id , amount from st_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/st_bt_0016.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_st_bt_0016"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[st_bt_0016] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_st_bt_0016", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/st_bt_0016.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_st_bt_0016"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, ST_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, ST_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = st_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[st_bt_0016] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_st_bt_0016", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/st_bt_0016.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[st_bt_0016] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 정산수수료 배치 결과 [st_bt_0016] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[st_bt_0016] 배치 시작 date=%s", biz_date); + + rc = st_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[st_bt_0016] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_st_bt_0016(biz_date); + + st_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[st_bt_0016] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/st_bt_0016.pgc b/app/batch/st_bt_0016.pgc new file mode 100644 index 0000000..add6f6f --- /dev/null +++ b/app/batch/st_bt_0016.pgc @@ -0,0 +1,138 @@ +/* @tier easy @module st @transform settlement-batch */ +/* + * st_bt_0016.pgc - 정산수수료 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: st_bt_0016 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "st_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_st_bt_0016(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_st_bt_0016 CURSOR FOR + SELECT key, merch_id, amount + FROM st_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_st_bt_0016; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_st_bt_0016"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[st_bt_0016] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_st_bt_0016 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_st_bt_0016"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, ST_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, ST_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = st_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[st_bt_0016] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_st_bt_0016; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[st_bt_0016] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 정산수수료 배치 결과 [st_bt_0016] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[st_bt_0016] 배치 시작 date=%s", biz_date); + + rc = st_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[st_bt_0016] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_st_bt_0016(biz_date); + + st_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[st_bt_0016] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/vl_bt_0001.c b/app/batch/vl_bt_0001.c new file mode 100644 index 0000000..e862653 --- /dev/null +++ b/app/batch/vl_bt_0001.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/vl_bt_0001.pgc" +/* @tier easy @module vl @transform validation-batch */ +/* + * vl_bt_0001.pgc - 정합성 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: vl_bt_0001 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "vl_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/vl_bt_0001.pgc" + + +static int run_vl_bt_0001(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/vl_bt_0001.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/vl_bt_0001.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/vl_bt_0001.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/vl_bt_0001.pgc" + long h_amount ; + +#line 28 "app/batch/vl_bt_0001.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/vl_bt_0001.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_vl_bt_0001 cursor for select key , merch_id , amount from vl_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/vl_bt_0001.pgc" + +#line 42 "app/batch/vl_bt_0001.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_vl_bt_0001 cursor for select key , merch_id , amount from vl_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/vl_bt_0001.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_vl_bt_0001"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[vl_bt_0001] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_vl_bt_0001", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/vl_bt_0001.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_vl_bt_0001"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, VL_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, VL_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = vl_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[vl_bt_0001] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_vl_bt_0001", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/vl_bt_0001.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[vl_bt_0001] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 정합성 배치 결과 [vl_bt_0001] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[vl_bt_0001] 배치 시작 date=%s", biz_date); + + rc = vl_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[vl_bt_0001] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_vl_bt_0001(biz_date); + + vl_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[vl_bt_0001] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/vl_bt_0001.pgc b/app/batch/vl_bt_0001.pgc new file mode 100644 index 0000000..f83331e --- /dev/null +++ b/app/batch/vl_bt_0001.pgc @@ -0,0 +1,138 @@ +/* @tier easy @module vl @transform validation-batch */ +/* + * vl_bt_0001.pgc - 정합성 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: vl_bt_0001 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "vl_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_vl_bt_0001(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_vl_bt_0001 CURSOR FOR + SELECT key, merch_id, amount + FROM vl_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_vl_bt_0001; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_vl_bt_0001"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[vl_bt_0001] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_vl_bt_0001 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_vl_bt_0001"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, VL_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, VL_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = vl_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[vl_bt_0001] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_vl_bt_0001; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[vl_bt_0001] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 정합성 배치 결과 [vl_bt_0001] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[vl_bt_0001] 배치 시작 date=%s", biz_date); + + rc = vl_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[vl_bt_0001] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_vl_bt_0001(biz_date); + + vl_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[vl_bt_0001] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/vl_bt_0002.c b/app/batch/vl_bt_0002.c new file mode 100644 index 0000000..32ae614 --- /dev/null +++ b/app/batch/vl_bt_0002.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/vl_bt_0002.pgc" +/* @tier medium @module vl @transform validation-batch */ +/* + * vl_bt_0002.pgc - 정합성 배치 (커서 순회 + 상태전이) [tier=medium] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: vl_bt_0002 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "vl_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/vl_bt_0002.pgc" + + +static int run_vl_bt_0002(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/vl_bt_0002.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/vl_bt_0002.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/vl_bt_0002.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/vl_bt_0002.pgc" + long h_amount ; + +#line 28 "app/batch/vl_bt_0002.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/vl_bt_0002.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_vl_bt_0002 cursor for select key , merch_id , amount from vl_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/vl_bt_0002.pgc" + +#line 42 "app/batch/vl_bt_0002.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_vl_bt_0002 cursor for select key , merch_id , amount from vl_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/vl_bt_0002.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_vl_bt_0002"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[vl_bt_0002] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_vl_bt_0002", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/vl_bt_0002.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_vl_bt_0002"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, VL_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, VL_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = vl_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[vl_bt_0002] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_vl_bt_0002", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/vl_bt_0002.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[vl_bt_0002] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 정합성 배치 결과 [vl_bt_0002] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[vl_bt_0002] 배치 시작 date=%s", biz_date); + + rc = vl_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[vl_bt_0002] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_vl_bt_0002(biz_date); + + vl_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[vl_bt_0002] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/vl_bt_0002.pgc b/app/batch/vl_bt_0002.pgc new file mode 100644 index 0000000..21a9398 --- /dev/null +++ b/app/batch/vl_bt_0002.pgc @@ -0,0 +1,138 @@ +/* @tier medium @module vl @transform validation-batch */ +/* + * vl_bt_0002.pgc - 정합성 배치 (커서 순회 + 상태전이) [tier=medium] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: vl_bt_0002 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "vl_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_vl_bt_0002(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_vl_bt_0002 CURSOR FOR + SELECT key, merch_id, amount + FROM vl_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_vl_bt_0002; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_vl_bt_0002"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[vl_bt_0002] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_vl_bt_0002 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_vl_bt_0002"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, VL_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, VL_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = vl_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[vl_bt_0002] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_vl_bt_0002; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[vl_bt_0002] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 정합성 배치 결과 [vl_bt_0002] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[vl_bt_0002] 배치 시작 date=%s", biz_date); + + rc = vl_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[vl_bt_0002] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_vl_bt_0002(biz_date); + + vl_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[vl_bt_0002] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/vl_bt_0003.c b/app/batch/vl_bt_0003.c new file mode 100644 index 0000000..77ac4a5 --- /dev/null +++ b/app/batch/vl_bt_0003.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/vl_bt_0003.pgc" +/* @tier easy @module vl @transform validation-batch */ +/* + * vl_bt_0003.pgc - 정합성 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: vl_bt_0003 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "vl_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/vl_bt_0003.pgc" + + +static int run_vl_bt_0003(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/vl_bt_0003.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/vl_bt_0003.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/vl_bt_0003.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/vl_bt_0003.pgc" + long h_amount ; + +#line 28 "app/batch/vl_bt_0003.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/vl_bt_0003.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_vl_bt_0003 cursor for select key , merch_id , amount from vl_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/vl_bt_0003.pgc" + +#line 42 "app/batch/vl_bt_0003.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_vl_bt_0003 cursor for select key , merch_id , amount from vl_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/vl_bt_0003.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_vl_bt_0003"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[vl_bt_0003] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_vl_bt_0003", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/vl_bt_0003.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_vl_bt_0003"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, VL_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, VL_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = vl_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[vl_bt_0003] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_vl_bt_0003", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/vl_bt_0003.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[vl_bt_0003] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 정합성 배치 결과 [vl_bt_0003] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[vl_bt_0003] 배치 시작 date=%s", biz_date); + + rc = vl_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[vl_bt_0003] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_vl_bt_0003(biz_date); + + vl_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[vl_bt_0003] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/vl_bt_0003.pgc b/app/batch/vl_bt_0003.pgc new file mode 100644 index 0000000..c06d737 --- /dev/null +++ b/app/batch/vl_bt_0003.pgc @@ -0,0 +1,138 @@ +/* @tier easy @module vl @transform validation-batch */ +/* + * vl_bt_0003.pgc - 정합성 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: vl_bt_0003 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "vl_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_vl_bt_0003(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_vl_bt_0003 CURSOR FOR + SELECT key, merch_id, amount + FROM vl_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_vl_bt_0003; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_vl_bt_0003"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[vl_bt_0003] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_vl_bt_0003 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_vl_bt_0003"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, VL_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, VL_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = vl_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[vl_bt_0003] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_vl_bt_0003; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[vl_bt_0003] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 정합성 배치 결과 [vl_bt_0003] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[vl_bt_0003] 배치 시작 date=%s", biz_date); + + rc = vl_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[vl_bt_0003] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_vl_bt_0003(biz_date); + + vl_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[vl_bt_0003] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/vl_bt_0004.c b/app/batch/vl_bt_0004.c new file mode 100644 index 0000000..6600257 --- /dev/null +++ b/app/batch/vl_bt_0004.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/vl_bt_0004.pgc" +/* @tier hard @module vl @transform validation-batch */ +/* + * vl_bt_0004.pgc - 정합성 배치 (커서 순회 + 상태전이) [tier=hard] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: vl_bt_0004 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "vl_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/vl_bt_0004.pgc" + + +static int run_vl_bt_0004(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/vl_bt_0004.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/vl_bt_0004.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/vl_bt_0004.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/vl_bt_0004.pgc" + long h_amount ; + +#line 28 "app/batch/vl_bt_0004.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/vl_bt_0004.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_vl_bt_0004 cursor for select key , merch_id , amount from vl_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/vl_bt_0004.pgc" + +#line 42 "app/batch/vl_bt_0004.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_vl_bt_0004 cursor for select key , merch_id , amount from vl_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/vl_bt_0004.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_vl_bt_0004"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[vl_bt_0004] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_vl_bt_0004", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/vl_bt_0004.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_vl_bt_0004"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, VL_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, VL_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = vl_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[vl_bt_0004] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_vl_bt_0004", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/vl_bt_0004.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[vl_bt_0004] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 정합성 배치 결과 [vl_bt_0004] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[vl_bt_0004] 배치 시작 date=%s", biz_date); + + rc = vl_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[vl_bt_0004] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_vl_bt_0004(biz_date); + + vl_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[vl_bt_0004] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/vl_bt_0004.pgc b/app/batch/vl_bt_0004.pgc new file mode 100644 index 0000000..019b28f --- /dev/null +++ b/app/batch/vl_bt_0004.pgc @@ -0,0 +1,138 @@ +/* @tier hard @module vl @transform validation-batch */ +/* + * vl_bt_0004.pgc - 정합성 배치 (커서 순회 + 상태전이) [tier=hard] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: vl_bt_0004 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "vl_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_vl_bt_0004(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_vl_bt_0004 CURSOR FOR + SELECT key, merch_id, amount + FROM vl_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_vl_bt_0004; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_vl_bt_0004"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[vl_bt_0004] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_vl_bt_0004 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_vl_bt_0004"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, VL_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, VL_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = vl_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[vl_bt_0004] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_vl_bt_0004; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[vl_bt_0004] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 정합성 배치 결과 [vl_bt_0004] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[vl_bt_0004] 배치 시작 date=%s", biz_date); + + rc = vl_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[vl_bt_0004] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_vl_bt_0004(biz_date); + + vl_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[vl_bt_0004] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/vl_bt_0005.c b/app/batch/vl_bt_0005.c new file mode 100644 index 0000000..7bb1fd0 --- /dev/null +++ b/app/batch/vl_bt_0005.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/vl_bt_0005.pgc" +/* @tier easy @module vl @transform validation-batch */ +/* + * vl_bt_0005.pgc - 정합성 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: vl_bt_0005 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "vl_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/vl_bt_0005.pgc" + + +static int run_vl_bt_0005(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/vl_bt_0005.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/vl_bt_0005.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/vl_bt_0005.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/vl_bt_0005.pgc" + long h_amount ; + +#line 28 "app/batch/vl_bt_0005.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/vl_bt_0005.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_vl_bt_0005 cursor for select key , merch_id , amount from vl_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/vl_bt_0005.pgc" + +#line 42 "app/batch/vl_bt_0005.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_vl_bt_0005 cursor for select key , merch_id , amount from vl_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/vl_bt_0005.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_vl_bt_0005"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[vl_bt_0005] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_vl_bt_0005", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/vl_bt_0005.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_vl_bt_0005"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, VL_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, VL_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = vl_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[vl_bt_0005] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_vl_bt_0005", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/vl_bt_0005.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[vl_bt_0005] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 정합성 배치 결과 [vl_bt_0005] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[vl_bt_0005] 배치 시작 date=%s", biz_date); + + rc = vl_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[vl_bt_0005] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_vl_bt_0005(biz_date); + + vl_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[vl_bt_0005] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/vl_bt_0005.pgc b/app/batch/vl_bt_0005.pgc new file mode 100644 index 0000000..49fdeaa --- /dev/null +++ b/app/batch/vl_bt_0005.pgc @@ -0,0 +1,138 @@ +/* @tier easy @module vl @transform validation-batch */ +/* + * vl_bt_0005.pgc - 정합성 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: vl_bt_0005 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "vl_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_vl_bt_0005(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_vl_bt_0005 CURSOR FOR + SELECT key, merch_id, amount + FROM vl_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_vl_bt_0005; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_vl_bt_0005"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[vl_bt_0005] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_vl_bt_0005 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_vl_bt_0005"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, VL_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, VL_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = vl_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[vl_bt_0005] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_vl_bt_0005; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[vl_bt_0005] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 정합성 배치 결과 [vl_bt_0005] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[vl_bt_0005] 배치 시작 date=%s", biz_date); + + rc = vl_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[vl_bt_0005] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_vl_bt_0005(biz_date); + + vl_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[vl_bt_0005] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/vl_bt_0006.c b/app/batch/vl_bt_0006.c new file mode 100644 index 0000000..783b8f3 --- /dev/null +++ b/app/batch/vl_bt_0006.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/vl_bt_0006.pgc" +/* @tier hard @module vl @transform validation-batch */ +/* + * vl_bt_0006.pgc - 정합성 배치 (커서 순회 + 상태전이) [tier=hard] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: vl_bt_0006 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "vl_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/vl_bt_0006.pgc" + + +static int run_vl_bt_0006(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/vl_bt_0006.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/vl_bt_0006.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/vl_bt_0006.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/vl_bt_0006.pgc" + long h_amount ; + +#line 28 "app/batch/vl_bt_0006.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/vl_bt_0006.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_vl_bt_0006 cursor for select key , merch_id , amount from vl_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/vl_bt_0006.pgc" + +#line 42 "app/batch/vl_bt_0006.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_vl_bt_0006 cursor for select key , merch_id , amount from vl_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/vl_bt_0006.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_vl_bt_0006"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[vl_bt_0006] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_vl_bt_0006", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/vl_bt_0006.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_vl_bt_0006"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, VL_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, VL_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = vl_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[vl_bt_0006] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_vl_bt_0006", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/vl_bt_0006.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[vl_bt_0006] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 정합성 배치 결과 [vl_bt_0006] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[vl_bt_0006] 배치 시작 date=%s", biz_date); + + rc = vl_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[vl_bt_0006] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_vl_bt_0006(biz_date); + + vl_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[vl_bt_0006] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/vl_bt_0006.pgc b/app/batch/vl_bt_0006.pgc new file mode 100644 index 0000000..cbbecee --- /dev/null +++ b/app/batch/vl_bt_0006.pgc @@ -0,0 +1,138 @@ +/* @tier hard @module vl @transform validation-batch */ +/* + * vl_bt_0006.pgc - 정합성 배치 (커서 순회 + 상태전이) [tier=hard] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: vl_bt_0006 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "vl_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_vl_bt_0006(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_vl_bt_0006 CURSOR FOR + SELECT key, merch_id, amount + FROM vl_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_vl_bt_0006; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_vl_bt_0006"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[vl_bt_0006] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_vl_bt_0006 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_vl_bt_0006"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, VL_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, VL_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = vl_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[vl_bt_0006] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_vl_bt_0006; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[vl_bt_0006] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 정합성 배치 결과 [vl_bt_0006] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[vl_bt_0006] 배치 시작 date=%s", biz_date); + + rc = vl_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[vl_bt_0006] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_vl_bt_0006(biz_date); + + vl_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[vl_bt_0006] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/vl_bt_0007.c b/app/batch/vl_bt_0007.c new file mode 100644 index 0000000..81cda0a --- /dev/null +++ b/app/batch/vl_bt_0007.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/vl_bt_0007.pgc" +/* @tier easy @module vl @transform validation-batch */ +/* + * vl_bt_0007.pgc - 정합성 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: vl_bt_0007 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "vl_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/vl_bt_0007.pgc" + + +static int run_vl_bt_0007(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/vl_bt_0007.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/vl_bt_0007.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/vl_bt_0007.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/vl_bt_0007.pgc" + long h_amount ; + +#line 28 "app/batch/vl_bt_0007.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/vl_bt_0007.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_vl_bt_0007 cursor for select key , merch_id , amount from vl_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/vl_bt_0007.pgc" + +#line 42 "app/batch/vl_bt_0007.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_vl_bt_0007 cursor for select key , merch_id , amount from vl_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/vl_bt_0007.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_vl_bt_0007"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[vl_bt_0007] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_vl_bt_0007", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/vl_bt_0007.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_vl_bt_0007"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, VL_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, VL_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = vl_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[vl_bt_0007] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_vl_bt_0007", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/vl_bt_0007.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[vl_bt_0007] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 정합성 배치 결과 [vl_bt_0007] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[vl_bt_0007] 배치 시작 date=%s", biz_date); + + rc = vl_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[vl_bt_0007] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_vl_bt_0007(biz_date); + + vl_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[vl_bt_0007] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/vl_bt_0007.pgc b/app/batch/vl_bt_0007.pgc new file mode 100644 index 0000000..9f0d391 --- /dev/null +++ b/app/batch/vl_bt_0007.pgc @@ -0,0 +1,138 @@ +/* @tier easy @module vl @transform validation-batch */ +/* + * vl_bt_0007.pgc - 정합성 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: vl_bt_0007 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "vl_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_vl_bt_0007(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_vl_bt_0007 CURSOR FOR + SELECT key, merch_id, amount + FROM vl_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_vl_bt_0007; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_vl_bt_0007"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[vl_bt_0007] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_vl_bt_0007 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_vl_bt_0007"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, VL_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, VL_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = vl_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[vl_bt_0007] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_vl_bt_0007; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[vl_bt_0007] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 정합성 배치 결과 [vl_bt_0007] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[vl_bt_0007] 배치 시작 date=%s", biz_date); + + rc = vl_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[vl_bt_0007] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_vl_bt_0007(biz_date); + + vl_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[vl_bt_0007] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/vl_bt_0008.c b/app/batch/vl_bt_0008.c new file mode 100644 index 0000000..746c4f8 --- /dev/null +++ b/app/batch/vl_bt_0008.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/vl_bt_0008.pgc" +/* @tier easy @module vl @transform validation-batch */ +/* + * vl_bt_0008.pgc - 정합성 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: vl_bt_0008 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "vl_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/vl_bt_0008.pgc" + + +static int run_vl_bt_0008(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/vl_bt_0008.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/vl_bt_0008.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/vl_bt_0008.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/vl_bt_0008.pgc" + long h_amount ; + +#line 28 "app/batch/vl_bt_0008.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/vl_bt_0008.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_vl_bt_0008 cursor for select key , merch_id , amount from vl_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/vl_bt_0008.pgc" + +#line 42 "app/batch/vl_bt_0008.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_vl_bt_0008 cursor for select key , merch_id , amount from vl_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/vl_bt_0008.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_vl_bt_0008"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[vl_bt_0008] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_vl_bt_0008", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/vl_bt_0008.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_vl_bt_0008"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, VL_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, VL_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = vl_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[vl_bt_0008] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_vl_bt_0008", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/vl_bt_0008.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[vl_bt_0008] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 정합성 배치 결과 [vl_bt_0008] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[vl_bt_0008] 배치 시작 date=%s", biz_date); + + rc = vl_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[vl_bt_0008] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_vl_bt_0008(biz_date); + + vl_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[vl_bt_0008] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/vl_bt_0008.pgc b/app/batch/vl_bt_0008.pgc new file mode 100644 index 0000000..a73ca66 --- /dev/null +++ b/app/batch/vl_bt_0008.pgc @@ -0,0 +1,138 @@ +/* @tier easy @module vl @transform validation-batch */ +/* + * vl_bt_0008.pgc - 정합성 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: vl_bt_0008 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "vl_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_vl_bt_0008(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_vl_bt_0008 CURSOR FOR + SELECT key, merch_id, amount + FROM vl_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_vl_bt_0008; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_vl_bt_0008"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[vl_bt_0008] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_vl_bt_0008 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_vl_bt_0008"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, VL_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, VL_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = vl_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[vl_bt_0008] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_vl_bt_0008; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[vl_bt_0008] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 정합성 배치 결과 [vl_bt_0008] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[vl_bt_0008] 배치 시작 date=%s", biz_date); + + rc = vl_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[vl_bt_0008] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_vl_bt_0008(biz_date); + + vl_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[vl_bt_0008] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/vl_bt_0009.c b/app/batch/vl_bt_0009.c new file mode 100644 index 0000000..61c09b5 --- /dev/null +++ b/app/batch/vl_bt_0009.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/vl_bt_0009.pgc" +/* @tier medium @module vl @transform validation-batch */ +/* + * vl_bt_0009.pgc - 정합성 배치 (커서 순회 + 상태전이) [tier=medium] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: vl_bt_0009 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "vl_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/vl_bt_0009.pgc" + + +static int run_vl_bt_0009(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/vl_bt_0009.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/vl_bt_0009.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/vl_bt_0009.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/vl_bt_0009.pgc" + long h_amount ; + +#line 28 "app/batch/vl_bt_0009.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/vl_bt_0009.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_vl_bt_0009 cursor for select key , merch_id , amount from vl_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/vl_bt_0009.pgc" + +#line 42 "app/batch/vl_bt_0009.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_vl_bt_0009 cursor for select key , merch_id , amount from vl_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/vl_bt_0009.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_vl_bt_0009"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[vl_bt_0009] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_vl_bt_0009", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/vl_bt_0009.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_vl_bt_0009"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, VL_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, VL_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = vl_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[vl_bt_0009] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_vl_bt_0009", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/vl_bt_0009.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[vl_bt_0009] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 정합성 배치 결과 [vl_bt_0009] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[vl_bt_0009] 배치 시작 date=%s", biz_date); + + rc = vl_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[vl_bt_0009] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_vl_bt_0009(biz_date); + + vl_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[vl_bt_0009] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/vl_bt_0009.pgc b/app/batch/vl_bt_0009.pgc new file mode 100644 index 0000000..8e917ef --- /dev/null +++ b/app/batch/vl_bt_0009.pgc @@ -0,0 +1,138 @@ +/* @tier medium @module vl @transform validation-batch */ +/* + * vl_bt_0009.pgc - 정합성 배치 (커서 순회 + 상태전이) [tier=medium] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: vl_bt_0009 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "vl_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_vl_bt_0009(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_vl_bt_0009 CURSOR FOR + SELECT key, merch_id, amount + FROM vl_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_vl_bt_0009; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_vl_bt_0009"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[vl_bt_0009] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_vl_bt_0009 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_vl_bt_0009"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, VL_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, VL_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = vl_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[vl_bt_0009] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_vl_bt_0009; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[vl_bt_0009] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 정합성 배치 결과 [vl_bt_0009] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[vl_bt_0009] 배치 시작 date=%s", biz_date); + + rc = vl_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[vl_bt_0009] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_vl_bt_0009(biz_date); + + vl_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[vl_bt_0009] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/vl_bt_0010.c b/app/batch/vl_bt_0010.c new file mode 100644 index 0000000..81c7cb9 --- /dev/null +++ b/app/batch/vl_bt_0010.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/vl_bt_0010.pgc" +/* @tier easy @module vl @transform validation-batch */ +/* + * vl_bt_0010.pgc - 정합성 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: vl_bt_0010 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "vl_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/vl_bt_0010.pgc" + + +static int run_vl_bt_0010(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/vl_bt_0010.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/vl_bt_0010.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/vl_bt_0010.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/vl_bt_0010.pgc" + long h_amount ; + +#line 28 "app/batch/vl_bt_0010.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/vl_bt_0010.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_vl_bt_0010 cursor for select key , merch_id , amount from vl_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/vl_bt_0010.pgc" + +#line 42 "app/batch/vl_bt_0010.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_vl_bt_0010 cursor for select key , merch_id , amount from vl_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/vl_bt_0010.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_vl_bt_0010"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[vl_bt_0010] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_vl_bt_0010", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/vl_bt_0010.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_vl_bt_0010"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, VL_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, VL_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = vl_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[vl_bt_0010] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_vl_bt_0010", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/vl_bt_0010.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[vl_bt_0010] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 정합성 배치 결과 [vl_bt_0010] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[vl_bt_0010] 배치 시작 date=%s", biz_date); + + rc = vl_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[vl_bt_0010] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_vl_bt_0010(biz_date); + + vl_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[vl_bt_0010] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/vl_bt_0010.pgc b/app/batch/vl_bt_0010.pgc new file mode 100644 index 0000000..d52e113 --- /dev/null +++ b/app/batch/vl_bt_0010.pgc @@ -0,0 +1,138 @@ +/* @tier easy @module vl @transform validation-batch */ +/* + * vl_bt_0010.pgc - 정합성 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: vl_bt_0010 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "vl_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_vl_bt_0010(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_vl_bt_0010 CURSOR FOR + SELECT key, merch_id, amount + FROM vl_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_vl_bt_0010; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_vl_bt_0010"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[vl_bt_0010] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_vl_bt_0010 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_vl_bt_0010"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, VL_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, VL_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = vl_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[vl_bt_0010] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_vl_bt_0010; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[vl_bt_0010] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 정합성 배치 결과 [vl_bt_0010] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[vl_bt_0010] 배치 시작 date=%s", biz_date); + + rc = vl_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[vl_bt_0010] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_vl_bt_0010(biz_date); + + vl_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[vl_bt_0010] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/vl_bt_0011.c b/app/batch/vl_bt_0011.c new file mode 100644 index 0000000..0399fba --- /dev/null +++ b/app/batch/vl_bt_0011.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/vl_bt_0011.pgc" +/* @tier medium @module vl @transform validation-batch */ +/* + * vl_bt_0011.pgc - 정합성 배치 (커서 순회 + 상태전이) [tier=medium] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: vl_bt_0011 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "vl_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/vl_bt_0011.pgc" + + +static int run_vl_bt_0011(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/vl_bt_0011.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/vl_bt_0011.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/vl_bt_0011.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/vl_bt_0011.pgc" + long h_amount ; + +#line 28 "app/batch/vl_bt_0011.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/vl_bt_0011.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_vl_bt_0011 cursor for select key , merch_id , amount from vl_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/vl_bt_0011.pgc" + +#line 42 "app/batch/vl_bt_0011.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_vl_bt_0011 cursor for select key , merch_id , amount from vl_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/vl_bt_0011.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_vl_bt_0011"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[vl_bt_0011] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_vl_bt_0011", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/vl_bt_0011.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_vl_bt_0011"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, VL_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, VL_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = vl_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[vl_bt_0011] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_vl_bt_0011", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/vl_bt_0011.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[vl_bt_0011] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 정합성 배치 결과 [vl_bt_0011] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[vl_bt_0011] 배치 시작 date=%s", biz_date); + + rc = vl_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[vl_bt_0011] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_vl_bt_0011(biz_date); + + vl_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[vl_bt_0011] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/vl_bt_0011.pgc b/app/batch/vl_bt_0011.pgc new file mode 100644 index 0000000..ebcff9f --- /dev/null +++ b/app/batch/vl_bt_0011.pgc @@ -0,0 +1,138 @@ +/* @tier medium @module vl @transform validation-batch */ +/* + * vl_bt_0011.pgc - 정합성 배치 (커서 순회 + 상태전이) [tier=medium] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: vl_bt_0011 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "vl_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_vl_bt_0011(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_vl_bt_0011 CURSOR FOR + SELECT key, merch_id, amount + FROM vl_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_vl_bt_0011; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_vl_bt_0011"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[vl_bt_0011] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_vl_bt_0011 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_vl_bt_0011"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, VL_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, VL_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = vl_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[vl_bt_0011] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_vl_bt_0011; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[vl_bt_0011] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 정합성 배치 결과 [vl_bt_0011] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[vl_bt_0011] 배치 시작 date=%s", biz_date); + + rc = vl_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[vl_bt_0011] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_vl_bt_0011(biz_date); + + vl_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[vl_bt_0011] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/vl_bt_0012.c b/app/batch/vl_bt_0012.c new file mode 100644 index 0000000..68f9b6e --- /dev/null +++ b/app/batch/vl_bt_0012.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/vl_bt_0012.pgc" +/* @tier easy @module vl @transform validation-batch */ +/* + * vl_bt_0012.pgc - 정합성 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: vl_bt_0012 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "vl_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/vl_bt_0012.pgc" + + +static int run_vl_bt_0012(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/vl_bt_0012.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/vl_bt_0012.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/vl_bt_0012.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/vl_bt_0012.pgc" + long h_amount ; + +#line 28 "app/batch/vl_bt_0012.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/vl_bt_0012.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_vl_bt_0012 cursor for select key , merch_id , amount from vl_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/vl_bt_0012.pgc" + +#line 42 "app/batch/vl_bt_0012.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_vl_bt_0012 cursor for select key , merch_id , amount from vl_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/vl_bt_0012.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_vl_bt_0012"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[vl_bt_0012] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_vl_bt_0012", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/vl_bt_0012.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_vl_bt_0012"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, VL_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, VL_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = vl_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[vl_bt_0012] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_vl_bt_0012", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/vl_bt_0012.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[vl_bt_0012] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 정합성 배치 결과 [vl_bt_0012] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[vl_bt_0012] 배치 시작 date=%s", biz_date); + + rc = vl_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[vl_bt_0012] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_vl_bt_0012(biz_date); + + vl_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[vl_bt_0012] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/vl_bt_0012.pgc b/app/batch/vl_bt_0012.pgc new file mode 100644 index 0000000..a8d10a8 --- /dev/null +++ b/app/batch/vl_bt_0012.pgc @@ -0,0 +1,138 @@ +/* @tier easy @module vl @transform validation-batch */ +/* + * vl_bt_0012.pgc - 정합성 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: vl_bt_0012 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "vl_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_vl_bt_0012(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_vl_bt_0012 CURSOR FOR + SELECT key, merch_id, amount + FROM vl_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_vl_bt_0012; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_vl_bt_0012"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[vl_bt_0012] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_vl_bt_0012 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_vl_bt_0012"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, VL_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, VL_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = vl_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[vl_bt_0012] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_vl_bt_0012; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[vl_bt_0012] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 정합성 배치 결과 [vl_bt_0012] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[vl_bt_0012] 배치 시작 date=%s", biz_date); + + rc = vl_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[vl_bt_0012] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_vl_bt_0012(biz_date); + + vl_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[vl_bt_0012] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/vl_bt_0013.c b/app/batch/vl_bt_0013.c new file mode 100644 index 0000000..fbece86 --- /dev/null +++ b/app/batch/vl_bt_0013.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/vl_bt_0013.pgc" +/* @tier medium @module vl @transform validation-batch */ +/* + * vl_bt_0013.pgc - 정합성 배치 (커서 순회 + 상태전이) [tier=medium] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: vl_bt_0013 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "vl_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/vl_bt_0013.pgc" + + +static int run_vl_bt_0013(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/vl_bt_0013.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/vl_bt_0013.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/vl_bt_0013.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/vl_bt_0013.pgc" + long h_amount ; + +#line 28 "app/batch/vl_bt_0013.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/vl_bt_0013.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_vl_bt_0013 cursor for select key , merch_id , amount from vl_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/vl_bt_0013.pgc" + +#line 42 "app/batch/vl_bt_0013.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_vl_bt_0013 cursor for select key , merch_id , amount from vl_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/vl_bt_0013.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_vl_bt_0013"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[vl_bt_0013] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_vl_bt_0013", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/vl_bt_0013.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_vl_bt_0013"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, VL_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, VL_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = vl_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[vl_bt_0013] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_vl_bt_0013", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/vl_bt_0013.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[vl_bt_0013] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 정합성 배치 결과 [vl_bt_0013] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[vl_bt_0013] 배치 시작 date=%s", biz_date); + + rc = vl_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[vl_bt_0013] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_vl_bt_0013(biz_date); + + vl_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[vl_bt_0013] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/vl_bt_0013.pgc b/app/batch/vl_bt_0013.pgc new file mode 100644 index 0000000..ac5bde0 --- /dev/null +++ b/app/batch/vl_bt_0013.pgc @@ -0,0 +1,138 @@ +/* @tier medium @module vl @transform validation-batch */ +/* + * vl_bt_0013.pgc - 정합성 배치 (커서 순회 + 상태전이) [tier=medium] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: vl_bt_0013 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "vl_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_vl_bt_0013(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_vl_bt_0013 CURSOR FOR + SELECT key, merch_id, amount + FROM vl_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_vl_bt_0013; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_vl_bt_0013"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[vl_bt_0013] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_vl_bt_0013 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_vl_bt_0013"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, VL_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, VL_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = vl_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[vl_bt_0013] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_vl_bt_0013; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[vl_bt_0013] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 정합성 배치 결과 [vl_bt_0013] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[vl_bt_0013] 배치 시작 date=%s", biz_date); + + rc = vl_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[vl_bt_0013] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_vl_bt_0013(biz_date); + + vl_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[vl_bt_0013] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/vl_bt_0014.c b/app/batch/vl_bt_0014.c new file mode 100644 index 0000000..1a48f07 --- /dev/null +++ b/app/batch/vl_bt_0014.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/vl_bt_0014.pgc" +/* @tier easy @module vl @transform validation-batch */ +/* + * vl_bt_0014.pgc - 정합성 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: vl_bt_0014 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "vl_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/vl_bt_0014.pgc" + + +static int run_vl_bt_0014(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/vl_bt_0014.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/vl_bt_0014.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/vl_bt_0014.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/vl_bt_0014.pgc" + long h_amount ; + +#line 28 "app/batch/vl_bt_0014.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/vl_bt_0014.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_vl_bt_0014 cursor for select key , merch_id , amount from vl_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/vl_bt_0014.pgc" + +#line 42 "app/batch/vl_bt_0014.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_vl_bt_0014 cursor for select key , merch_id , amount from vl_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/vl_bt_0014.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_vl_bt_0014"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[vl_bt_0014] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_vl_bt_0014", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/vl_bt_0014.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_vl_bt_0014"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, VL_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, VL_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = vl_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[vl_bt_0014] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_vl_bt_0014", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/vl_bt_0014.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[vl_bt_0014] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 정합성 배치 결과 [vl_bt_0014] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[vl_bt_0014] 배치 시작 date=%s", biz_date); + + rc = vl_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[vl_bt_0014] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_vl_bt_0014(biz_date); + + vl_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[vl_bt_0014] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/vl_bt_0014.pgc b/app/batch/vl_bt_0014.pgc new file mode 100644 index 0000000..f844886 --- /dev/null +++ b/app/batch/vl_bt_0014.pgc @@ -0,0 +1,138 @@ +/* @tier easy @module vl @transform validation-batch */ +/* + * vl_bt_0014.pgc - 정합성 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: vl_bt_0014 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "vl_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_vl_bt_0014(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_vl_bt_0014 CURSOR FOR + SELECT key, merch_id, amount + FROM vl_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_vl_bt_0014; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_vl_bt_0014"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[vl_bt_0014] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_vl_bt_0014 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_vl_bt_0014"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, VL_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, VL_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = vl_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[vl_bt_0014] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_vl_bt_0014; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[vl_bt_0014] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 정합성 배치 결과 [vl_bt_0014] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[vl_bt_0014] 배치 시작 date=%s", biz_date); + + rc = vl_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[vl_bt_0014] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_vl_bt_0014(biz_date); + + vl_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[vl_bt_0014] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/vl_bt_0015.c b/app/batch/vl_bt_0015.c new file mode 100644 index 0000000..7a3e1a6 --- /dev/null +++ b/app/batch/vl_bt_0015.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/vl_bt_0015.pgc" +/* @tier hard @module vl @transform validation-batch */ +/* + * vl_bt_0015.pgc - 정합성 배치 (커서 순회 + 상태전이) [tier=hard] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: vl_bt_0015 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "vl_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/vl_bt_0015.pgc" + + +static int run_vl_bt_0015(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/vl_bt_0015.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/vl_bt_0015.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/vl_bt_0015.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/vl_bt_0015.pgc" + long h_amount ; + +#line 28 "app/batch/vl_bt_0015.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/vl_bt_0015.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_vl_bt_0015 cursor for select key , merch_id , amount from vl_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/vl_bt_0015.pgc" + +#line 42 "app/batch/vl_bt_0015.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_vl_bt_0015 cursor for select key , merch_id , amount from vl_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/vl_bt_0015.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_vl_bt_0015"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[vl_bt_0015] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_vl_bt_0015", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/vl_bt_0015.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_vl_bt_0015"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, VL_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, VL_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = vl_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[vl_bt_0015] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_vl_bt_0015", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/vl_bt_0015.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[vl_bt_0015] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 정합성 배치 결과 [vl_bt_0015] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[vl_bt_0015] 배치 시작 date=%s", biz_date); + + rc = vl_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[vl_bt_0015] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_vl_bt_0015(biz_date); + + vl_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[vl_bt_0015] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/vl_bt_0015.pgc b/app/batch/vl_bt_0015.pgc new file mode 100644 index 0000000..de4a899 --- /dev/null +++ b/app/batch/vl_bt_0015.pgc @@ -0,0 +1,138 @@ +/* @tier hard @module vl @transform validation-batch */ +/* + * vl_bt_0015.pgc - 정합성 배치 (커서 순회 + 상태전이) [tier=hard] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: vl_bt_0015 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "vl_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_vl_bt_0015(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_vl_bt_0015 CURSOR FOR + SELECT key, merch_id, amount + FROM vl_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_vl_bt_0015; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_vl_bt_0015"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[vl_bt_0015] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_vl_bt_0015 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_vl_bt_0015"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, VL_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, VL_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = vl_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[vl_bt_0015] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_vl_bt_0015; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[vl_bt_0015] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 정합성 배치 결과 [vl_bt_0015] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[vl_bt_0015] 배치 시작 date=%s", biz_date); + + rc = vl_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[vl_bt_0015] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_vl_bt_0015(biz_date); + + vl_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[vl_bt_0015] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/vl_bt_0016.c b/app/batch/vl_bt_0016.c new file mode 100644 index 0000000..8a89c5a --- /dev/null +++ b/app/batch/vl_bt_0016.c @@ -0,0 +1,247 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/batch/vl_bt_0016.pgc" +/* @tier easy @module vl @transform validation-batch */ +/* + * vl_bt_0016.pgc - 정합성 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: vl_bt_0016 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "vl_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 19 "app/batch/vl_bt_0016.pgc" + + +static int run_vl_bt_0016(const char *biz_date) +{ + /* exec sql begin declare section */ + + + + + + +#line 24 "app/batch/vl_bt_0016.pgc" + char h_biz_date [ 9 ] ; + +#line 25 "app/batch/vl_bt_0016.pgc" + char h_key [ 16 ] ; + +#line 26 "app/batch/vl_bt_0016.pgc" + char h_merch_id [ 16 ] ; + +#line 27 "app/batch/vl_bt_0016.pgc" + long h_amount ; + +#line 28 "app/batch/vl_bt_0016.pgc" + char h_new_status [ 2 ] ; +/* exec sql end declare section */ +#line 29 "app/batch/vl_bt_0016.pgc" + + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + ECPGset_var( 0, ( h_biz_date ), __LINE__);\ + /* declare cur_vl_bt_0016 cursor for select key , merch_id , amount from vl_ledger where biz_date = $1 and status = 'R' order by key */ +#line 42 "app/batch/vl_bt_0016.pgc" + +#line 42 "app/batch/vl_bt_0016.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_vl_bt_0016 cursor for select key , merch_id , amount from vl_ledger where biz_date = $1 and status = 'R' order by key", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 44 "app/batch/vl_bt_0016.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_vl_bt_0016"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[vl_bt_0016] tx_begin 경고"); + + for (;;) { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_vl_bt_0016", ECPGt_EOIT, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 54 "app/batch/vl_bt_0016.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_vl_bt_0016"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, VL_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, VL_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = vl_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[vl_bt_0016] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_vl_bt_0016", ECPGt_EOIT, ECPGt_EORT);} +#line 82 "app/batch/vl_bt_0016.pgc" + + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[vl_bt_0016] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 정합성 배치 결과 [vl_bt_0016] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[vl_bt_0016] 배치 시작 date=%s", biz_date); + + rc = vl_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[vl_bt_0016] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_vl_bt_0016(biz_date); + + vl_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[vl_bt_0016] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/batch/vl_bt_0016.pgc b/app/batch/vl_bt_0016.pgc new file mode 100644 index 0000000..dca306f --- /dev/null +++ b/app/batch/vl_bt_0016.pgc @@ -0,0 +1,138 @@ +/* @tier easy @module vl @transform validation-batch */ +/* + * vl_bt_0016.pgc - 정합성 배치 (커서 순회 + 상태전이) [tier=easy] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: vl_bt_0016 [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "vl_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_vl_bt_0016(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_vl_bt_0016 CURSOR FOR + SELECT key, merch_id, amount + FROM vl_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_vl_bt_0016; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_vl_bt_0016"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[vl_bt_0016] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_vl_bt_0016 INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_vl_bt_0016"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, VL_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, VL_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = vl_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[vl_bt_0016] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_vl_bt_0016; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[vl_bt_0016] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== 정합성 배치 결과 [vl_bt_0016] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[vl_bt_0016] 배치 시작 date=%s", biz_date); + + rc = vl_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[vl_bt_0016] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_vl_bt_0016(biz_date); + + vl_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[vl_bt_0016] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} diff --git a/app/common/ac_cu_0001.c b/app/common/ac_cu_0001.c new file mode 100644 index 0000000..6aa8373 --- /dev/null +++ b/app/common/ac_cu_0001.c @@ -0,0 +1,37 @@ +/* @tier easy @module ac @transform acquire-util */ +/* + * ac_cu_0001.c - 매입 공통 유틸리티 (plain C) [tier=easy] + */ +#include "ac_cu_0001.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long ac_cu_0001_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long ac_cu_0001_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int ac_cu_0001_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/ac_cu_0002.c b/app/common/ac_cu_0002.c new file mode 100644 index 0000000..fc53531 --- /dev/null +++ b/app/common/ac_cu_0002.c @@ -0,0 +1,37 @@ +/* @tier medium @module ac @transform acquire-util */ +/* + * ac_cu_0002.c - 매입 공통 유틸리티 (plain C) [tier=medium] + */ +#include "ac_cu_0002.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long ac_cu_0002_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long ac_cu_0002_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int ac_cu_0002_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/ac_cu_0003.c b/app/common/ac_cu_0003.c new file mode 100644 index 0000000..1149da6 --- /dev/null +++ b/app/common/ac_cu_0003.c @@ -0,0 +1,37 @@ +/* @tier easy @module ac @transform acquire-util */ +/* + * ac_cu_0003.c - 매입 공통 유틸리티 (plain C) [tier=easy] + */ +#include "ac_cu_0003.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long ac_cu_0003_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long ac_cu_0003_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int ac_cu_0003_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/ac_cu_0004.c b/app/common/ac_cu_0004.c new file mode 100644 index 0000000..42c12a8 --- /dev/null +++ b/app/common/ac_cu_0004.c @@ -0,0 +1,37 @@ +/* @tier medium @module ac @transform acquire-util */ +/* + * ac_cu_0004.c - 매입 공통 유틸리티 (plain C) [tier=medium] + */ +#include "ac_cu_0004.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long ac_cu_0004_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long ac_cu_0004_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int ac_cu_0004_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/ac_cu_0005.c b/app/common/ac_cu_0005.c new file mode 100644 index 0000000..c02a852 --- /dev/null +++ b/app/common/ac_cu_0005.c @@ -0,0 +1,37 @@ +/* @tier easy @module ac @transform acquire-util */ +/* + * ac_cu_0005.c - 매입 공통 유틸리티 (plain C) [tier=easy] + */ +#include "ac_cu_0005.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long ac_cu_0005_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long ac_cu_0005_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int ac_cu_0005_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/ac_cu_0006.c b/app/common/ac_cu_0006.c new file mode 100644 index 0000000..2b46145 --- /dev/null +++ b/app/common/ac_cu_0006.c @@ -0,0 +1,37 @@ +/* @tier hard @module ac @transform acquire-util */ +/* + * ac_cu_0006.c - 매입 공통 유틸리티 (plain C) [tier=hard] + */ +#include "ac_cu_0006.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long ac_cu_0006_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long ac_cu_0006_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int ac_cu_0006_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/ac_cu_0007.c b/app/common/ac_cu_0007.c new file mode 100644 index 0000000..182f5b1 --- /dev/null +++ b/app/common/ac_cu_0007.c @@ -0,0 +1,37 @@ +/* @tier easy @module ac @transform acquire-util */ +/* + * ac_cu_0007.c - 매입 공통 유틸리티 (plain C) [tier=easy] + */ +#include "ac_cu_0007.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long ac_cu_0007_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long ac_cu_0007_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int ac_cu_0007_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/ac_cu_0008.c b/app/common/ac_cu_0008.c new file mode 100644 index 0000000..b5fe649 --- /dev/null +++ b/app/common/ac_cu_0008.c @@ -0,0 +1,37 @@ +/* @tier hard @module ac @transform acquire-util */ +/* + * ac_cu_0008.c - 매입 공통 유틸리티 (plain C) [tier=hard] + */ +#include "ac_cu_0008.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long ac_cu_0008_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long ac_cu_0008_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int ac_cu_0008_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/ac_cu_0009.c b/app/common/ac_cu_0009.c new file mode 100644 index 0000000..f461662 --- /dev/null +++ b/app/common/ac_cu_0009.c @@ -0,0 +1,37 @@ +/* @tier easy @module ac @transform acquire-util */ +/* + * ac_cu_0009.c - 매입 공통 유틸리티 (plain C) [tier=easy] + */ +#include "ac_cu_0009.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long ac_cu_0009_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long ac_cu_0009_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int ac_cu_0009_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/ac_cu_0010.c b/app/common/ac_cu_0010.c new file mode 100644 index 0000000..4b8e33d --- /dev/null +++ b/app/common/ac_cu_0010.c @@ -0,0 +1,37 @@ +/* @tier easy @module ac @transform acquire-util */ +/* + * ac_cu_0010.c - 매입 공통 유틸리티 (plain C) [tier=easy] + */ +#include "ac_cu_0010.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long ac_cu_0010_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long ac_cu_0010_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int ac_cu_0010_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/ac_cu_0011.c b/app/common/ac_cu_0011.c new file mode 100644 index 0000000..fbf5dd7 --- /dev/null +++ b/app/common/ac_cu_0011.c @@ -0,0 +1,37 @@ +/* @tier medium @module ac @transform acquire-util */ +/* + * ac_cu_0011.c - 매입 공통 유틸리티 (plain C) [tier=medium] + */ +#include "ac_cu_0011.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long ac_cu_0011_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long ac_cu_0011_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int ac_cu_0011_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/au_cu_0001.c b/app/common/au_cu_0001.c new file mode 100644 index 0000000..0af58bb --- /dev/null +++ b/app/common/au_cu_0001.c @@ -0,0 +1,37 @@ +/* @tier easy @module au @transform authorization-util */ +/* + * au_cu_0001.c - 승인한도 공통 유틸리티 (plain C) [tier=easy] + */ +#include "au_cu_0001.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long au_cu_0001_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long au_cu_0001_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int au_cu_0001_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/au_cu_0002.c b/app/common/au_cu_0002.c new file mode 100644 index 0000000..d642844 --- /dev/null +++ b/app/common/au_cu_0002.c @@ -0,0 +1,37 @@ +/* @tier medium @module au @transform authorization-util */ +/* + * au_cu_0002.c - 승인한도 공통 유틸리티 (plain C) [tier=medium] + */ +#include "au_cu_0002.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long au_cu_0002_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long au_cu_0002_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int au_cu_0002_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/au_cu_0003.c b/app/common/au_cu_0003.c new file mode 100644 index 0000000..0ffecae --- /dev/null +++ b/app/common/au_cu_0003.c @@ -0,0 +1,37 @@ +/* @tier easy @module au @transform authorization-util */ +/* + * au_cu_0003.c - 승인한도 공통 유틸리티 (plain C) [tier=easy] + */ +#include "au_cu_0003.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long au_cu_0003_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long au_cu_0003_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int au_cu_0003_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/au_cu_0004.c b/app/common/au_cu_0004.c new file mode 100644 index 0000000..a9cb353 --- /dev/null +++ b/app/common/au_cu_0004.c @@ -0,0 +1,37 @@ +/* @tier medium @module au @transform authorization-util */ +/* + * au_cu_0004.c - 승인한도 공통 유틸리티 (plain C) [tier=medium] + */ +#include "au_cu_0004.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long au_cu_0004_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long au_cu_0004_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int au_cu_0004_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/au_cu_0005.c b/app/common/au_cu_0005.c new file mode 100644 index 0000000..30ac353 --- /dev/null +++ b/app/common/au_cu_0005.c @@ -0,0 +1,37 @@ +/* @tier easy @module au @transform authorization-util */ +/* + * au_cu_0005.c - 승인한도 공통 유틸리티 (plain C) [tier=easy] + */ +#include "au_cu_0005.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long au_cu_0005_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long au_cu_0005_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int au_cu_0005_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/au_cu_0006.c b/app/common/au_cu_0006.c new file mode 100644 index 0000000..b068c18 --- /dev/null +++ b/app/common/au_cu_0006.c @@ -0,0 +1,37 @@ +/* @tier medium @module au @transform authorization-util */ +/* + * au_cu_0006.c - 승인한도 공통 유틸리티 (plain C) [tier=medium] + */ +#include "au_cu_0006.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long au_cu_0006_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long au_cu_0006_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int au_cu_0006_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/au_cu_0007.c b/app/common/au_cu_0007.c new file mode 100644 index 0000000..1845093 --- /dev/null +++ b/app/common/au_cu_0007.c @@ -0,0 +1,37 @@ +/* @tier easy @module au @transform authorization-util */ +/* + * au_cu_0007.c - 승인한도 공통 유틸리티 (plain C) [tier=easy] + */ +#include "au_cu_0007.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long au_cu_0007_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long au_cu_0007_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int au_cu_0007_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/au_cu_0008.c b/app/common/au_cu_0008.c new file mode 100644 index 0000000..1e9d751 --- /dev/null +++ b/app/common/au_cu_0008.c @@ -0,0 +1,37 @@ +/* @tier hard @module au @transform authorization-util */ +/* + * au_cu_0008.c - 승인한도 공통 유틸리티 (plain C) [tier=hard] + */ +#include "au_cu_0008.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long au_cu_0008_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long au_cu_0008_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int au_cu_0008_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/au_cu_0009.c b/app/common/au_cu_0009.c new file mode 100644 index 0000000..e235568 --- /dev/null +++ b/app/common/au_cu_0009.c @@ -0,0 +1,37 @@ +/* @tier easy @module au @transform authorization-util */ +/* + * au_cu_0009.c - 승인한도 공통 유틸리티 (plain C) [tier=easy] + */ +#include "au_cu_0009.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long au_cu_0009_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long au_cu_0009_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int au_cu_0009_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/au_cu_0010.c b/app/common/au_cu_0010.c new file mode 100644 index 0000000..06279b1 --- /dev/null +++ b/app/common/au_cu_0010.c @@ -0,0 +1,37 @@ +/* @tier easy @module au @transform authorization-util */ +/* + * au_cu_0010.c - 승인한도 공통 유틸리티 (plain C) [tier=easy] + */ +#include "au_cu_0010.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long au_cu_0010_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long au_cu_0010_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int au_cu_0010_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/au_cu_0011.c b/app/common/au_cu_0011.c new file mode 100644 index 0000000..c9a5e3c --- /dev/null +++ b/app/common/au_cu_0011.c @@ -0,0 +1,37 @@ +/* @tier medium @module au @transform authorization-util */ +/* + * au_cu_0011.c - 승인한도 공통 유틸리티 (plain C) [tier=medium] + */ +#include "au_cu_0011.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long au_cu_0011_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long au_cu_0011_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int au_cu_0011_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/cl_cu_0001.c b/app/common/cl_cu_0001.c new file mode 100644 index 0000000..6977118 --- /dev/null +++ b/app/common/cl_cu_0001.c @@ -0,0 +1,37 @@ +/* @tier easy @module cl @transform closing-util */ +/* + * cl_cu_0001.c - 마감 공통 유틸리티 (plain C) [tier=easy] + */ +#include "cl_cu_0001.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long cl_cu_0001_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long cl_cu_0001_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int cl_cu_0001_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/cl_cu_0002.c b/app/common/cl_cu_0002.c new file mode 100644 index 0000000..f450728 --- /dev/null +++ b/app/common/cl_cu_0002.c @@ -0,0 +1,37 @@ +/* @tier easy @module cl @transform closing-util */ +/* + * cl_cu_0002.c - 마감 공통 유틸리티 (plain C) [tier=easy] + */ +#include "cl_cu_0002.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long cl_cu_0002_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long cl_cu_0002_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int cl_cu_0002_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/cl_cu_0003.c b/app/common/cl_cu_0003.c new file mode 100644 index 0000000..89e861f --- /dev/null +++ b/app/common/cl_cu_0003.c @@ -0,0 +1,37 @@ +/* @tier medium @module cl @transform closing-util */ +/* + * cl_cu_0003.c - 마감 공통 유틸리티 (plain C) [tier=medium] + */ +#include "cl_cu_0003.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long cl_cu_0003_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long cl_cu_0003_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int cl_cu_0003_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/cl_cu_0004.c b/app/common/cl_cu_0004.c new file mode 100644 index 0000000..392aed4 --- /dev/null +++ b/app/common/cl_cu_0004.c @@ -0,0 +1,37 @@ +/* @tier easy @module cl @transform closing-util */ +/* + * cl_cu_0004.c - 마감 공통 유틸리티 (plain C) [tier=easy] + */ +#include "cl_cu_0004.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long cl_cu_0004_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long cl_cu_0004_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int cl_cu_0004_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/cl_cu_0005.c b/app/common/cl_cu_0005.c new file mode 100644 index 0000000..dbeb28e --- /dev/null +++ b/app/common/cl_cu_0005.c @@ -0,0 +1,37 @@ +/* @tier medium @module cl @transform closing-util */ +/* + * cl_cu_0005.c - 마감 공통 유틸리티 (plain C) [tier=medium] + */ +#include "cl_cu_0005.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long cl_cu_0005_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long cl_cu_0005_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int cl_cu_0005_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/cl_cu_0006.c b/app/common/cl_cu_0006.c new file mode 100644 index 0000000..7d6d576 --- /dev/null +++ b/app/common/cl_cu_0006.c @@ -0,0 +1,37 @@ +/* @tier easy @module cl @transform closing-util */ +/* + * cl_cu_0006.c - 마감 공통 유틸리티 (plain C) [tier=easy] + */ +#include "cl_cu_0006.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long cl_cu_0006_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long cl_cu_0006_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int cl_cu_0006_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/cl_cu_0007.c b/app/common/cl_cu_0007.c new file mode 100644 index 0000000..74953c1 --- /dev/null +++ b/app/common/cl_cu_0007.c @@ -0,0 +1,37 @@ +/* @tier medium @module cl @transform closing-util */ +/* + * cl_cu_0007.c - 마감 공통 유틸리티 (plain C) [tier=medium] + */ +#include "cl_cu_0007.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long cl_cu_0007_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long cl_cu_0007_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int cl_cu_0007_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/cl_cu_0008.c b/app/common/cl_cu_0008.c new file mode 100644 index 0000000..24fe69b --- /dev/null +++ b/app/common/cl_cu_0008.c @@ -0,0 +1,37 @@ +/* @tier easy @module cl @transform closing-util */ +/* + * cl_cu_0008.c - 마감 공통 유틸리티 (plain C) [tier=easy] + */ +#include "cl_cu_0008.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long cl_cu_0008_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long cl_cu_0008_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int cl_cu_0008_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/cl_cu_0009.c b/app/common/cl_cu_0009.c new file mode 100644 index 0000000..1876cac --- /dev/null +++ b/app/common/cl_cu_0009.c @@ -0,0 +1,37 @@ +/* @tier hard @module cl @transform closing-util */ +/* + * cl_cu_0009.c - 마감 공통 유틸리티 (plain C) [tier=hard] + */ +#include "cl_cu_0009.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long cl_cu_0009_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long cl_cu_0009_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int cl_cu_0009_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/cl_cu_0010.c b/app/common/cl_cu_0010.c new file mode 100644 index 0000000..a2d7255 --- /dev/null +++ b/app/common/cl_cu_0010.c @@ -0,0 +1,37 @@ +/* @tier easy @module cl @transform closing-util */ +/* + * cl_cu_0010.c - 마감 공통 유틸리티 (plain C) [tier=easy] + */ +#include "cl_cu_0010.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long cl_cu_0010_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long cl_cu_0010_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int cl_cu_0010_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/cm_cu_0001.c b/app/common/cm_cu_0001.c new file mode 100644 index 0000000..cdd8797 --- /dev/null +++ b/app/common/cm_cu_0001.c @@ -0,0 +1,37 @@ +/* @tier easy @module cm @transform common-util */ +/* + * cm_cu_0001.c - 공통 공통 유틸리티 (plain C) [tier=easy] + */ +#include "cm_cu_0001.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long cm_cu_0001_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long cm_cu_0001_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int cm_cu_0001_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/cm_cu_0002.c b/app/common/cm_cu_0002.c new file mode 100644 index 0000000..bb9aedf --- /dev/null +++ b/app/common/cm_cu_0002.c @@ -0,0 +1,37 @@ +/* @tier easy @module cm @transform common-util */ +/* + * cm_cu_0002.c - 공통 공통 유틸리티 (plain C) [tier=easy] + */ +#include "cm_cu_0002.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long cm_cu_0002_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long cm_cu_0002_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int cm_cu_0002_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/cm_cu_0003.c b/app/common/cm_cu_0003.c new file mode 100644 index 0000000..d666a07 --- /dev/null +++ b/app/common/cm_cu_0003.c @@ -0,0 +1,37 @@ +/* @tier medium @module cm @transform common-util */ +/* + * cm_cu_0003.c - 공통 공통 유틸리티 (plain C) [tier=medium] + */ +#include "cm_cu_0003.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long cm_cu_0003_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long cm_cu_0003_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int cm_cu_0003_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/cm_cu_0004.c b/app/common/cm_cu_0004.c new file mode 100644 index 0000000..13568b4 --- /dev/null +++ b/app/common/cm_cu_0004.c @@ -0,0 +1,37 @@ +/* @tier easy @module cm @transform common-util */ +/* + * cm_cu_0004.c - 공통 공통 유틸리티 (plain C) [tier=easy] + */ +#include "cm_cu_0004.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long cm_cu_0004_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long cm_cu_0004_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int cm_cu_0004_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/cm_cu_0005.c b/app/common/cm_cu_0005.c new file mode 100644 index 0000000..a9d0c52 --- /dev/null +++ b/app/common/cm_cu_0005.c @@ -0,0 +1,37 @@ +/* @tier medium @module cm @transform common-util */ +/* + * cm_cu_0005.c - 공통 공통 유틸리티 (plain C) [tier=medium] + */ +#include "cm_cu_0005.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long cm_cu_0005_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long cm_cu_0005_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int cm_cu_0005_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/cm_cu_0006.c b/app/common/cm_cu_0006.c new file mode 100644 index 0000000..4e71891 --- /dev/null +++ b/app/common/cm_cu_0006.c @@ -0,0 +1,37 @@ +/* @tier easy @module cm @transform common-util */ +/* + * cm_cu_0006.c - 공통 공통 유틸리티 (plain C) [tier=easy] + */ +#include "cm_cu_0006.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long cm_cu_0006_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long cm_cu_0006_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int cm_cu_0006_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/cm_cu_0007.c b/app/common/cm_cu_0007.c new file mode 100644 index 0000000..e605683 --- /dev/null +++ b/app/common/cm_cu_0007.c @@ -0,0 +1,37 @@ +/* @tier medium @module cm @transform common-util */ +/* + * cm_cu_0007.c - 공통 공통 유틸리티 (plain C) [tier=medium] + */ +#include "cm_cu_0007.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long cm_cu_0007_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long cm_cu_0007_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int cm_cu_0007_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/cm_cu_0008.c b/app/common/cm_cu_0008.c new file mode 100644 index 0000000..f1b6716 --- /dev/null +++ b/app/common/cm_cu_0008.c @@ -0,0 +1,37 @@ +/* @tier easy @module cm @transform common-util */ +/* + * cm_cu_0008.c - 공통 공통 유틸리티 (plain C) [tier=easy] + */ +#include "cm_cu_0008.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long cm_cu_0008_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long cm_cu_0008_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int cm_cu_0008_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/cm_cu_0009.c b/app/common/cm_cu_0009.c new file mode 100644 index 0000000..47051d8 --- /dev/null +++ b/app/common/cm_cu_0009.c @@ -0,0 +1,37 @@ +/* @tier hard @module cm @transform common-util */ +/* + * cm_cu_0009.c - 공통 공통 유틸리티 (plain C) [tier=hard] + */ +#include "cm_cu_0009.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long cm_cu_0009_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long cm_cu_0009_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int cm_cu_0009_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/cm_cu_0010.c b/app/common/cm_cu_0010.c new file mode 100644 index 0000000..57529c8 --- /dev/null +++ b/app/common/cm_cu_0010.c @@ -0,0 +1,37 @@ +/* @tier easy @module cm @transform common-util */ +/* + * cm_cu_0010.c - 공통 공통 유틸리티 (plain C) [tier=easy] + */ +#include "cm_cu_0010.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long cm_cu_0010_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long cm_cu_0010_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int cm_cu_0010_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/cm_cu_0011.c b/app/common/cm_cu_0011.c new file mode 100644 index 0000000..b64fc25 --- /dev/null +++ b/app/common/cm_cu_0011.c @@ -0,0 +1,37 @@ +/* @tier hard @module cm @transform common-util */ +/* + * cm_cu_0011.c - 공통 공통 유틸리티 (plain C) [tier=hard] + */ +#include "cm_cu_0011.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long cm_cu_0011_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long cm_cu_0011_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int cm_cu_0011_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/demo_ac_main.c b/app/common/demo_ac_main.c new file mode 100644 index 0000000..e1f3a15 --- /dev/null +++ b/app/common/demo_ac_main.c @@ -0,0 +1,24 @@ +/* + * demo_ac_main.c - 매입 온라인 데모 부트스트랩 (링크 검증) + * + * 생성된 플래그십 서비스(AC_OL_0001)를 TxCore 레지스트리에 등록하여 + * 등록/디스패치/DBIO 링크 경로가 실제로 연결됨을 증명한다. + */ +#include + +#include "txcore.h" + +void AC_OL_0001(TXSVCINFO *ctx); + +int main(void) +{ + tx_set_loglevel(TX_LOG_INFO); + tx_log(TX_LOG_INFO, "매입 온라인 데모 기동 (TxCore)"); + + tx_register("AC_OL_0001", AC_OL_0001); + + tx_log(TX_LOG_INFO, "등록 서비스 수 = %d", tx_service_count()); + printf("demo_ac_server 준비완료: 서비스 %d개 등록\n", + tx_service_count()); + return 0; +} diff --git a/app/common/demo_mg_main.c b/app/common/demo_mg_main.c new file mode 100644 index 0000000..468a1e9 --- /dev/null +++ b/app/common/demo_mg_main.c @@ -0,0 +1,24 @@ +/* + * demo_mg_main.c - 전문게이트웨이 온라인 데모 부트스트랩 (링크 검증) + * + * 생성된 플래그십 서비스(MG_OL_0001)를 TxCore 레지스트리에 등록하여 + * 등록/디스패치/DBIO 링크 경로가 실제로 연결됨을 증명한다. + */ +#include + +#include "txcore.h" + +void MG_OL_0001(TXSVCINFO *ctx); + +int main(void) +{ + tx_set_loglevel(TX_LOG_INFO); + tx_log(TX_LOG_INFO, "전문게이트웨이 온라인 데모 기동 (TxCore)"); + + tx_register("MG_OL_0001", MG_OL_0001); + + tx_log(TX_LOG_INFO, "등록 서비스 수 = %d", tx_service_count()); + printf("demo_mg_server 준비완료: 서비스 %d개 등록\n", + tx_service_count()); + return 0; +} diff --git a/app/common/demo_rc_main.c b/app/common/demo_rc_main.c new file mode 100644 index 0000000..d1ea73b --- /dev/null +++ b/app/common/demo_rc_main.c @@ -0,0 +1,24 @@ +/* + * demo_rc_main.c - 대사 온라인 데모 부트스트랩 (링크 검증) + * + * 생성된 플래그십 서비스(RC_OL_0001)를 TxCore 레지스트리에 등록하여 + * 등록/디스패치/DBIO 링크 경로가 실제로 연결됨을 증명한다. + */ +#include + +#include "txcore.h" + +void RC_OL_0001(TXSVCINFO *ctx); + +int main(void) +{ + tx_set_loglevel(TX_LOG_INFO); + tx_log(TX_LOG_INFO, "대사 온라인 데모 기동 (TxCore)"); + + tx_register("RC_OL_0001", RC_OL_0001); + + tx_log(TX_LOG_INFO, "등록 서비스 수 = %d", tx_service_count()); + printf("demo_rc_server 준비완료: 서비스 %d개 등록\n", + tx_service_count()); + return 0; +} diff --git a/app/common/demo_st_main.c b/app/common/demo_st_main.c new file mode 100644 index 0000000..7be9458 --- /dev/null +++ b/app/common/demo_st_main.c @@ -0,0 +1,24 @@ +/* + * demo_st_main.c - 정산수수료 온라인 데모 부트스트랩 (링크 검증) + * + * 생성된 플래그십 서비스(ST_OL_0001)를 TxCore 레지스트리에 등록하여 + * 등록/디스패치/DBIO 링크 경로가 실제로 연결됨을 증명한다. + */ +#include + +#include "txcore.h" + +void ST_OL_0001(TXSVCINFO *ctx); + +int main(void) +{ + tx_set_loglevel(TX_LOG_INFO); + tx_log(TX_LOG_INFO, "정산수수료 온라인 데모 기동 (TxCore)"); + + tx_register("ST_OL_0001", ST_OL_0001); + + tx_log(TX_LOG_INFO, "등록 서비스 수 = %d", tx_service_count()); + printf("demo_st_server 준비완료: 서비스 %d개 등록\n", + tx_service_count()); + return 0; +} diff --git a/app/common/lg_cu_0001.c b/app/common/lg_cu_0001.c new file mode 100644 index 0000000..eafa439 --- /dev/null +++ b/app/common/lg_cu_0001.c @@ -0,0 +1,37 @@ +/* @tier easy @module lg @transform ledger-util */ +/* + * lg_cu_0001.c - 원장 공통 유틸리티 (plain C) [tier=easy] + */ +#include "lg_cu_0001.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long lg_cu_0001_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long lg_cu_0001_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int lg_cu_0001_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/lg_cu_0002.c b/app/common/lg_cu_0002.c new file mode 100644 index 0000000..d4d69dd --- /dev/null +++ b/app/common/lg_cu_0002.c @@ -0,0 +1,37 @@ +/* @tier hard @module lg @transform ledger-util */ +/* + * lg_cu_0002.c - 원장 공통 유틸리티 (plain C) [tier=hard] + */ +#include "lg_cu_0002.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long lg_cu_0002_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long lg_cu_0002_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int lg_cu_0002_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/lg_cu_0003.c b/app/common/lg_cu_0003.c new file mode 100644 index 0000000..5ac4f92 --- /dev/null +++ b/app/common/lg_cu_0003.c @@ -0,0 +1,37 @@ +/* @tier easy @module lg @transform ledger-util */ +/* + * lg_cu_0003.c - 원장 공통 유틸리티 (plain C) [tier=easy] + */ +#include "lg_cu_0003.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long lg_cu_0003_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long lg_cu_0003_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int lg_cu_0003_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/lg_cu_0004.c b/app/common/lg_cu_0004.c new file mode 100644 index 0000000..4461c04 --- /dev/null +++ b/app/common/lg_cu_0004.c @@ -0,0 +1,37 @@ +/* @tier easy @module lg @transform ledger-util */ +/* + * lg_cu_0004.c - 원장 공통 유틸리티 (plain C) [tier=easy] + */ +#include "lg_cu_0004.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long lg_cu_0004_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long lg_cu_0004_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int lg_cu_0004_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/lg_cu_0005.c b/app/common/lg_cu_0005.c new file mode 100644 index 0000000..210b568 --- /dev/null +++ b/app/common/lg_cu_0005.c @@ -0,0 +1,37 @@ +/* @tier medium @module lg @transform ledger-util */ +/* + * lg_cu_0005.c - 원장 공통 유틸리티 (plain C) [tier=medium] + */ +#include "lg_cu_0005.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long lg_cu_0005_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long lg_cu_0005_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int lg_cu_0005_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/lg_cu_0006.c b/app/common/lg_cu_0006.c new file mode 100644 index 0000000..2196cbd --- /dev/null +++ b/app/common/lg_cu_0006.c @@ -0,0 +1,37 @@ +/* @tier easy @module lg @transform ledger-util */ +/* + * lg_cu_0006.c - 원장 공통 유틸리티 (plain C) [tier=easy] + */ +#include "lg_cu_0006.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long lg_cu_0006_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long lg_cu_0006_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int lg_cu_0006_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/lg_cu_0007.c b/app/common/lg_cu_0007.c new file mode 100644 index 0000000..0a025ee --- /dev/null +++ b/app/common/lg_cu_0007.c @@ -0,0 +1,37 @@ +/* @tier medium @module lg @transform ledger-util */ +/* + * lg_cu_0007.c - 원장 공통 유틸리티 (plain C) [tier=medium] + */ +#include "lg_cu_0007.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long lg_cu_0007_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long lg_cu_0007_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int lg_cu_0007_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/lg_cu_0008.c b/app/common/lg_cu_0008.c new file mode 100644 index 0000000..ccde9f7 --- /dev/null +++ b/app/common/lg_cu_0008.c @@ -0,0 +1,37 @@ +/* @tier easy @module lg @transform ledger-util */ +/* + * lg_cu_0008.c - 원장 공통 유틸리티 (plain C) [tier=easy] + */ +#include "lg_cu_0008.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long lg_cu_0008_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long lg_cu_0008_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int lg_cu_0008_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/lg_cu_0009.c b/app/common/lg_cu_0009.c new file mode 100644 index 0000000..6b5e32d --- /dev/null +++ b/app/common/lg_cu_0009.c @@ -0,0 +1,37 @@ +/* @tier medium @module lg @transform ledger-util */ +/* + * lg_cu_0009.c - 원장 공통 유틸리티 (plain C) [tier=medium] + */ +#include "lg_cu_0009.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long lg_cu_0009_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long lg_cu_0009_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int lg_cu_0009_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/lg_cu_0010.c b/app/common/lg_cu_0010.c new file mode 100644 index 0000000..a6cebbe --- /dev/null +++ b/app/common/lg_cu_0010.c @@ -0,0 +1,37 @@ +/* @tier easy @module lg @transform ledger-util */ +/* + * lg_cu_0010.c - 원장 공통 유틸리티 (plain C) [tier=easy] + */ +#include "lg_cu_0010.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long lg_cu_0010_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long lg_cu_0010_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int lg_cu_0010_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/lg_cu_0011.c b/app/common/lg_cu_0011.c new file mode 100644 index 0000000..8088565 --- /dev/null +++ b/app/common/lg_cu_0011.c @@ -0,0 +1,37 @@ +/* @tier hard @module lg @transform ledger-util */ +/* + * lg_cu_0011.c - 원장 공통 유틸리티 (plain C) [tier=hard] + */ +#include "lg_cu_0011.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long lg_cu_0011_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long lg_cu_0011_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int lg_cu_0011_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/mg_cu_0001.c b/app/common/mg_cu_0001.c new file mode 100644 index 0000000..2cfe9c2 --- /dev/null +++ b/app/common/mg_cu_0001.c @@ -0,0 +1,37 @@ +/* @tier easy @module mg @transform msg-gateway-util */ +/* + * mg_cu_0001.c - 전문게이트웨이 공통 유틸리티 (plain C) [tier=easy] + */ +#include "mg_cu_0001.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long mg_cu_0001_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long mg_cu_0001_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int mg_cu_0001_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/mg_cu_0002.c b/app/common/mg_cu_0002.c new file mode 100644 index 0000000..6b1d90e --- /dev/null +++ b/app/common/mg_cu_0002.c @@ -0,0 +1,37 @@ +/* @tier medium @module mg @transform msg-gateway-util */ +/* + * mg_cu_0002.c - 전문게이트웨이 공통 유틸리티 (plain C) [tier=medium] + */ +#include "mg_cu_0002.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long mg_cu_0002_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long mg_cu_0002_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int mg_cu_0002_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/mg_cu_0003.c b/app/common/mg_cu_0003.c new file mode 100644 index 0000000..055fc79 --- /dev/null +++ b/app/common/mg_cu_0003.c @@ -0,0 +1,37 @@ +/* @tier easy @module mg @transform msg-gateway-util */ +/* + * mg_cu_0003.c - 전문게이트웨이 공통 유틸리티 (plain C) [tier=easy] + */ +#include "mg_cu_0003.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long mg_cu_0003_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long mg_cu_0003_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int mg_cu_0003_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/mg_cu_0004.c b/app/common/mg_cu_0004.c new file mode 100644 index 0000000..702ae53 --- /dev/null +++ b/app/common/mg_cu_0004.c @@ -0,0 +1,37 @@ +/* @tier medium @module mg @transform msg-gateway-util */ +/* + * mg_cu_0004.c - 전문게이트웨이 공통 유틸리티 (plain C) [tier=medium] + */ +#include "mg_cu_0004.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long mg_cu_0004_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long mg_cu_0004_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int mg_cu_0004_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/mg_cu_0005.c b/app/common/mg_cu_0005.c new file mode 100644 index 0000000..19e2a1c --- /dev/null +++ b/app/common/mg_cu_0005.c @@ -0,0 +1,37 @@ +/* @tier easy @module mg @transform msg-gateway-util */ +/* + * mg_cu_0005.c - 전문게이트웨이 공통 유틸리티 (plain C) [tier=easy] + */ +#include "mg_cu_0005.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long mg_cu_0005_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long mg_cu_0005_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int mg_cu_0005_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/mg_cu_0006.c b/app/common/mg_cu_0006.c new file mode 100644 index 0000000..acc533f --- /dev/null +++ b/app/common/mg_cu_0006.c @@ -0,0 +1,37 @@ +/* @tier medium @module mg @transform msg-gateway-util */ +/* + * mg_cu_0006.c - 전문게이트웨이 공통 유틸리티 (plain C) [tier=medium] + */ +#include "mg_cu_0006.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long mg_cu_0006_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long mg_cu_0006_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int mg_cu_0006_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/mg_cu_0007.c b/app/common/mg_cu_0007.c new file mode 100644 index 0000000..8cc35b8 --- /dev/null +++ b/app/common/mg_cu_0007.c @@ -0,0 +1,37 @@ +/* @tier easy @module mg @transform msg-gateway-util */ +/* + * mg_cu_0007.c - 전문게이트웨이 공통 유틸리티 (plain C) [tier=easy] + */ +#include "mg_cu_0007.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long mg_cu_0007_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long mg_cu_0007_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int mg_cu_0007_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/mg_cu_0008.c b/app/common/mg_cu_0008.c new file mode 100644 index 0000000..dca2650 --- /dev/null +++ b/app/common/mg_cu_0008.c @@ -0,0 +1,37 @@ +/* @tier hard @module mg @transform msg-gateway-util */ +/* + * mg_cu_0008.c - 전문게이트웨이 공통 유틸리티 (plain C) [tier=hard] + */ +#include "mg_cu_0008.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long mg_cu_0008_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long mg_cu_0008_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int mg_cu_0008_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/mg_cu_0009.c b/app/common/mg_cu_0009.c new file mode 100644 index 0000000..fbb5722 --- /dev/null +++ b/app/common/mg_cu_0009.c @@ -0,0 +1,37 @@ +/* @tier easy @module mg @transform msg-gateway-util */ +/* + * mg_cu_0009.c - 전문게이트웨이 공통 유틸리티 (plain C) [tier=easy] + */ +#include "mg_cu_0009.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long mg_cu_0009_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long mg_cu_0009_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int mg_cu_0009_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/mg_cu_0010.c b/app/common/mg_cu_0010.c new file mode 100644 index 0000000..bb18532 --- /dev/null +++ b/app/common/mg_cu_0010.c @@ -0,0 +1,37 @@ +/* @tier hard @module mg @transform msg-gateway-util */ +/* + * mg_cu_0010.c - 전문게이트웨이 공통 유틸리티 (plain C) [tier=hard] + */ +#include "mg_cu_0010.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long mg_cu_0010_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long mg_cu_0010_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int mg_cu_0010_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/mg_cu_0011.c b/app/common/mg_cu_0011.c new file mode 100644 index 0000000..ed30b51 --- /dev/null +++ b/app/common/mg_cu_0011.c @@ -0,0 +1,37 @@ +/* @tier easy @module mg @transform msg-gateway-util */ +/* + * mg_cu_0011.c - 전문게이트웨이 공통 유틸리티 (plain C) [tier=easy] + */ +#include "mg_cu_0011.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long mg_cu_0011_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long mg_cu_0011_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int mg_cu_0011_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/mm_cu_0001.c b/app/common/mm_cu_0001.c new file mode 100644 index 0000000..a0eb25b --- /dev/null +++ b/app/common/mm_cu_0001.c @@ -0,0 +1,37 @@ +/* @tier easy @module mm @transform master-util */ +/* + * mm_cu_0001.c - 마스터 공통 유틸리티 (plain C) [tier=easy] + */ +#include "mm_cu_0001.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long mm_cu_0001_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long mm_cu_0001_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int mm_cu_0001_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/mm_cu_0002.c b/app/common/mm_cu_0002.c new file mode 100644 index 0000000..fceca39 --- /dev/null +++ b/app/common/mm_cu_0002.c @@ -0,0 +1,37 @@ +/* @tier hard @module mm @transform master-util */ +/* + * mm_cu_0002.c - 마스터 공통 유틸리티 (plain C) [tier=hard] + */ +#include "mm_cu_0002.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long mm_cu_0002_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long mm_cu_0002_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int mm_cu_0002_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/mm_cu_0003.c b/app/common/mm_cu_0003.c new file mode 100644 index 0000000..1c5d967 --- /dev/null +++ b/app/common/mm_cu_0003.c @@ -0,0 +1,37 @@ +/* @tier easy @module mm @transform master-util */ +/* + * mm_cu_0003.c - 마스터 공통 유틸리티 (plain C) [tier=easy] + */ +#include "mm_cu_0003.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long mm_cu_0003_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long mm_cu_0003_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int mm_cu_0003_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/mm_cu_0004.c b/app/common/mm_cu_0004.c new file mode 100644 index 0000000..74fed38 --- /dev/null +++ b/app/common/mm_cu_0004.c @@ -0,0 +1,37 @@ +/* @tier easy @module mm @transform master-util */ +/* + * mm_cu_0004.c - 마스터 공통 유틸리티 (plain C) [tier=easy] + */ +#include "mm_cu_0004.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long mm_cu_0004_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long mm_cu_0004_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int mm_cu_0004_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/mm_cu_0005.c b/app/common/mm_cu_0005.c new file mode 100644 index 0000000..cb065bb --- /dev/null +++ b/app/common/mm_cu_0005.c @@ -0,0 +1,37 @@ +/* @tier medium @module mm @transform master-util */ +/* + * mm_cu_0005.c - 마스터 공통 유틸리티 (plain C) [tier=medium] + */ +#include "mm_cu_0005.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long mm_cu_0005_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long mm_cu_0005_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int mm_cu_0005_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/mm_cu_0006.c b/app/common/mm_cu_0006.c new file mode 100644 index 0000000..afc470c --- /dev/null +++ b/app/common/mm_cu_0006.c @@ -0,0 +1,37 @@ +/* @tier easy @module mm @transform master-util */ +/* + * mm_cu_0006.c - 마스터 공통 유틸리티 (plain C) [tier=easy] + */ +#include "mm_cu_0006.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long mm_cu_0006_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long mm_cu_0006_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int mm_cu_0006_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/mm_cu_0007.c b/app/common/mm_cu_0007.c new file mode 100644 index 0000000..9549878 --- /dev/null +++ b/app/common/mm_cu_0007.c @@ -0,0 +1,37 @@ +/* @tier medium @module mm @transform master-util */ +/* + * mm_cu_0007.c - 마스터 공통 유틸리티 (plain C) [tier=medium] + */ +#include "mm_cu_0007.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long mm_cu_0007_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long mm_cu_0007_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int mm_cu_0007_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/mm_cu_0008.c b/app/common/mm_cu_0008.c new file mode 100644 index 0000000..999b007 --- /dev/null +++ b/app/common/mm_cu_0008.c @@ -0,0 +1,37 @@ +/* @tier easy @module mm @transform master-util */ +/* + * mm_cu_0008.c - 마스터 공통 유틸리티 (plain C) [tier=easy] + */ +#include "mm_cu_0008.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long mm_cu_0008_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long mm_cu_0008_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int mm_cu_0008_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/mm_cu_0009.c b/app/common/mm_cu_0009.c new file mode 100644 index 0000000..37dfb2a --- /dev/null +++ b/app/common/mm_cu_0009.c @@ -0,0 +1,37 @@ +/* @tier medium @module mm @transform master-util */ +/* + * mm_cu_0009.c - 마스터 공통 유틸리티 (plain C) [tier=medium] + */ +#include "mm_cu_0009.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long mm_cu_0009_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long mm_cu_0009_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int mm_cu_0009_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/mm_cu_0010.c b/app/common/mm_cu_0010.c new file mode 100644 index 0000000..618542b --- /dev/null +++ b/app/common/mm_cu_0010.c @@ -0,0 +1,37 @@ +/* @tier easy @module mm @transform master-util */ +/* + * mm_cu_0010.c - 마스터 공통 유틸리티 (plain C) [tier=easy] + */ +#include "mm_cu_0010.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long mm_cu_0010_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long mm_cu_0010_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int mm_cu_0010_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/mm_cu_0011.c b/app/common/mm_cu_0011.c new file mode 100644 index 0000000..e180aab --- /dev/null +++ b/app/common/mm_cu_0011.c @@ -0,0 +1,37 @@ +/* @tier hard @module mm @transform master-util */ +/* + * mm_cu_0011.c - 마스터 공통 유틸리티 (plain C) [tier=hard] + */ +#include "mm_cu_0011.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long mm_cu_0011_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long mm_cu_0011_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int mm_cu_0011_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/py_cu_0001.c b/app/common/py_cu_0001.c new file mode 100644 index 0000000..66bd298 --- /dev/null +++ b/app/common/py_cu_0001.c @@ -0,0 +1,37 @@ +/* @tier easy @module py @transform payment-util */ +/* + * py_cu_0001.c - 지급 공통 유틸리티 (plain C) [tier=easy] + */ +#include "py_cu_0001.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long py_cu_0001_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long py_cu_0001_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int py_cu_0001_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/py_cu_0002.c b/app/common/py_cu_0002.c new file mode 100644 index 0000000..cd5a874 --- /dev/null +++ b/app/common/py_cu_0002.c @@ -0,0 +1,37 @@ +/* @tier hard @module py @transform payment-util */ +/* + * py_cu_0002.c - 지급 공통 유틸리티 (plain C) [tier=hard] + */ +#include "py_cu_0002.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long py_cu_0002_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long py_cu_0002_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int py_cu_0002_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/py_cu_0003.c b/app/common/py_cu_0003.c new file mode 100644 index 0000000..2f432c0 --- /dev/null +++ b/app/common/py_cu_0003.c @@ -0,0 +1,37 @@ +/* @tier easy @module py @transform payment-util */ +/* + * py_cu_0003.c - 지급 공통 유틸리티 (plain C) [tier=easy] + */ +#include "py_cu_0003.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long py_cu_0003_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long py_cu_0003_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int py_cu_0003_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/py_cu_0004.c b/app/common/py_cu_0004.c new file mode 100644 index 0000000..be7afd0 --- /dev/null +++ b/app/common/py_cu_0004.c @@ -0,0 +1,37 @@ +/* @tier hard @module py @transform payment-util */ +/* + * py_cu_0004.c - 지급 공통 유틸리티 (plain C) [tier=hard] + */ +#include "py_cu_0004.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long py_cu_0004_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long py_cu_0004_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int py_cu_0004_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/py_cu_0005.c b/app/common/py_cu_0005.c new file mode 100644 index 0000000..593e51e --- /dev/null +++ b/app/common/py_cu_0005.c @@ -0,0 +1,37 @@ +/* @tier easy @module py @transform payment-util */ +/* + * py_cu_0005.c - 지급 공통 유틸리티 (plain C) [tier=easy] + */ +#include "py_cu_0005.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long py_cu_0005_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long py_cu_0005_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int py_cu_0005_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/py_cu_0006.c b/app/common/py_cu_0006.c new file mode 100644 index 0000000..7bc56ca --- /dev/null +++ b/app/common/py_cu_0006.c @@ -0,0 +1,37 @@ +/* @tier easy @module py @transform payment-util */ +/* + * py_cu_0006.c - 지급 공통 유틸리티 (plain C) [tier=easy] + */ +#include "py_cu_0006.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long py_cu_0006_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long py_cu_0006_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int py_cu_0006_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/py_cu_0007.c b/app/common/py_cu_0007.c new file mode 100644 index 0000000..15b7af6 --- /dev/null +++ b/app/common/py_cu_0007.c @@ -0,0 +1,37 @@ +/* @tier medium @module py @transform payment-util */ +/* + * py_cu_0007.c - 지급 공통 유틸리티 (plain C) [tier=medium] + */ +#include "py_cu_0007.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long py_cu_0007_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long py_cu_0007_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int py_cu_0007_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/py_cu_0008.c b/app/common/py_cu_0008.c new file mode 100644 index 0000000..895b503 --- /dev/null +++ b/app/common/py_cu_0008.c @@ -0,0 +1,37 @@ +/* @tier easy @module py @transform payment-util */ +/* + * py_cu_0008.c - 지급 공통 유틸리티 (plain C) [tier=easy] + */ +#include "py_cu_0008.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long py_cu_0008_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long py_cu_0008_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int py_cu_0008_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/py_cu_0009.c b/app/common/py_cu_0009.c new file mode 100644 index 0000000..f305015 --- /dev/null +++ b/app/common/py_cu_0009.c @@ -0,0 +1,37 @@ +/* @tier medium @module py @transform payment-util */ +/* + * py_cu_0009.c - 지급 공통 유틸리티 (plain C) [tier=medium] + */ +#include "py_cu_0009.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long py_cu_0009_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long py_cu_0009_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int py_cu_0009_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/py_cu_0010.c b/app/common/py_cu_0010.c new file mode 100644 index 0000000..4fd2a6b --- /dev/null +++ b/app/common/py_cu_0010.c @@ -0,0 +1,37 @@ +/* @tier easy @module py @transform payment-util */ +/* + * py_cu_0010.c - 지급 공통 유틸리티 (plain C) [tier=easy] + */ +#include "py_cu_0010.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long py_cu_0010_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long py_cu_0010_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int py_cu_0010_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/py_cu_0011.c b/app/common/py_cu_0011.c new file mode 100644 index 0000000..ba36d0c --- /dev/null +++ b/app/common/py_cu_0011.c @@ -0,0 +1,37 @@ +/* @tier medium @module py @transform payment-util */ +/* + * py_cu_0011.c - 지급 공통 유틸리티 (plain C) [tier=medium] + */ +#include "py_cu_0011.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long py_cu_0011_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long py_cu_0011_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int py_cu_0011_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/rc_cu_0001.c b/app/common/rc_cu_0001.c new file mode 100644 index 0000000..f5dd0cb --- /dev/null +++ b/app/common/rc_cu_0001.c @@ -0,0 +1,37 @@ +/* @tier easy @module rc @transform reconciliation-util */ +/* + * rc_cu_0001.c - 대사 공통 유틸리티 (plain C) [tier=easy] + */ +#include "rc_cu_0001.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long rc_cu_0001_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long rc_cu_0001_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int rc_cu_0001_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/rc_cu_0002.c b/app/common/rc_cu_0002.c new file mode 100644 index 0000000..5d2a4a5 --- /dev/null +++ b/app/common/rc_cu_0002.c @@ -0,0 +1,37 @@ +/* @tier medium @module rc @transform reconciliation-util */ +/* + * rc_cu_0002.c - 대사 공통 유틸리티 (plain C) [tier=medium] + */ +#include "rc_cu_0002.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long rc_cu_0002_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long rc_cu_0002_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int rc_cu_0002_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/rc_cu_0003.c b/app/common/rc_cu_0003.c new file mode 100644 index 0000000..58705aa --- /dev/null +++ b/app/common/rc_cu_0003.c @@ -0,0 +1,37 @@ +/* @tier easy @module rc @transform reconciliation-util */ +/* + * rc_cu_0003.c - 대사 공통 유틸리티 (plain C) [tier=easy] + */ +#include "rc_cu_0003.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long rc_cu_0003_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long rc_cu_0003_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int rc_cu_0003_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/rc_cu_0004.c b/app/common/rc_cu_0004.c new file mode 100644 index 0000000..3c00a42 --- /dev/null +++ b/app/common/rc_cu_0004.c @@ -0,0 +1,37 @@ +/* @tier medium @module rc @transform reconciliation-util */ +/* + * rc_cu_0004.c - 대사 공통 유틸리티 (plain C) [tier=medium] + */ +#include "rc_cu_0004.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long rc_cu_0004_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long rc_cu_0004_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int rc_cu_0004_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/rc_cu_0005.c b/app/common/rc_cu_0005.c new file mode 100644 index 0000000..a5ea3e8 --- /dev/null +++ b/app/common/rc_cu_0005.c @@ -0,0 +1,37 @@ +/* @tier easy @module rc @transform reconciliation-util */ +/* + * rc_cu_0005.c - 대사 공통 유틸리티 (plain C) [tier=easy] + */ +#include "rc_cu_0005.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long rc_cu_0005_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long rc_cu_0005_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int rc_cu_0005_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/rc_cu_0006.c b/app/common/rc_cu_0006.c new file mode 100644 index 0000000..a395ab6 --- /dev/null +++ b/app/common/rc_cu_0006.c @@ -0,0 +1,37 @@ +/* @tier hard @module rc @transform reconciliation-util */ +/* + * rc_cu_0006.c - 대사 공통 유틸리티 (plain C) [tier=hard] + */ +#include "rc_cu_0006.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long rc_cu_0006_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long rc_cu_0006_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int rc_cu_0006_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/rc_cu_0007.c b/app/common/rc_cu_0007.c new file mode 100644 index 0000000..20bf5f7 --- /dev/null +++ b/app/common/rc_cu_0007.c @@ -0,0 +1,37 @@ +/* @tier easy @module rc @transform reconciliation-util */ +/* + * rc_cu_0007.c - 대사 공통 유틸리티 (plain C) [tier=easy] + */ +#include "rc_cu_0007.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long rc_cu_0007_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long rc_cu_0007_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int rc_cu_0007_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/rc_cu_0008.c b/app/common/rc_cu_0008.c new file mode 100644 index 0000000..485946d --- /dev/null +++ b/app/common/rc_cu_0008.c @@ -0,0 +1,37 @@ +/* @tier easy @module rc @transform reconciliation-util */ +/* + * rc_cu_0008.c - 대사 공통 유틸리티 (plain C) [tier=easy] + */ +#include "rc_cu_0008.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long rc_cu_0008_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long rc_cu_0008_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int rc_cu_0008_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/rc_cu_0009.c b/app/common/rc_cu_0009.c new file mode 100644 index 0000000..376c087 --- /dev/null +++ b/app/common/rc_cu_0009.c @@ -0,0 +1,37 @@ +/* @tier medium @module rc @transform reconciliation-util */ +/* + * rc_cu_0009.c - 대사 공통 유틸리티 (plain C) [tier=medium] + */ +#include "rc_cu_0009.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long rc_cu_0009_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long rc_cu_0009_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int rc_cu_0009_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/rc_cu_0010.c b/app/common/rc_cu_0010.c new file mode 100644 index 0000000..8ee9f12 --- /dev/null +++ b/app/common/rc_cu_0010.c @@ -0,0 +1,37 @@ +/* @tier easy @module rc @transform reconciliation-util */ +/* + * rc_cu_0010.c - 대사 공통 유틸리티 (plain C) [tier=easy] + */ +#include "rc_cu_0010.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long rc_cu_0010_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long rc_cu_0010_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int rc_cu_0010_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/rc_cu_0011.c b/app/common/rc_cu_0011.c new file mode 100644 index 0000000..298ec2d --- /dev/null +++ b/app/common/rc_cu_0011.c @@ -0,0 +1,37 @@ +/* @tier medium @module rc @transform reconciliation-util */ +/* + * rc_cu_0011.c - 대사 공통 유틸리티 (plain C) [tier=medium] + */ +#include "rc_cu_0011.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long rc_cu_0011_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long rc_cu_0011_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int rc_cu_0011_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/st_cu_0001.c b/app/common/st_cu_0001.c new file mode 100644 index 0000000..0aae7c1 --- /dev/null +++ b/app/common/st_cu_0001.c @@ -0,0 +1,37 @@ +/* @tier easy @module st @transform settlement-util */ +/* + * st_cu_0001.c - 정산수수료 공통 유틸리티 (plain C) [tier=easy] + */ +#include "st_cu_0001.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long st_cu_0001_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long st_cu_0001_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int st_cu_0001_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/st_cu_0002.c b/app/common/st_cu_0002.c new file mode 100644 index 0000000..a68ffeb --- /dev/null +++ b/app/common/st_cu_0002.c @@ -0,0 +1,37 @@ +/* @tier medium @module st @transform settlement-util */ +/* + * st_cu_0002.c - 정산수수료 공통 유틸리티 (plain C) [tier=medium] + */ +#include "st_cu_0002.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long st_cu_0002_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long st_cu_0002_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int st_cu_0002_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/st_cu_0003.c b/app/common/st_cu_0003.c new file mode 100644 index 0000000..13d7cab --- /dev/null +++ b/app/common/st_cu_0003.c @@ -0,0 +1,37 @@ +/* @tier easy @module st @transform settlement-util */ +/* + * st_cu_0003.c - 정산수수료 공통 유틸리티 (plain C) [tier=easy] + */ +#include "st_cu_0003.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long st_cu_0003_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long st_cu_0003_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int st_cu_0003_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/st_cu_0004.c b/app/common/st_cu_0004.c new file mode 100644 index 0000000..252e765 --- /dev/null +++ b/app/common/st_cu_0004.c @@ -0,0 +1,37 @@ +/* @tier hard @module st @transform settlement-util */ +/* + * st_cu_0004.c - 정산수수료 공통 유틸리티 (plain C) [tier=hard] + */ +#include "st_cu_0004.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long st_cu_0004_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long st_cu_0004_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int st_cu_0004_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/st_cu_0005.c b/app/common/st_cu_0005.c new file mode 100644 index 0000000..6536e80 --- /dev/null +++ b/app/common/st_cu_0005.c @@ -0,0 +1,37 @@ +/* @tier easy @module st @transform settlement-util */ +/* + * st_cu_0005.c - 정산수수료 공통 유틸리티 (plain C) [tier=easy] + */ +#include "st_cu_0005.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long st_cu_0005_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long st_cu_0005_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int st_cu_0005_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/st_cu_0006.c b/app/common/st_cu_0006.c new file mode 100644 index 0000000..1f32b00 --- /dev/null +++ b/app/common/st_cu_0006.c @@ -0,0 +1,37 @@ +/* @tier easy @module st @transform settlement-util */ +/* + * st_cu_0006.c - 정산수수료 공통 유틸리티 (plain C) [tier=easy] + */ +#include "st_cu_0006.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long st_cu_0006_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long st_cu_0006_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int st_cu_0006_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/st_cu_0007.c b/app/common/st_cu_0007.c new file mode 100644 index 0000000..102a37f --- /dev/null +++ b/app/common/st_cu_0007.c @@ -0,0 +1,37 @@ +/* @tier medium @module st @transform settlement-util */ +/* + * st_cu_0007.c - 정산수수료 공통 유틸리티 (plain C) [tier=medium] + */ +#include "st_cu_0007.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long st_cu_0007_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long st_cu_0007_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int st_cu_0007_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/st_cu_0008.c b/app/common/st_cu_0008.c new file mode 100644 index 0000000..3883b8c --- /dev/null +++ b/app/common/st_cu_0008.c @@ -0,0 +1,37 @@ +/* @tier easy @module st @transform settlement-util */ +/* + * st_cu_0008.c - 정산수수료 공통 유틸리티 (plain C) [tier=easy] + */ +#include "st_cu_0008.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long st_cu_0008_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long st_cu_0008_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int st_cu_0008_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/st_cu_0009.c b/app/common/st_cu_0009.c new file mode 100644 index 0000000..fe7706b --- /dev/null +++ b/app/common/st_cu_0009.c @@ -0,0 +1,37 @@ +/* @tier medium @module st @transform settlement-util */ +/* + * st_cu_0009.c - 정산수수료 공통 유틸리티 (plain C) [tier=medium] + */ +#include "st_cu_0009.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long st_cu_0009_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long st_cu_0009_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int st_cu_0009_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/st_cu_0010.c b/app/common/st_cu_0010.c new file mode 100644 index 0000000..5be27e7 --- /dev/null +++ b/app/common/st_cu_0010.c @@ -0,0 +1,37 @@ +/* @tier easy @module st @transform settlement-util */ +/* + * st_cu_0010.c - 정산수수료 공통 유틸리티 (plain C) [tier=easy] + */ +#include "st_cu_0010.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long st_cu_0010_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long st_cu_0010_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int st_cu_0010_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/st_cu_0011.c b/app/common/st_cu_0011.c new file mode 100644 index 0000000..192a97c --- /dev/null +++ b/app/common/st_cu_0011.c @@ -0,0 +1,37 @@ +/* @tier medium @module st @transform settlement-util */ +/* + * st_cu_0011.c - 정산수수료 공통 유틸리티 (plain C) [tier=medium] + */ +#include "st_cu_0011.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long st_cu_0011_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long st_cu_0011_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int st_cu_0011_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/vl_cu_0001.c b/app/common/vl_cu_0001.c new file mode 100644 index 0000000..95215b2 --- /dev/null +++ b/app/common/vl_cu_0001.c @@ -0,0 +1,37 @@ +/* @tier easy @module vl @transform validation-util */ +/* + * vl_cu_0001.c - 정합성 공통 유틸리티 (plain C) [tier=easy] + */ +#include "vl_cu_0001.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long vl_cu_0001_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long vl_cu_0001_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int vl_cu_0001_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/vl_cu_0002.c b/app/common/vl_cu_0002.c new file mode 100644 index 0000000..2acf65d --- /dev/null +++ b/app/common/vl_cu_0002.c @@ -0,0 +1,37 @@ +/* @tier medium @module vl @transform validation-util */ +/* + * vl_cu_0002.c - 정합성 공통 유틸리티 (plain C) [tier=medium] + */ +#include "vl_cu_0002.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long vl_cu_0002_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long vl_cu_0002_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int vl_cu_0002_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/vl_cu_0003.c b/app/common/vl_cu_0003.c new file mode 100644 index 0000000..fb956c6 --- /dev/null +++ b/app/common/vl_cu_0003.c @@ -0,0 +1,37 @@ +/* @tier easy @module vl @transform validation-util */ +/* + * vl_cu_0003.c - 정합성 공통 유틸리티 (plain C) [tier=easy] + */ +#include "vl_cu_0003.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long vl_cu_0003_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long vl_cu_0003_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int vl_cu_0003_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/vl_cu_0004.c b/app/common/vl_cu_0004.c new file mode 100644 index 0000000..1478bfc --- /dev/null +++ b/app/common/vl_cu_0004.c @@ -0,0 +1,37 @@ +/* @tier hard @module vl @transform validation-util */ +/* + * vl_cu_0004.c - 정합성 공통 유틸리티 (plain C) [tier=hard] + */ +#include "vl_cu_0004.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long vl_cu_0004_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long vl_cu_0004_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int vl_cu_0004_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/vl_cu_0005.c b/app/common/vl_cu_0005.c new file mode 100644 index 0000000..a129df5 --- /dev/null +++ b/app/common/vl_cu_0005.c @@ -0,0 +1,37 @@ +/* @tier easy @module vl @transform validation-util */ +/* + * vl_cu_0005.c - 정합성 공통 유틸리티 (plain C) [tier=easy] + */ +#include "vl_cu_0005.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long vl_cu_0005_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long vl_cu_0005_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int vl_cu_0005_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/vl_cu_0006.c b/app/common/vl_cu_0006.c new file mode 100644 index 0000000..b29fc2e --- /dev/null +++ b/app/common/vl_cu_0006.c @@ -0,0 +1,37 @@ +/* @tier hard @module vl @transform validation-util */ +/* + * vl_cu_0006.c - 정합성 공통 유틸리티 (plain C) [tier=hard] + */ +#include "vl_cu_0006.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long vl_cu_0006_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long vl_cu_0006_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int vl_cu_0006_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/vl_cu_0007.c b/app/common/vl_cu_0007.c new file mode 100644 index 0000000..329c9c7 --- /dev/null +++ b/app/common/vl_cu_0007.c @@ -0,0 +1,37 @@ +/* @tier easy @module vl @transform validation-util */ +/* + * vl_cu_0007.c - 정합성 공통 유틸리티 (plain C) [tier=easy] + */ +#include "vl_cu_0007.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long vl_cu_0007_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long vl_cu_0007_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int vl_cu_0007_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/vl_cu_0008.c b/app/common/vl_cu_0008.c new file mode 100644 index 0000000..4b2b6c8 --- /dev/null +++ b/app/common/vl_cu_0008.c @@ -0,0 +1,37 @@ +/* @tier easy @module vl @transform validation-util */ +/* + * vl_cu_0008.c - 정합성 공통 유틸리티 (plain C) [tier=easy] + */ +#include "vl_cu_0008.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long vl_cu_0008_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long vl_cu_0008_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int vl_cu_0008_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/vl_cu_0009.c b/app/common/vl_cu_0009.c new file mode 100644 index 0000000..6288f0c --- /dev/null +++ b/app/common/vl_cu_0009.c @@ -0,0 +1,37 @@ +/* @tier medium @module vl @transform validation-util */ +/* + * vl_cu_0009.c - 정합성 공통 유틸리티 (plain C) [tier=medium] + */ +#include "vl_cu_0009.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long vl_cu_0009_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long vl_cu_0009_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int vl_cu_0009_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/vl_cu_0010.c b/app/common/vl_cu_0010.c new file mode 100644 index 0000000..78d91ab --- /dev/null +++ b/app/common/vl_cu_0010.c @@ -0,0 +1,37 @@ +/* @tier easy @module vl @transform validation-util */ +/* + * vl_cu_0010.c - 정합성 공통 유틸리티 (plain C) [tier=easy] + */ +#include "vl_cu_0010.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long vl_cu_0010_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long vl_cu_0010_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int vl_cu_0010_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/common/vl_cu_0011.c b/app/common/vl_cu_0011.c new file mode 100644 index 0000000..985db9b --- /dev/null +++ b/app/common/vl_cu_0011.c @@ -0,0 +1,37 @@ +/* @tier medium @module vl @transform validation-util */ +/* + * vl_cu_0011.c - 정합성 공통 유틸리티 (plain C) [tier=medium] + */ +#include "vl_cu_0011.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long vl_cu_0011_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long vl_cu_0011_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int vl_cu_0011_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} diff --git a/app/dbio/ac_dbio_main.c b/app/dbio/ac_dbio_main.c new file mode 100644 index 0000000..964228f --- /dev/null +++ b/app/dbio/ac_dbio_main.c @@ -0,0 +1,399 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/ac_dbio_main.pgc" +/* @tier medium @module ac @transform acquire-dbio */ +/* + * ac_dbio_main.pgc - 매입 표준 DBIO (ECPG 임베디드 SQL) + * + * ac_core.h 의 표준 API 를 ac_ledger 테이블에 대해 구현한다. + * 온라인/배치 프로그램은 이 함수들만 호출한다 (self-contained). + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "ac_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/dbio/ac_dbio_main.pgc" + + +int ac_dbio_connect(const char *target) +{ + /* exec sql begin declare section */ + + +#line 20 "app/dbio/ac_dbio_main.pgc" + const char * h_target ; +/* exec sql end declare section */ +#line 21 "app/dbio/ac_dbio_main.pgc" + + + h_target = (target && target[0]) ? target : "acquire@localhost"; + + { ECPGconnect(__LINE__, 0, h_target , NULL, NULL , NULL, 0); } +#line 25 "app/dbio/ac_dbio_main.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac CONNECT"); + return TX_EDB; + } + tx_log(TX_LOG_INFO, "[ac] DB 접속 완료 target=%s", h_target); + return TX_OK; +} + +int ac_dbio_disconnect(void) +{ + { ECPGdisconnect(__LINE__, "CURRENT");} +#line 36 "app/dbio/ac_dbio_main.pgc" + + return TX_OK; +} + +int ac_rec_insert(const ac_rec_t *rec) +{ + /* exec sql begin declare section */ + + + + + + + + +#line 43 "app/dbio/ac_dbio_main.pgc" + char h_key [ 16 ] ; + +#line 44 "app/dbio/ac_dbio_main.pgc" + char h_merch_id [ 16 ] ; + +#line 45 "app/dbio/ac_dbio_main.pgc" + char h_card_no [ 20 ] ; + +#line 46 "app/dbio/ac_dbio_main.pgc" + long h_amount ; + +#line 47 "app/dbio/ac_dbio_main.pgc" + char h_biz_date [ 9 ] ; + +#line 48 "app/dbio/ac_dbio_main.pgc" + char h_status [ 2 ] ; + +#line 49 "app/dbio/ac_dbio_main.pgc" + long h_fee ; +/* exec sql end declare section */ +#line 50 "app/dbio/ac_dbio_main.pgc" + + + if (!rec) + return TX_EINVAL; + + strncpy(h_key, rec->key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + strncpy(h_merch_id, rec->merch_id, sizeof(h_merch_id) - 1); + h_merch_id[sizeof(h_merch_id) - 1] = '\0'; + strncpy(h_card_no, rec->card_no, sizeof(h_card_no) - 1); + h_card_no[sizeof(h_card_no) - 1] = '\0'; + strncpy(h_biz_date, rec->biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + strncpy(h_status, rec->status, sizeof(h_status) - 1); + h_status[sizeof(h_status) - 1] = '\0'; + h_amount = rec->amount; + h_fee = rec->fee; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into ac_ledger ( key , merch_id , card_no , amount , biz_date , status , fee ) values ( $1 , $2 , $3 , $4 , $5 , $6 , $7 )", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_card_no),(long)20,(long)1,(20)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_status),(long)2,(long)1,(2)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_fee),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 71 "app/dbio/ac_dbio_main.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_rec_insert"); + return TX_EDB; + } + return TX_OK; +} + +int ac_rec_select(const char *key, ac_rec_t *out) +{ + /* exec sql begin declare section */ + + + + + + + + +#line 83 "app/dbio/ac_dbio_main.pgc" + char h_key [ 16 ] ; + +#line 84 "app/dbio/ac_dbio_main.pgc" + char h_merch_id [ 16 ] ; + +#line 85 "app/dbio/ac_dbio_main.pgc" + char h_card_no [ 20 ] ; + +#line 86 "app/dbio/ac_dbio_main.pgc" + long h_amount ; + +#line 87 "app/dbio/ac_dbio_main.pgc" + char h_biz_date [ 9 ] ; + +#line 88 "app/dbio/ac_dbio_main.pgc" + char h_status [ 2 ] ; + +#line 89 "app/dbio/ac_dbio_main.pgc" + long h_fee ; +/* exec sql end declare section */ +#line 90 "app/dbio/ac_dbio_main.pgc" + + + if (!key || !out) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select merch_id , card_no , amount , biz_date , status , fee from ac_ledger where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_card_no),(long)20,(long)1,(20)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_status),(long)2,(long)1,(2)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_fee),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 101 "app/dbio/ac_dbio_main.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_rec_select"); + return TX_EDB; + } + + memset(out, 0, sizeof(*out)); + strncpy(out->key, h_key, sizeof(out->key) - 1); + strncpy(out->merch_id, h_merch_id, sizeof(out->merch_id) - 1); + strncpy(out->card_no, h_card_no, sizeof(out->card_no) - 1); + strncpy(out->biz_date, h_biz_date, sizeof(out->biz_date) - 1); + strncpy(out->status, h_status, sizeof(out->status) - 1); + out->amount = h_amount; + out->fee = h_fee; + return TX_OK; +} + +int ac_rec_update_status(const char *key, const char *status) +{ + /* exec sql begin declare section */ + + + +#line 124 "app/dbio/ac_dbio_main.pgc" + char h_key [ 16 ] ; + +#line 125 "app/dbio/ac_dbio_main.pgc" + char h_status [ 2 ] ; +/* exec sql end declare section */ +#line 126 "app/dbio/ac_dbio_main.pgc" + + + if (!key || !status) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + strncpy(h_status, status, sizeof(h_status) - 1); + h_status[sizeof(h_status) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update ac_ledger set status = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_char,(h_status),(long)2,(long)1,(2)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 138 "app/dbio/ac_dbio_main.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_rec_update_status"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long ac_rec_count(const char *biz_date, const char *status) +{ + /* exec sql begin declare section */ + + + + +#line 152 "app/dbio/ac_dbio_main.pgc" + char h_biz_date [ 9 ] ; + +#line 153 "app/dbio/ac_dbio_main.pgc" + char h_status [ 2 ] ; + +#line 154 "app/dbio/ac_dbio_main.pgc" + int h_cnt ; +/* exec sql end declare section */ +#line 155 "app/dbio/ac_dbio_main.pgc" + + + if (!biz_date || !status) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + strncpy(h_status, status, sizeof(h_status) - 1); + h_status[sizeof(h_status) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select count ( * ) from ac_ledger where biz_date = $1 and status = $2 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_status),(long)2,(long)1,(2)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_int,&(h_cnt),(long)1,(long)1,sizeof(int), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 169 "app/dbio/ac_dbio_main.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_rec_count"); + return -1; + } + return (long)h_cnt; +} + +int ac_rec_sum(const char *biz_date, long *out_sum) +{ + /* exec sql begin declare section */ + + + +#line 181 "app/dbio/ac_dbio_main.pgc" + char h_biz_date [ 9 ] ; + +#line 182 "app/dbio/ac_dbio_main.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 183 "app/dbio/ac_dbio_main.pgc" + + + if (!biz_date || !out_sum) + return TX_EINVAL; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from ac_ledger where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 194 "app/dbio/ac_dbio_main.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_rec_sum"); + return TX_EDB; + } + *out_sum = h_sum; + return TX_OK; +} diff --git a/app/dbio/ac_dbio_main.pgc b/app/dbio/ac_dbio_main.pgc new file mode 100644 index 0000000..e7c7dcc --- /dev/null +++ b/app/dbio/ac_dbio_main.pgc @@ -0,0 +1,202 @@ +/* @tier medium @module ac @transform acquire-dbio */ +/* + * ac_dbio_main.pgc - 매입 표준 DBIO (ECPG 임베디드 SQL) + * + * ac_core.h 의 표준 API 를 ac_ledger 테이블에 대해 구현한다. + * 온라인/배치 프로그램은 이 함수들만 호출한다 (self-contained). + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "ac_core.h" + +EXEC SQL INCLUDE sqlca; + +int ac_dbio_connect(const char *target) +{ + EXEC SQL BEGIN DECLARE SECTION; + const char *h_target; + EXEC SQL END DECLARE SECTION; + + h_target = (target && target[0]) ? target : "acquire@localhost"; + + EXEC SQL CONNECT TO :h_target; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac CONNECT"); + return TX_EDB; + } + tx_log(TX_LOG_INFO, "[ac] DB 접속 완료 target=%s", h_target); + return TX_OK; +} + +int ac_dbio_disconnect(void) +{ + EXEC SQL DISCONNECT CURRENT; + return TX_OK; +} + +int ac_rec_insert(const ac_rec_t *rec) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + char h_merch_id[16]; + char h_card_no[20]; + long h_amount; + char h_biz_date[9]; + char h_status[2]; + long h_fee; + EXEC SQL END DECLARE SECTION; + + if (!rec) + return TX_EINVAL; + + strncpy(h_key, rec->key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + strncpy(h_merch_id, rec->merch_id, sizeof(h_merch_id) - 1); + h_merch_id[sizeof(h_merch_id) - 1] = '\0'; + strncpy(h_card_no, rec->card_no, sizeof(h_card_no) - 1); + h_card_no[sizeof(h_card_no) - 1] = '\0'; + strncpy(h_biz_date, rec->biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + strncpy(h_status, rec->status, sizeof(h_status) - 1); + h_status[sizeof(h_status) - 1] = '\0'; + h_amount = rec->amount; + h_fee = rec->fee; + + EXEC SQL INSERT INTO ac_ledger + (key, merch_id, card_no, amount, biz_date, status, fee) + VALUES + (:h_key, :h_merch_id, :h_card_no, :h_amount, :h_biz_date, :h_status, :h_fee); + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_rec_insert"); + return TX_EDB; + } + return TX_OK; +} + +int ac_rec_select(const char *key, ac_rec_t *out) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + char h_merch_id[16]; + char h_card_no[20]; + long h_amount; + char h_biz_date[9]; + char h_status[2]; + long h_fee; + EXEC SQL END DECLARE SECTION; + + if (!key || !out) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT merch_id, card_no, amount, biz_date, status, fee + INTO :h_merch_id, :h_card_no, :h_amount, :h_biz_date, :h_status, :h_fee + FROM ac_ledger + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_rec_select"); + return TX_EDB; + } + + memset(out, 0, sizeof(*out)); + strncpy(out->key, h_key, sizeof(out->key) - 1); + strncpy(out->merch_id, h_merch_id, sizeof(out->merch_id) - 1); + strncpy(out->card_no, h_card_no, sizeof(out->card_no) - 1); + strncpy(out->biz_date, h_biz_date, sizeof(out->biz_date) - 1); + strncpy(out->status, h_status, sizeof(out->status) - 1); + out->amount = h_amount; + out->fee = h_fee; + return TX_OK; +} + +int ac_rec_update_status(const char *key, const char *status) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + char h_status[2]; + EXEC SQL END DECLARE SECTION; + + if (!key || !status) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + strncpy(h_status, status, sizeof(h_status) - 1); + h_status[sizeof(h_status) - 1] = '\0'; + + EXEC SQL UPDATE ac_ledger + SET status = :h_status, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_rec_update_status"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long ac_rec_count(const char *biz_date, const char *status) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_status[2]; + int h_cnt; + EXEC SQL END DECLARE SECTION; + + if (!biz_date || !status) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + strncpy(h_status, status, sizeof(h_status) - 1); + h_status[sizeof(h_status) - 1] = '\0'; + + EXEC SQL SELECT count(*) + INTO :h_cnt + FROM ac_ledger + WHERE biz_date = :h_biz_date + AND status = :h_status; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_rec_count"); + return -1; + } + return (long)h_cnt; +} + +int ac_rec_sum(const char *biz_date, long *out_sum) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date || !out_sum) + return TX_EINVAL; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM ac_ledger + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_rec_sum"); + return TX_EDB; + } + *out_sum = h_sum; + return TX_OK; +} diff --git a/app/dbio/ac_io_0001.c b/app/dbio/ac_io_0001.c new file mode 100644 index 0000000..85e0ebb --- /dev/null +++ b/app/dbio/ac_io_0001.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/ac_io_0001.pgc" +/* @tier easy @module ac @transform acquire-dbio */ +/* + * ac_io_0001.pgc - 매입 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "ac_io_0001.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/ac_io_0001.pgc" + + +int ac_io_0001_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/ac_io_0001.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/ac_io_0001.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/ac_io_0001.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from ac_io_0001_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/ac_io_0001.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0001_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int ac_io_0001_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/ac_io_0001.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/ac_io_0001.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/ac_io_0001.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update ac_io_0001_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/ac_io_0001.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0001_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long ac_io_0001_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/ac_io_0001.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/ac_io_0001.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/ac_io_0001.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from ac_io_0001_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/ac_io_0001.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0001_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/ac_io_0001.pgc b/app/dbio/ac_io_0001.pgc new file mode 100644 index 0000000..0b97266 --- /dev/null +++ b/app/dbio/ac_io_0001.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module ac @transform acquire-dbio */ +/* + * ac_io_0001.pgc - 매입 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "ac_io_0001.h" + +EXEC SQL INCLUDE sqlca; + +int ac_io_0001_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM ac_io_0001_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0001_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int ac_io_0001_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE ac_io_0001_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0001_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long ac_io_0001_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM ac_io_0001_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0001_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/ac_io_0002.c b/app/dbio/ac_io_0002.c new file mode 100644 index 0000000..a4f09c3 --- /dev/null +++ b/app/dbio/ac_io_0002.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/ac_io_0002.pgc" +/* @tier medium @module ac @transform acquire-dbio */ +/* + * ac_io_0002.pgc - 매입 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "ac_io_0002.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/ac_io_0002.pgc" + + +int ac_io_0002_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/ac_io_0002.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/ac_io_0002.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/ac_io_0002.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from ac_io_0002_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/ac_io_0002.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0002_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int ac_io_0002_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/ac_io_0002.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/ac_io_0002.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/ac_io_0002.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update ac_io_0002_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/ac_io_0002.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0002_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long ac_io_0002_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/ac_io_0002.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/ac_io_0002.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/ac_io_0002.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from ac_io_0002_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/ac_io_0002.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0002_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/ac_io_0002.pgc b/app/dbio/ac_io_0002.pgc new file mode 100644 index 0000000..ea27348 --- /dev/null +++ b/app/dbio/ac_io_0002.pgc @@ -0,0 +1,92 @@ +/* @tier medium @module ac @transform acquire-dbio */ +/* + * ac_io_0002.pgc - 매입 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "ac_io_0002.h" + +EXEC SQL INCLUDE sqlca; + +int ac_io_0002_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM ac_io_0002_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0002_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int ac_io_0002_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE ac_io_0002_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0002_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long ac_io_0002_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM ac_io_0002_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0002_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/ac_io_0003.c b/app/dbio/ac_io_0003.c new file mode 100644 index 0000000..519ba28 --- /dev/null +++ b/app/dbio/ac_io_0003.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/ac_io_0003.pgc" +/* @tier easy @module ac @transform acquire-dbio */ +/* + * ac_io_0003.pgc - 매입 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "ac_io_0003.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/ac_io_0003.pgc" + + +int ac_io_0003_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/ac_io_0003.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/ac_io_0003.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/ac_io_0003.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from ac_io_0003_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/ac_io_0003.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0003_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int ac_io_0003_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/ac_io_0003.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/ac_io_0003.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/ac_io_0003.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update ac_io_0003_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/ac_io_0003.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0003_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long ac_io_0003_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/ac_io_0003.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/ac_io_0003.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/ac_io_0003.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from ac_io_0003_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/ac_io_0003.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0003_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/ac_io_0003.pgc b/app/dbio/ac_io_0003.pgc new file mode 100644 index 0000000..1b50125 --- /dev/null +++ b/app/dbio/ac_io_0003.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module ac @transform acquire-dbio */ +/* + * ac_io_0003.pgc - 매입 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "ac_io_0003.h" + +EXEC SQL INCLUDE sqlca; + +int ac_io_0003_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM ac_io_0003_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0003_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int ac_io_0003_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE ac_io_0003_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0003_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long ac_io_0003_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM ac_io_0003_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0003_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/ac_io_0004.c b/app/dbio/ac_io_0004.c new file mode 100644 index 0000000..115b48e --- /dev/null +++ b/app/dbio/ac_io_0004.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/ac_io_0004.pgc" +/* @tier medium @module ac @transform acquire-dbio */ +/* + * ac_io_0004.pgc - 매입 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "ac_io_0004.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/ac_io_0004.pgc" + + +int ac_io_0004_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/ac_io_0004.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/ac_io_0004.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/ac_io_0004.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from ac_io_0004_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/ac_io_0004.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0004_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int ac_io_0004_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/ac_io_0004.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/ac_io_0004.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/ac_io_0004.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update ac_io_0004_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/ac_io_0004.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0004_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long ac_io_0004_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/ac_io_0004.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/ac_io_0004.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/ac_io_0004.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from ac_io_0004_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/ac_io_0004.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0004_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/ac_io_0004.pgc b/app/dbio/ac_io_0004.pgc new file mode 100644 index 0000000..68e6dde --- /dev/null +++ b/app/dbio/ac_io_0004.pgc @@ -0,0 +1,92 @@ +/* @tier medium @module ac @transform acquire-dbio */ +/* + * ac_io_0004.pgc - 매입 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "ac_io_0004.h" + +EXEC SQL INCLUDE sqlca; + +int ac_io_0004_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM ac_io_0004_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0004_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int ac_io_0004_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE ac_io_0004_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0004_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long ac_io_0004_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM ac_io_0004_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0004_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/ac_io_0005.c b/app/dbio/ac_io_0005.c new file mode 100644 index 0000000..05de785 --- /dev/null +++ b/app/dbio/ac_io_0005.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/ac_io_0005.pgc" +/* @tier easy @module ac @transform acquire-dbio */ +/* + * ac_io_0005.pgc - 매입 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "ac_io_0005.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/ac_io_0005.pgc" + + +int ac_io_0005_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/ac_io_0005.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/ac_io_0005.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/ac_io_0005.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from ac_io_0005_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/ac_io_0005.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0005_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int ac_io_0005_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/ac_io_0005.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/ac_io_0005.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/ac_io_0005.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update ac_io_0005_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/ac_io_0005.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0005_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long ac_io_0005_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/ac_io_0005.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/ac_io_0005.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/ac_io_0005.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from ac_io_0005_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/ac_io_0005.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0005_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/ac_io_0005.pgc b/app/dbio/ac_io_0005.pgc new file mode 100644 index 0000000..d2dce16 --- /dev/null +++ b/app/dbio/ac_io_0005.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module ac @transform acquire-dbio */ +/* + * ac_io_0005.pgc - 매입 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "ac_io_0005.h" + +EXEC SQL INCLUDE sqlca; + +int ac_io_0005_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM ac_io_0005_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0005_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int ac_io_0005_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE ac_io_0005_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0005_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long ac_io_0005_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM ac_io_0005_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0005_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/ac_io_0006.c b/app/dbio/ac_io_0006.c new file mode 100644 index 0000000..05535a2 --- /dev/null +++ b/app/dbio/ac_io_0006.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/ac_io_0006.pgc" +/* @tier hard @module ac @transform acquire-dbio */ +/* + * ac_io_0006.pgc - 매입 보조 DBIO (ECPG) [tier=hard] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "ac_io_0006.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/ac_io_0006.pgc" + + +int ac_io_0006_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/ac_io_0006.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/ac_io_0006.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/ac_io_0006.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from ac_io_0006_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/ac_io_0006.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0006_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int ac_io_0006_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/ac_io_0006.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/ac_io_0006.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/ac_io_0006.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update ac_io_0006_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/ac_io_0006.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0006_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long ac_io_0006_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/ac_io_0006.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/ac_io_0006.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/ac_io_0006.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from ac_io_0006_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/ac_io_0006.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0006_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/ac_io_0006.pgc b/app/dbio/ac_io_0006.pgc new file mode 100644 index 0000000..ad4a976 --- /dev/null +++ b/app/dbio/ac_io_0006.pgc @@ -0,0 +1,92 @@ +/* @tier hard @module ac @transform acquire-dbio */ +/* + * ac_io_0006.pgc - 매입 보조 DBIO (ECPG) [tier=hard] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "ac_io_0006.h" + +EXEC SQL INCLUDE sqlca; + +int ac_io_0006_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM ac_io_0006_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0006_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int ac_io_0006_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE ac_io_0006_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0006_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long ac_io_0006_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM ac_io_0006_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0006_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/ac_io_0007.c b/app/dbio/ac_io_0007.c new file mode 100644 index 0000000..9af094c --- /dev/null +++ b/app/dbio/ac_io_0007.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/ac_io_0007.pgc" +/* @tier easy @module ac @transform acquire-dbio */ +/* + * ac_io_0007.pgc - 매입 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "ac_io_0007.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/ac_io_0007.pgc" + + +int ac_io_0007_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/ac_io_0007.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/ac_io_0007.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/ac_io_0007.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from ac_io_0007_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/ac_io_0007.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0007_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int ac_io_0007_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/ac_io_0007.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/ac_io_0007.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/ac_io_0007.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update ac_io_0007_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/ac_io_0007.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0007_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long ac_io_0007_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/ac_io_0007.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/ac_io_0007.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/ac_io_0007.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from ac_io_0007_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/ac_io_0007.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0007_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/ac_io_0007.pgc b/app/dbio/ac_io_0007.pgc new file mode 100644 index 0000000..d780264 --- /dev/null +++ b/app/dbio/ac_io_0007.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module ac @transform acquire-dbio */ +/* + * ac_io_0007.pgc - 매입 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "ac_io_0007.h" + +EXEC SQL INCLUDE sqlca; + +int ac_io_0007_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM ac_io_0007_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0007_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int ac_io_0007_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE ac_io_0007_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0007_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long ac_io_0007_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM ac_io_0007_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0007_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/ac_io_0008.c b/app/dbio/ac_io_0008.c new file mode 100644 index 0000000..5905015 --- /dev/null +++ b/app/dbio/ac_io_0008.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/ac_io_0008.pgc" +/* @tier hard @module ac @transform acquire-dbio */ +/* + * ac_io_0008.pgc - 매입 보조 DBIO (ECPG) [tier=hard] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "ac_io_0008.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/ac_io_0008.pgc" + + +int ac_io_0008_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/ac_io_0008.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/ac_io_0008.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/ac_io_0008.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from ac_io_0008_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/ac_io_0008.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0008_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int ac_io_0008_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/ac_io_0008.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/ac_io_0008.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/ac_io_0008.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update ac_io_0008_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/ac_io_0008.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0008_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long ac_io_0008_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/ac_io_0008.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/ac_io_0008.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/ac_io_0008.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from ac_io_0008_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/ac_io_0008.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0008_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/ac_io_0008.pgc b/app/dbio/ac_io_0008.pgc new file mode 100644 index 0000000..3b752aa --- /dev/null +++ b/app/dbio/ac_io_0008.pgc @@ -0,0 +1,92 @@ +/* @tier hard @module ac @transform acquire-dbio */ +/* + * ac_io_0008.pgc - 매입 보조 DBIO (ECPG) [tier=hard] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "ac_io_0008.h" + +EXEC SQL INCLUDE sqlca; + +int ac_io_0008_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM ac_io_0008_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0008_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int ac_io_0008_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE ac_io_0008_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0008_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long ac_io_0008_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM ac_io_0008_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0008_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/ac_io_0009.c b/app/dbio/ac_io_0009.c new file mode 100644 index 0000000..8ae6ff0 --- /dev/null +++ b/app/dbio/ac_io_0009.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/ac_io_0009.pgc" +/* @tier easy @module ac @transform acquire-dbio */ +/* + * ac_io_0009.pgc - 매입 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "ac_io_0009.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/ac_io_0009.pgc" + + +int ac_io_0009_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/ac_io_0009.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/ac_io_0009.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/ac_io_0009.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from ac_io_0009_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/ac_io_0009.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0009_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int ac_io_0009_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/ac_io_0009.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/ac_io_0009.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/ac_io_0009.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update ac_io_0009_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/ac_io_0009.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0009_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long ac_io_0009_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/ac_io_0009.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/ac_io_0009.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/ac_io_0009.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from ac_io_0009_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/ac_io_0009.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0009_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/ac_io_0009.pgc b/app/dbio/ac_io_0009.pgc new file mode 100644 index 0000000..7618652 --- /dev/null +++ b/app/dbio/ac_io_0009.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module ac @transform acquire-dbio */ +/* + * ac_io_0009.pgc - 매입 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "ac_io_0009.h" + +EXEC SQL INCLUDE sqlca; + +int ac_io_0009_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM ac_io_0009_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0009_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int ac_io_0009_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE ac_io_0009_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0009_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long ac_io_0009_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM ac_io_0009_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0009_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/ac_io_0010.c b/app/dbio/ac_io_0010.c new file mode 100644 index 0000000..fde25ba --- /dev/null +++ b/app/dbio/ac_io_0010.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/ac_io_0010.pgc" +/* @tier easy @module ac @transform acquire-dbio */ +/* + * ac_io_0010.pgc - 매입 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "ac_io_0010.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/ac_io_0010.pgc" + + +int ac_io_0010_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/ac_io_0010.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/ac_io_0010.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/ac_io_0010.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from ac_io_0010_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/ac_io_0010.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0010_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int ac_io_0010_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/ac_io_0010.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/ac_io_0010.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/ac_io_0010.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update ac_io_0010_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/ac_io_0010.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0010_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long ac_io_0010_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/ac_io_0010.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/ac_io_0010.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/ac_io_0010.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from ac_io_0010_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/ac_io_0010.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0010_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/ac_io_0010.pgc b/app/dbio/ac_io_0010.pgc new file mode 100644 index 0000000..3dd1a7a --- /dev/null +++ b/app/dbio/ac_io_0010.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module ac @transform acquire-dbio */ +/* + * ac_io_0010.pgc - 매입 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "ac_io_0010.h" + +EXEC SQL INCLUDE sqlca; + +int ac_io_0010_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM ac_io_0010_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0010_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int ac_io_0010_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE ac_io_0010_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0010_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long ac_io_0010_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM ac_io_0010_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0010_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/ac_io_0011.c b/app/dbio/ac_io_0011.c new file mode 100644 index 0000000..dd26b0a --- /dev/null +++ b/app/dbio/ac_io_0011.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/ac_io_0011.pgc" +/* @tier medium @module ac @transform acquire-dbio */ +/* + * ac_io_0011.pgc - 매입 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "ac_io_0011.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/ac_io_0011.pgc" + + +int ac_io_0011_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/ac_io_0011.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/ac_io_0011.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/ac_io_0011.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from ac_io_0011_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/ac_io_0011.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0011_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int ac_io_0011_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/ac_io_0011.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/ac_io_0011.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/ac_io_0011.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update ac_io_0011_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/ac_io_0011.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0011_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long ac_io_0011_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/ac_io_0011.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/ac_io_0011.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/ac_io_0011.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from ac_io_0011_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/ac_io_0011.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0011_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/ac_io_0011.pgc b/app/dbio/ac_io_0011.pgc new file mode 100644 index 0000000..8a5e6fa --- /dev/null +++ b/app/dbio/ac_io_0011.pgc @@ -0,0 +1,92 @@ +/* @tier medium @module ac @transform acquire-dbio */ +/* + * ac_io_0011.pgc - 매입 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "ac_io_0011.h" + +EXEC SQL INCLUDE sqlca; + +int ac_io_0011_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM ac_io_0011_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0011_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int ac_io_0011_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE ac_io_0011_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0011_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long ac_io_0011_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM ac_io_0011_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0011_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/ac_io_0012.c b/app/dbio/ac_io_0012.c new file mode 100644 index 0000000..20c6b9a --- /dev/null +++ b/app/dbio/ac_io_0012.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/ac_io_0012.pgc" +/* @tier easy @module ac @transform acquire-dbio */ +/* + * ac_io_0012.pgc - 매입 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "ac_io_0012.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/ac_io_0012.pgc" + + +int ac_io_0012_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/ac_io_0012.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/ac_io_0012.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/ac_io_0012.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from ac_io_0012_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/ac_io_0012.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0012_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int ac_io_0012_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/ac_io_0012.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/ac_io_0012.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/ac_io_0012.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update ac_io_0012_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/ac_io_0012.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0012_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long ac_io_0012_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/ac_io_0012.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/ac_io_0012.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/ac_io_0012.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from ac_io_0012_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/ac_io_0012.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0012_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/ac_io_0012.pgc b/app/dbio/ac_io_0012.pgc new file mode 100644 index 0000000..a82bbe0 --- /dev/null +++ b/app/dbio/ac_io_0012.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module ac @transform acquire-dbio */ +/* + * ac_io_0012.pgc - 매입 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "ac_io_0012.h" + +EXEC SQL INCLUDE sqlca; + +int ac_io_0012_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM ac_io_0012_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0012_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int ac_io_0012_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE ac_io_0012_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0012_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long ac_io_0012_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM ac_io_0012_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0012_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/ac_io_0013.c b/app/dbio/ac_io_0013.c new file mode 100644 index 0000000..8c77fc5 --- /dev/null +++ b/app/dbio/ac_io_0013.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/ac_io_0013.pgc" +/* @tier medium @module ac @transform acquire-dbio */ +/* + * ac_io_0013.pgc - 매입 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "ac_io_0013.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/ac_io_0013.pgc" + + +int ac_io_0013_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/ac_io_0013.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/ac_io_0013.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/ac_io_0013.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from ac_io_0013_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/ac_io_0013.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0013_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int ac_io_0013_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/ac_io_0013.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/ac_io_0013.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/ac_io_0013.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update ac_io_0013_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/ac_io_0013.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0013_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long ac_io_0013_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/ac_io_0013.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/ac_io_0013.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/ac_io_0013.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from ac_io_0013_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/ac_io_0013.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0013_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/ac_io_0013.pgc b/app/dbio/ac_io_0013.pgc new file mode 100644 index 0000000..5a588aa --- /dev/null +++ b/app/dbio/ac_io_0013.pgc @@ -0,0 +1,92 @@ +/* @tier medium @module ac @transform acquire-dbio */ +/* + * ac_io_0013.pgc - 매입 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "ac_io_0013.h" + +EXEC SQL INCLUDE sqlca; + +int ac_io_0013_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM ac_io_0013_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0013_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int ac_io_0013_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE ac_io_0013_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0013_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long ac_io_0013_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM ac_io_0013_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0013_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/ac_io_0014.c b/app/dbio/ac_io_0014.c new file mode 100644 index 0000000..8e83017 --- /dev/null +++ b/app/dbio/ac_io_0014.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/ac_io_0014.pgc" +/* @tier easy @module ac @transform acquire-dbio */ +/* + * ac_io_0014.pgc - 매입 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "ac_io_0014.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/ac_io_0014.pgc" + + +int ac_io_0014_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/ac_io_0014.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/ac_io_0014.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/ac_io_0014.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from ac_io_0014_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/ac_io_0014.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0014_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int ac_io_0014_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/ac_io_0014.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/ac_io_0014.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/ac_io_0014.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update ac_io_0014_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/ac_io_0014.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0014_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long ac_io_0014_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/ac_io_0014.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/ac_io_0014.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/ac_io_0014.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from ac_io_0014_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/ac_io_0014.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0014_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/ac_io_0014.pgc b/app/dbio/ac_io_0014.pgc new file mode 100644 index 0000000..18c63c8 --- /dev/null +++ b/app/dbio/ac_io_0014.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module ac @transform acquire-dbio */ +/* + * ac_io_0014.pgc - 매입 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "ac_io_0014.h" + +EXEC SQL INCLUDE sqlca; + +int ac_io_0014_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM ac_io_0014_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0014_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int ac_io_0014_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE ac_io_0014_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0014_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long ac_io_0014_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM ac_io_0014_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0014_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/ac_io_0015.c b/app/dbio/ac_io_0015.c new file mode 100644 index 0000000..cad461a --- /dev/null +++ b/app/dbio/ac_io_0015.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/ac_io_0015.pgc" +/* @tier medium @module ac @transform acquire-dbio */ +/* + * ac_io_0015.pgc - 매입 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "ac_io_0015.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/ac_io_0015.pgc" + + +int ac_io_0015_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/ac_io_0015.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/ac_io_0015.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/ac_io_0015.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from ac_io_0015_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/ac_io_0015.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0015_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int ac_io_0015_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/ac_io_0015.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/ac_io_0015.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/ac_io_0015.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update ac_io_0015_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/ac_io_0015.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0015_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long ac_io_0015_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/ac_io_0015.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/ac_io_0015.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/ac_io_0015.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from ac_io_0015_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/ac_io_0015.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0015_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/ac_io_0015.pgc b/app/dbio/ac_io_0015.pgc new file mode 100644 index 0000000..7cfa478 --- /dev/null +++ b/app/dbio/ac_io_0015.pgc @@ -0,0 +1,92 @@ +/* @tier medium @module ac @transform acquire-dbio */ +/* + * ac_io_0015.pgc - 매입 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "ac_io_0015.h" + +EXEC SQL INCLUDE sqlca; + +int ac_io_0015_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM ac_io_0015_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0015_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int ac_io_0015_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE ac_io_0015_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0015_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long ac_io_0015_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM ac_io_0015_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0015_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/ac_io_0016.c b/app/dbio/ac_io_0016.c new file mode 100644 index 0000000..a6b34dc --- /dev/null +++ b/app/dbio/ac_io_0016.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/ac_io_0016.pgc" +/* @tier easy @module ac @transform acquire-dbio */ +/* + * ac_io_0016.pgc - 매입 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "ac_io_0016.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/ac_io_0016.pgc" + + +int ac_io_0016_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/ac_io_0016.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/ac_io_0016.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/ac_io_0016.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from ac_io_0016_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/ac_io_0016.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0016_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int ac_io_0016_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/ac_io_0016.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/ac_io_0016.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/ac_io_0016.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update ac_io_0016_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/ac_io_0016.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0016_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long ac_io_0016_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/ac_io_0016.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/ac_io_0016.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/ac_io_0016.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from ac_io_0016_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/ac_io_0016.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0016_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/ac_io_0016.pgc b/app/dbio/ac_io_0016.pgc new file mode 100644 index 0000000..f582e57 --- /dev/null +++ b/app/dbio/ac_io_0016.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module ac @transform acquire-dbio */ +/* + * ac_io_0016.pgc - 매입 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "ac_io_0016.h" + +EXEC SQL INCLUDE sqlca; + +int ac_io_0016_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM ac_io_0016_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0016_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int ac_io_0016_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE ac_io_0016_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0016_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long ac_io_0016_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM ac_io_0016_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0016_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/ac_io_0017.c b/app/dbio/ac_io_0017.c new file mode 100644 index 0000000..bef6607 --- /dev/null +++ b/app/dbio/ac_io_0017.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/ac_io_0017.pgc" +/* @tier hard @module ac @transform acquire-dbio */ +/* + * ac_io_0017.pgc - 매입 보조 DBIO (ECPG) [tier=hard] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "ac_io_0017.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/ac_io_0017.pgc" + + +int ac_io_0017_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/ac_io_0017.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/ac_io_0017.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/ac_io_0017.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from ac_io_0017_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/ac_io_0017.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0017_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int ac_io_0017_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/ac_io_0017.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/ac_io_0017.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/ac_io_0017.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update ac_io_0017_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/ac_io_0017.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0017_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long ac_io_0017_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/ac_io_0017.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/ac_io_0017.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/ac_io_0017.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from ac_io_0017_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/ac_io_0017.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0017_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/ac_io_0017.pgc b/app/dbio/ac_io_0017.pgc new file mode 100644 index 0000000..bb4bb09 --- /dev/null +++ b/app/dbio/ac_io_0017.pgc @@ -0,0 +1,92 @@ +/* @tier hard @module ac @transform acquire-dbio */ +/* + * ac_io_0017.pgc - 매입 보조 DBIO (ECPG) [tier=hard] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "ac_io_0017.h" + +EXEC SQL INCLUDE sqlca; + +int ac_io_0017_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM ac_io_0017_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0017_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int ac_io_0017_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE ac_io_0017_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0017_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long ac_io_0017_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM ac_io_0017_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0017_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/ac_io_0018.c b/app/dbio/ac_io_0018.c new file mode 100644 index 0000000..f152a75 --- /dev/null +++ b/app/dbio/ac_io_0018.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/ac_io_0018.pgc" +/* @tier easy @module ac @transform acquire-dbio */ +/* + * ac_io_0018.pgc - 매입 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "ac_io_0018.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/ac_io_0018.pgc" + + +int ac_io_0018_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/ac_io_0018.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/ac_io_0018.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/ac_io_0018.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from ac_io_0018_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/ac_io_0018.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0018_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int ac_io_0018_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/ac_io_0018.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/ac_io_0018.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/ac_io_0018.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update ac_io_0018_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/ac_io_0018.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0018_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long ac_io_0018_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/ac_io_0018.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/ac_io_0018.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/ac_io_0018.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from ac_io_0018_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/ac_io_0018.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0018_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/ac_io_0018.pgc b/app/dbio/ac_io_0018.pgc new file mode 100644 index 0000000..9e0acf2 --- /dev/null +++ b/app/dbio/ac_io_0018.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module ac @transform acquire-dbio */ +/* + * ac_io_0018.pgc - 매입 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "ac_io_0018.h" + +EXEC SQL INCLUDE sqlca; + +int ac_io_0018_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM ac_io_0018_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0018_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int ac_io_0018_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE ac_io_0018_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0018_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long ac_io_0018_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM ac_io_0018_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0018_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/ac_io_0019.c b/app/dbio/ac_io_0019.c new file mode 100644 index 0000000..b874c10 --- /dev/null +++ b/app/dbio/ac_io_0019.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/ac_io_0019.pgc" +/* @tier easy @module ac @transform acquire-dbio */ +/* + * ac_io_0019.pgc - 매입 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "ac_io_0019.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/ac_io_0019.pgc" + + +int ac_io_0019_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/ac_io_0019.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/ac_io_0019.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/ac_io_0019.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from ac_io_0019_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/ac_io_0019.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0019_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int ac_io_0019_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/ac_io_0019.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/ac_io_0019.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/ac_io_0019.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update ac_io_0019_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/ac_io_0019.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0019_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long ac_io_0019_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/ac_io_0019.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/ac_io_0019.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/ac_io_0019.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from ac_io_0019_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/ac_io_0019.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0019_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/ac_io_0019.pgc b/app/dbio/ac_io_0019.pgc new file mode 100644 index 0000000..9472dfc --- /dev/null +++ b/app/dbio/ac_io_0019.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module ac @transform acquire-dbio */ +/* + * ac_io_0019.pgc - 매입 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "ac_io_0019.h" + +EXEC SQL INCLUDE sqlca; + +int ac_io_0019_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM ac_io_0019_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0019_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int ac_io_0019_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE ac_io_0019_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0019_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long ac_io_0019_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM ac_io_0019_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0019_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/ac_io_0020.c b/app/dbio/ac_io_0020.c new file mode 100644 index 0000000..9e0a240 --- /dev/null +++ b/app/dbio/ac_io_0020.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/ac_io_0020.pgc" +/* @tier medium @module ac @transform acquire-dbio */ +/* + * ac_io_0020.pgc - 매입 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "ac_io_0020.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/ac_io_0020.pgc" + + +int ac_io_0020_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/ac_io_0020.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/ac_io_0020.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/ac_io_0020.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from ac_io_0020_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/ac_io_0020.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0020_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int ac_io_0020_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/ac_io_0020.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/ac_io_0020.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/ac_io_0020.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update ac_io_0020_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/ac_io_0020.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0020_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long ac_io_0020_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/ac_io_0020.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/ac_io_0020.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/ac_io_0020.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from ac_io_0020_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/ac_io_0020.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0020_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/ac_io_0020.pgc b/app/dbio/ac_io_0020.pgc new file mode 100644 index 0000000..89aa12f --- /dev/null +++ b/app/dbio/ac_io_0020.pgc @@ -0,0 +1,92 @@ +/* @tier medium @module ac @transform acquire-dbio */ +/* + * ac_io_0020.pgc - 매입 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "ac_io_0020.h" + +EXEC SQL INCLUDE sqlca; + +int ac_io_0020_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM ac_io_0020_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0020_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int ac_io_0020_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE ac_io_0020_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0020_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long ac_io_0020_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM ac_io_0020_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0020_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/ac_io_0021.c b/app/dbio/ac_io_0021.c new file mode 100644 index 0000000..0aa903d --- /dev/null +++ b/app/dbio/ac_io_0021.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/ac_io_0021.pgc" +/* @tier easy @module ac @transform acquire-dbio */ +/* + * ac_io_0021.pgc - 매입 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "ac_io_0021.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/ac_io_0021.pgc" + + +int ac_io_0021_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/ac_io_0021.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/ac_io_0021.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/ac_io_0021.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from ac_io_0021_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/ac_io_0021.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0021_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int ac_io_0021_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/ac_io_0021.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/ac_io_0021.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/ac_io_0021.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update ac_io_0021_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/ac_io_0021.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0021_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long ac_io_0021_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/ac_io_0021.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/ac_io_0021.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/ac_io_0021.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from ac_io_0021_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/ac_io_0021.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0021_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/ac_io_0021.pgc b/app/dbio/ac_io_0021.pgc new file mode 100644 index 0000000..383f515 --- /dev/null +++ b/app/dbio/ac_io_0021.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module ac @transform acquire-dbio */ +/* + * ac_io_0021.pgc - 매입 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "ac_io_0021.h" + +EXEC SQL INCLUDE sqlca; + +int ac_io_0021_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM ac_io_0021_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0021_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int ac_io_0021_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE ac_io_0021_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0021_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long ac_io_0021_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM ac_io_0021_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0021_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/ac_io_0022.c b/app/dbio/ac_io_0022.c new file mode 100644 index 0000000..20930cb --- /dev/null +++ b/app/dbio/ac_io_0022.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/ac_io_0022.pgc" +/* @tier medium @module ac @transform acquire-dbio */ +/* + * ac_io_0022.pgc - 매입 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "ac_io_0022.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/ac_io_0022.pgc" + + +int ac_io_0022_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/ac_io_0022.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/ac_io_0022.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/ac_io_0022.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from ac_io_0022_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/ac_io_0022.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0022_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int ac_io_0022_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/ac_io_0022.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/ac_io_0022.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/ac_io_0022.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update ac_io_0022_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/ac_io_0022.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0022_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long ac_io_0022_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/ac_io_0022.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/ac_io_0022.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/ac_io_0022.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from ac_io_0022_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/ac_io_0022.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0022_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/ac_io_0022.pgc b/app/dbio/ac_io_0022.pgc new file mode 100644 index 0000000..efd9b9f --- /dev/null +++ b/app/dbio/ac_io_0022.pgc @@ -0,0 +1,92 @@ +/* @tier medium @module ac @transform acquire-dbio */ +/* + * ac_io_0022.pgc - 매입 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "ac_io_0022.h" + +EXEC SQL INCLUDE sqlca; + +int ac_io_0022_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM ac_io_0022_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0022_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int ac_io_0022_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE ac_io_0022_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0022_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long ac_io_0022_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM ac_io_0022_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0022_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/ac_io_0023.c b/app/dbio/ac_io_0023.c new file mode 100644 index 0000000..f83080d --- /dev/null +++ b/app/dbio/ac_io_0023.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/ac_io_0023.pgc" +/* @tier easy @module ac @transform acquire-dbio */ +/* + * ac_io_0023.pgc - 매입 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "ac_io_0023.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/ac_io_0023.pgc" + + +int ac_io_0023_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/ac_io_0023.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/ac_io_0023.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/ac_io_0023.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from ac_io_0023_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/ac_io_0023.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0023_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int ac_io_0023_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/ac_io_0023.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/ac_io_0023.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/ac_io_0023.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update ac_io_0023_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/ac_io_0023.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0023_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long ac_io_0023_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/ac_io_0023.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/ac_io_0023.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/ac_io_0023.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from ac_io_0023_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/ac_io_0023.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0023_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/ac_io_0023.pgc b/app/dbio/ac_io_0023.pgc new file mode 100644 index 0000000..c8498d9 --- /dev/null +++ b/app/dbio/ac_io_0023.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module ac @transform acquire-dbio */ +/* + * ac_io_0023.pgc - 매입 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "ac_io_0023.h" + +EXEC SQL INCLUDE sqlca; + +int ac_io_0023_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM ac_io_0023_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0023_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int ac_io_0023_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE ac_io_0023_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0023_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long ac_io_0023_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM ac_io_0023_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0023_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/ac_io_0024.c b/app/dbio/ac_io_0024.c new file mode 100644 index 0000000..cf8658a --- /dev/null +++ b/app/dbio/ac_io_0024.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/ac_io_0024.pgc" +/* @tier medium @module ac @transform acquire-dbio */ +/* + * ac_io_0024.pgc - 매입 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "ac_io_0024.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/ac_io_0024.pgc" + + +int ac_io_0024_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/ac_io_0024.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/ac_io_0024.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/ac_io_0024.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from ac_io_0024_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/ac_io_0024.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0024_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int ac_io_0024_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/ac_io_0024.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/ac_io_0024.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/ac_io_0024.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update ac_io_0024_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/ac_io_0024.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0024_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long ac_io_0024_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/ac_io_0024.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/ac_io_0024.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/ac_io_0024.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from ac_io_0024_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/ac_io_0024.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0024_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/ac_io_0024.pgc b/app/dbio/ac_io_0024.pgc new file mode 100644 index 0000000..fa8bf03 --- /dev/null +++ b/app/dbio/ac_io_0024.pgc @@ -0,0 +1,92 @@ +/* @tier medium @module ac @transform acquire-dbio */ +/* + * ac_io_0024.pgc - 매입 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "ac_io_0024.h" + +EXEC SQL INCLUDE sqlca; + +int ac_io_0024_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM ac_io_0024_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0024_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int ac_io_0024_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE ac_io_0024_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0024_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long ac_io_0024_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM ac_io_0024_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0024_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/ac_io_0025.c b/app/dbio/ac_io_0025.c new file mode 100644 index 0000000..eaab8f6 --- /dev/null +++ b/app/dbio/ac_io_0025.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/ac_io_0025.pgc" +/* @tier easy @module ac @transform acquire-dbio */ +/* + * ac_io_0025.pgc - 매입 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "ac_io_0025.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/ac_io_0025.pgc" + + +int ac_io_0025_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/ac_io_0025.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/ac_io_0025.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/ac_io_0025.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from ac_io_0025_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/ac_io_0025.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0025_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int ac_io_0025_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/ac_io_0025.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/ac_io_0025.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/ac_io_0025.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update ac_io_0025_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/ac_io_0025.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0025_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long ac_io_0025_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/ac_io_0025.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/ac_io_0025.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/ac_io_0025.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from ac_io_0025_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/ac_io_0025.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0025_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/ac_io_0025.pgc b/app/dbio/ac_io_0025.pgc new file mode 100644 index 0000000..f950c9f --- /dev/null +++ b/app/dbio/ac_io_0025.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module ac @transform acquire-dbio */ +/* + * ac_io_0025.pgc - 매입 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "ac_io_0025.h" + +EXEC SQL INCLUDE sqlca; + +int ac_io_0025_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM ac_io_0025_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0025_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int ac_io_0025_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE ac_io_0025_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0025_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long ac_io_0025_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM ac_io_0025_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0025_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/ac_io_0026.c b/app/dbio/ac_io_0026.c new file mode 100644 index 0000000..8ec5418 --- /dev/null +++ b/app/dbio/ac_io_0026.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/ac_io_0026.pgc" +/* @tier hard @module ac @transform acquire-dbio */ +/* + * ac_io_0026.pgc - 매입 보조 DBIO (ECPG) [tier=hard] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "ac_io_0026.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/ac_io_0026.pgc" + + +int ac_io_0026_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/ac_io_0026.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/ac_io_0026.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/ac_io_0026.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from ac_io_0026_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/ac_io_0026.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0026_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int ac_io_0026_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/ac_io_0026.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/ac_io_0026.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/ac_io_0026.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update ac_io_0026_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/ac_io_0026.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0026_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long ac_io_0026_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/ac_io_0026.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/ac_io_0026.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/ac_io_0026.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from ac_io_0026_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/ac_io_0026.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0026_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/ac_io_0026.pgc b/app/dbio/ac_io_0026.pgc new file mode 100644 index 0000000..9c8532f --- /dev/null +++ b/app/dbio/ac_io_0026.pgc @@ -0,0 +1,92 @@ +/* @tier hard @module ac @transform acquire-dbio */ +/* + * ac_io_0026.pgc - 매입 보조 DBIO (ECPG) [tier=hard] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "ac_io_0026.h" + +EXEC SQL INCLUDE sqlca; + +int ac_io_0026_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM ac_io_0026_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0026_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int ac_io_0026_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE ac_io_0026_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0026_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long ac_io_0026_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM ac_io_0026_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0026_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/ac_io_0027.c b/app/dbio/ac_io_0027.c new file mode 100644 index 0000000..9839666 --- /dev/null +++ b/app/dbio/ac_io_0027.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/ac_io_0027.pgc" +/* @tier easy @module ac @transform acquire-dbio */ +/* + * ac_io_0027.pgc - 매입 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "ac_io_0027.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/ac_io_0027.pgc" + + +int ac_io_0027_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/ac_io_0027.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/ac_io_0027.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/ac_io_0027.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from ac_io_0027_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/ac_io_0027.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0027_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int ac_io_0027_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/ac_io_0027.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/ac_io_0027.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/ac_io_0027.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update ac_io_0027_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/ac_io_0027.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0027_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long ac_io_0027_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/ac_io_0027.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/ac_io_0027.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/ac_io_0027.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from ac_io_0027_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/ac_io_0027.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0027_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/ac_io_0027.pgc b/app/dbio/ac_io_0027.pgc new file mode 100644 index 0000000..9596abe --- /dev/null +++ b/app/dbio/ac_io_0027.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module ac @transform acquire-dbio */ +/* + * ac_io_0027.pgc - 매입 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "ac_io_0027.h" + +EXEC SQL INCLUDE sqlca; + +int ac_io_0027_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM ac_io_0027_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0027_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int ac_io_0027_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE ac_io_0027_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0027_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long ac_io_0027_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM ac_io_0027_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("ac_io_0027_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/au_dbio_main.c b/app/dbio/au_dbio_main.c new file mode 100644 index 0000000..21bab01 --- /dev/null +++ b/app/dbio/au_dbio_main.c @@ -0,0 +1,399 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/au_dbio_main.pgc" +/* @tier medium @module au @transform authorization-dbio */ +/* + * au_dbio_main.pgc - 승인한도 표준 DBIO (ECPG 임베디드 SQL) + * + * au_core.h 의 표준 API 를 au_ledger 테이블에 대해 구현한다. + * 온라인/배치 프로그램은 이 함수들만 호출한다 (self-contained). + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "au_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/dbio/au_dbio_main.pgc" + + +int au_dbio_connect(const char *target) +{ + /* exec sql begin declare section */ + + +#line 20 "app/dbio/au_dbio_main.pgc" + const char * h_target ; +/* exec sql end declare section */ +#line 21 "app/dbio/au_dbio_main.pgc" + + + h_target = (target && target[0]) ? target : "acquire@localhost"; + + { ECPGconnect(__LINE__, 0, h_target , NULL, NULL , NULL, 0); } +#line 25 "app/dbio/au_dbio_main.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au CONNECT"); + return TX_EDB; + } + tx_log(TX_LOG_INFO, "[au] DB 접속 완료 target=%s", h_target); + return TX_OK; +} + +int au_dbio_disconnect(void) +{ + { ECPGdisconnect(__LINE__, "CURRENT");} +#line 36 "app/dbio/au_dbio_main.pgc" + + return TX_OK; +} + +int au_rec_insert(const au_rec_t *rec) +{ + /* exec sql begin declare section */ + + + + + + + + +#line 43 "app/dbio/au_dbio_main.pgc" + char h_key [ 16 ] ; + +#line 44 "app/dbio/au_dbio_main.pgc" + char h_merch_id [ 16 ] ; + +#line 45 "app/dbio/au_dbio_main.pgc" + char h_card_no [ 20 ] ; + +#line 46 "app/dbio/au_dbio_main.pgc" + long h_amount ; + +#line 47 "app/dbio/au_dbio_main.pgc" + char h_biz_date [ 9 ] ; + +#line 48 "app/dbio/au_dbio_main.pgc" + char h_status [ 2 ] ; + +#line 49 "app/dbio/au_dbio_main.pgc" + long h_fee ; +/* exec sql end declare section */ +#line 50 "app/dbio/au_dbio_main.pgc" + + + if (!rec) + return TX_EINVAL; + + strncpy(h_key, rec->key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + strncpy(h_merch_id, rec->merch_id, sizeof(h_merch_id) - 1); + h_merch_id[sizeof(h_merch_id) - 1] = '\0'; + strncpy(h_card_no, rec->card_no, sizeof(h_card_no) - 1); + h_card_no[sizeof(h_card_no) - 1] = '\0'; + strncpy(h_biz_date, rec->biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + strncpy(h_status, rec->status, sizeof(h_status) - 1); + h_status[sizeof(h_status) - 1] = '\0'; + h_amount = rec->amount; + h_fee = rec->fee; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into au_ledger ( key , merch_id , card_no , amount , biz_date , status , fee ) values ( $1 , $2 , $3 , $4 , $5 , $6 , $7 )", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_card_no),(long)20,(long)1,(20)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_status),(long)2,(long)1,(2)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_fee),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 71 "app/dbio/au_dbio_main.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_rec_insert"); + return TX_EDB; + } + return TX_OK; +} + +int au_rec_select(const char *key, au_rec_t *out) +{ + /* exec sql begin declare section */ + + + + + + + + +#line 83 "app/dbio/au_dbio_main.pgc" + char h_key [ 16 ] ; + +#line 84 "app/dbio/au_dbio_main.pgc" + char h_merch_id [ 16 ] ; + +#line 85 "app/dbio/au_dbio_main.pgc" + char h_card_no [ 20 ] ; + +#line 86 "app/dbio/au_dbio_main.pgc" + long h_amount ; + +#line 87 "app/dbio/au_dbio_main.pgc" + char h_biz_date [ 9 ] ; + +#line 88 "app/dbio/au_dbio_main.pgc" + char h_status [ 2 ] ; + +#line 89 "app/dbio/au_dbio_main.pgc" + long h_fee ; +/* exec sql end declare section */ +#line 90 "app/dbio/au_dbio_main.pgc" + + + if (!key || !out) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select merch_id , card_no , amount , biz_date , status , fee from au_ledger where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_card_no),(long)20,(long)1,(20)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_status),(long)2,(long)1,(2)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_fee),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 101 "app/dbio/au_dbio_main.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_rec_select"); + return TX_EDB; + } + + memset(out, 0, sizeof(*out)); + strncpy(out->key, h_key, sizeof(out->key) - 1); + strncpy(out->merch_id, h_merch_id, sizeof(out->merch_id) - 1); + strncpy(out->card_no, h_card_no, sizeof(out->card_no) - 1); + strncpy(out->biz_date, h_biz_date, sizeof(out->biz_date) - 1); + strncpy(out->status, h_status, sizeof(out->status) - 1); + out->amount = h_amount; + out->fee = h_fee; + return TX_OK; +} + +int au_rec_update_status(const char *key, const char *status) +{ + /* exec sql begin declare section */ + + + +#line 124 "app/dbio/au_dbio_main.pgc" + char h_key [ 16 ] ; + +#line 125 "app/dbio/au_dbio_main.pgc" + char h_status [ 2 ] ; +/* exec sql end declare section */ +#line 126 "app/dbio/au_dbio_main.pgc" + + + if (!key || !status) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + strncpy(h_status, status, sizeof(h_status) - 1); + h_status[sizeof(h_status) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update au_ledger set status = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_char,(h_status),(long)2,(long)1,(2)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 138 "app/dbio/au_dbio_main.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_rec_update_status"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long au_rec_count(const char *biz_date, const char *status) +{ + /* exec sql begin declare section */ + + + + +#line 152 "app/dbio/au_dbio_main.pgc" + char h_biz_date [ 9 ] ; + +#line 153 "app/dbio/au_dbio_main.pgc" + char h_status [ 2 ] ; + +#line 154 "app/dbio/au_dbio_main.pgc" + int h_cnt ; +/* exec sql end declare section */ +#line 155 "app/dbio/au_dbio_main.pgc" + + + if (!biz_date || !status) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + strncpy(h_status, status, sizeof(h_status) - 1); + h_status[sizeof(h_status) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select count ( * ) from au_ledger where biz_date = $1 and status = $2 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_status),(long)2,(long)1,(2)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_int,&(h_cnt),(long)1,(long)1,sizeof(int), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 169 "app/dbio/au_dbio_main.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_rec_count"); + return -1; + } + return (long)h_cnt; +} + +int au_rec_sum(const char *biz_date, long *out_sum) +{ + /* exec sql begin declare section */ + + + +#line 181 "app/dbio/au_dbio_main.pgc" + char h_biz_date [ 9 ] ; + +#line 182 "app/dbio/au_dbio_main.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 183 "app/dbio/au_dbio_main.pgc" + + + if (!biz_date || !out_sum) + return TX_EINVAL; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from au_ledger where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 194 "app/dbio/au_dbio_main.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_rec_sum"); + return TX_EDB; + } + *out_sum = h_sum; + return TX_OK; +} diff --git a/app/dbio/au_dbio_main.pgc b/app/dbio/au_dbio_main.pgc new file mode 100644 index 0000000..79676dd --- /dev/null +++ b/app/dbio/au_dbio_main.pgc @@ -0,0 +1,202 @@ +/* @tier medium @module au @transform authorization-dbio */ +/* + * au_dbio_main.pgc - 승인한도 표준 DBIO (ECPG 임베디드 SQL) + * + * au_core.h 의 표준 API 를 au_ledger 테이블에 대해 구현한다. + * 온라인/배치 프로그램은 이 함수들만 호출한다 (self-contained). + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "au_core.h" + +EXEC SQL INCLUDE sqlca; + +int au_dbio_connect(const char *target) +{ + EXEC SQL BEGIN DECLARE SECTION; + const char *h_target; + EXEC SQL END DECLARE SECTION; + + h_target = (target && target[0]) ? target : "acquire@localhost"; + + EXEC SQL CONNECT TO :h_target; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au CONNECT"); + return TX_EDB; + } + tx_log(TX_LOG_INFO, "[au] DB 접속 완료 target=%s", h_target); + return TX_OK; +} + +int au_dbio_disconnect(void) +{ + EXEC SQL DISCONNECT CURRENT; + return TX_OK; +} + +int au_rec_insert(const au_rec_t *rec) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + char h_merch_id[16]; + char h_card_no[20]; + long h_amount; + char h_biz_date[9]; + char h_status[2]; + long h_fee; + EXEC SQL END DECLARE SECTION; + + if (!rec) + return TX_EINVAL; + + strncpy(h_key, rec->key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + strncpy(h_merch_id, rec->merch_id, sizeof(h_merch_id) - 1); + h_merch_id[sizeof(h_merch_id) - 1] = '\0'; + strncpy(h_card_no, rec->card_no, sizeof(h_card_no) - 1); + h_card_no[sizeof(h_card_no) - 1] = '\0'; + strncpy(h_biz_date, rec->biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + strncpy(h_status, rec->status, sizeof(h_status) - 1); + h_status[sizeof(h_status) - 1] = '\0'; + h_amount = rec->amount; + h_fee = rec->fee; + + EXEC SQL INSERT INTO au_ledger + (key, merch_id, card_no, amount, biz_date, status, fee) + VALUES + (:h_key, :h_merch_id, :h_card_no, :h_amount, :h_biz_date, :h_status, :h_fee); + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_rec_insert"); + return TX_EDB; + } + return TX_OK; +} + +int au_rec_select(const char *key, au_rec_t *out) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + char h_merch_id[16]; + char h_card_no[20]; + long h_amount; + char h_biz_date[9]; + char h_status[2]; + long h_fee; + EXEC SQL END DECLARE SECTION; + + if (!key || !out) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT merch_id, card_no, amount, biz_date, status, fee + INTO :h_merch_id, :h_card_no, :h_amount, :h_biz_date, :h_status, :h_fee + FROM au_ledger + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_rec_select"); + return TX_EDB; + } + + memset(out, 0, sizeof(*out)); + strncpy(out->key, h_key, sizeof(out->key) - 1); + strncpy(out->merch_id, h_merch_id, sizeof(out->merch_id) - 1); + strncpy(out->card_no, h_card_no, sizeof(out->card_no) - 1); + strncpy(out->biz_date, h_biz_date, sizeof(out->biz_date) - 1); + strncpy(out->status, h_status, sizeof(out->status) - 1); + out->amount = h_amount; + out->fee = h_fee; + return TX_OK; +} + +int au_rec_update_status(const char *key, const char *status) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + char h_status[2]; + EXEC SQL END DECLARE SECTION; + + if (!key || !status) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + strncpy(h_status, status, sizeof(h_status) - 1); + h_status[sizeof(h_status) - 1] = '\0'; + + EXEC SQL UPDATE au_ledger + SET status = :h_status, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_rec_update_status"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long au_rec_count(const char *biz_date, const char *status) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_status[2]; + int h_cnt; + EXEC SQL END DECLARE SECTION; + + if (!biz_date || !status) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + strncpy(h_status, status, sizeof(h_status) - 1); + h_status[sizeof(h_status) - 1] = '\0'; + + EXEC SQL SELECT count(*) + INTO :h_cnt + FROM au_ledger + WHERE biz_date = :h_biz_date + AND status = :h_status; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_rec_count"); + return -1; + } + return (long)h_cnt; +} + +int au_rec_sum(const char *biz_date, long *out_sum) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date || !out_sum) + return TX_EINVAL; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM au_ledger + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_rec_sum"); + return TX_EDB; + } + *out_sum = h_sum; + return TX_OK; +} diff --git a/app/dbio/au_io_0001.c b/app/dbio/au_io_0001.c new file mode 100644 index 0000000..2f4fa81 --- /dev/null +++ b/app/dbio/au_io_0001.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/au_io_0001.pgc" +/* @tier easy @module au @transform authorization-dbio */ +/* + * au_io_0001.pgc - 승인한도 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "au_io_0001.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/au_io_0001.pgc" + + +int au_io_0001_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/au_io_0001.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/au_io_0001.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/au_io_0001.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from au_io_0001_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/au_io_0001.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0001_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int au_io_0001_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/au_io_0001.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/au_io_0001.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/au_io_0001.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update au_io_0001_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/au_io_0001.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0001_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long au_io_0001_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/au_io_0001.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/au_io_0001.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/au_io_0001.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from au_io_0001_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/au_io_0001.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0001_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/au_io_0001.pgc b/app/dbio/au_io_0001.pgc new file mode 100644 index 0000000..c234fcd --- /dev/null +++ b/app/dbio/au_io_0001.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module au @transform authorization-dbio */ +/* + * au_io_0001.pgc - 승인한도 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "au_io_0001.h" + +EXEC SQL INCLUDE sqlca; + +int au_io_0001_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM au_io_0001_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0001_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int au_io_0001_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE au_io_0001_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0001_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long au_io_0001_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM au_io_0001_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0001_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/au_io_0002.c b/app/dbio/au_io_0002.c new file mode 100644 index 0000000..e781017 --- /dev/null +++ b/app/dbio/au_io_0002.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/au_io_0002.pgc" +/* @tier medium @module au @transform authorization-dbio */ +/* + * au_io_0002.pgc - 승인한도 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "au_io_0002.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/au_io_0002.pgc" + + +int au_io_0002_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/au_io_0002.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/au_io_0002.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/au_io_0002.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from au_io_0002_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/au_io_0002.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0002_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int au_io_0002_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/au_io_0002.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/au_io_0002.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/au_io_0002.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update au_io_0002_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/au_io_0002.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0002_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long au_io_0002_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/au_io_0002.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/au_io_0002.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/au_io_0002.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from au_io_0002_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/au_io_0002.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0002_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/au_io_0002.pgc b/app/dbio/au_io_0002.pgc new file mode 100644 index 0000000..04cd5b6 --- /dev/null +++ b/app/dbio/au_io_0002.pgc @@ -0,0 +1,92 @@ +/* @tier medium @module au @transform authorization-dbio */ +/* + * au_io_0002.pgc - 승인한도 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "au_io_0002.h" + +EXEC SQL INCLUDE sqlca; + +int au_io_0002_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM au_io_0002_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0002_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int au_io_0002_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE au_io_0002_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0002_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long au_io_0002_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM au_io_0002_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0002_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/au_io_0003.c b/app/dbio/au_io_0003.c new file mode 100644 index 0000000..2a2ce00 --- /dev/null +++ b/app/dbio/au_io_0003.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/au_io_0003.pgc" +/* @tier easy @module au @transform authorization-dbio */ +/* + * au_io_0003.pgc - 승인한도 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "au_io_0003.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/au_io_0003.pgc" + + +int au_io_0003_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/au_io_0003.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/au_io_0003.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/au_io_0003.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from au_io_0003_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/au_io_0003.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0003_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int au_io_0003_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/au_io_0003.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/au_io_0003.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/au_io_0003.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update au_io_0003_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/au_io_0003.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0003_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long au_io_0003_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/au_io_0003.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/au_io_0003.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/au_io_0003.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from au_io_0003_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/au_io_0003.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0003_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/au_io_0003.pgc b/app/dbio/au_io_0003.pgc new file mode 100644 index 0000000..a549d3f --- /dev/null +++ b/app/dbio/au_io_0003.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module au @transform authorization-dbio */ +/* + * au_io_0003.pgc - 승인한도 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "au_io_0003.h" + +EXEC SQL INCLUDE sqlca; + +int au_io_0003_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM au_io_0003_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0003_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int au_io_0003_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE au_io_0003_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0003_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long au_io_0003_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM au_io_0003_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0003_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/au_io_0004.c b/app/dbio/au_io_0004.c new file mode 100644 index 0000000..65e7146 --- /dev/null +++ b/app/dbio/au_io_0004.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/au_io_0004.pgc" +/* @tier medium @module au @transform authorization-dbio */ +/* + * au_io_0004.pgc - 승인한도 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "au_io_0004.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/au_io_0004.pgc" + + +int au_io_0004_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/au_io_0004.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/au_io_0004.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/au_io_0004.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from au_io_0004_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/au_io_0004.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0004_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int au_io_0004_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/au_io_0004.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/au_io_0004.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/au_io_0004.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update au_io_0004_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/au_io_0004.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0004_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long au_io_0004_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/au_io_0004.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/au_io_0004.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/au_io_0004.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from au_io_0004_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/au_io_0004.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0004_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/au_io_0004.pgc b/app/dbio/au_io_0004.pgc new file mode 100644 index 0000000..ffcb6ac --- /dev/null +++ b/app/dbio/au_io_0004.pgc @@ -0,0 +1,92 @@ +/* @tier medium @module au @transform authorization-dbio */ +/* + * au_io_0004.pgc - 승인한도 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "au_io_0004.h" + +EXEC SQL INCLUDE sqlca; + +int au_io_0004_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM au_io_0004_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0004_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int au_io_0004_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE au_io_0004_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0004_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long au_io_0004_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM au_io_0004_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0004_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/au_io_0005.c b/app/dbio/au_io_0005.c new file mode 100644 index 0000000..4450ccd --- /dev/null +++ b/app/dbio/au_io_0005.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/au_io_0005.pgc" +/* @tier easy @module au @transform authorization-dbio */ +/* + * au_io_0005.pgc - 승인한도 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "au_io_0005.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/au_io_0005.pgc" + + +int au_io_0005_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/au_io_0005.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/au_io_0005.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/au_io_0005.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from au_io_0005_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/au_io_0005.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0005_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int au_io_0005_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/au_io_0005.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/au_io_0005.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/au_io_0005.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update au_io_0005_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/au_io_0005.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0005_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long au_io_0005_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/au_io_0005.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/au_io_0005.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/au_io_0005.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from au_io_0005_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/au_io_0005.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0005_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/au_io_0005.pgc b/app/dbio/au_io_0005.pgc new file mode 100644 index 0000000..32019d6 --- /dev/null +++ b/app/dbio/au_io_0005.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module au @transform authorization-dbio */ +/* + * au_io_0005.pgc - 승인한도 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "au_io_0005.h" + +EXEC SQL INCLUDE sqlca; + +int au_io_0005_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM au_io_0005_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0005_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int au_io_0005_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE au_io_0005_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0005_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long au_io_0005_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM au_io_0005_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0005_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/au_io_0006.c b/app/dbio/au_io_0006.c new file mode 100644 index 0000000..6caf83a --- /dev/null +++ b/app/dbio/au_io_0006.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/au_io_0006.pgc" +/* @tier medium @module au @transform authorization-dbio */ +/* + * au_io_0006.pgc - 승인한도 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "au_io_0006.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/au_io_0006.pgc" + + +int au_io_0006_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/au_io_0006.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/au_io_0006.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/au_io_0006.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from au_io_0006_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/au_io_0006.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0006_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int au_io_0006_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/au_io_0006.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/au_io_0006.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/au_io_0006.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update au_io_0006_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/au_io_0006.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0006_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long au_io_0006_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/au_io_0006.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/au_io_0006.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/au_io_0006.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from au_io_0006_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/au_io_0006.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0006_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/au_io_0006.pgc b/app/dbio/au_io_0006.pgc new file mode 100644 index 0000000..3aa3f7b --- /dev/null +++ b/app/dbio/au_io_0006.pgc @@ -0,0 +1,92 @@ +/* @tier medium @module au @transform authorization-dbio */ +/* + * au_io_0006.pgc - 승인한도 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "au_io_0006.h" + +EXEC SQL INCLUDE sqlca; + +int au_io_0006_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM au_io_0006_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0006_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int au_io_0006_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE au_io_0006_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0006_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long au_io_0006_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM au_io_0006_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0006_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/au_io_0007.c b/app/dbio/au_io_0007.c new file mode 100644 index 0000000..6881149 --- /dev/null +++ b/app/dbio/au_io_0007.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/au_io_0007.pgc" +/* @tier easy @module au @transform authorization-dbio */ +/* + * au_io_0007.pgc - 승인한도 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "au_io_0007.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/au_io_0007.pgc" + + +int au_io_0007_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/au_io_0007.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/au_io_0007.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/au_io_0007.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from au_io_0007_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/au_io_0007.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0007_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int au_io_0007_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/au_io_0007.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/au_io_0007.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/au_io_0007.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update au_io_0007_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/au_io_0007.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0007_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long au_io_0007_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/au_io_0007.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/au_io_0007.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/au_io_0007.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from au_io_0007_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/au_io_0007.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0007_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/au_io_0007.pgc b/app/dbio/au_io_0007.pgc new file mode 100644 index 0000000..3445134 --- /dev/null +++ b/app/dbio/au_io_0007.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module au @transform authorization-dbio */ +/* + * au_io_0007.pgc - 승인한도 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "au_io_0007.h" + +EXEC SQL INCLUDE sqlca; + +int au_io_0007_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM au_io_0007_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0007_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int au_io_0007_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE au_io_0007_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0007_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long au_io_0007_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM au_io_0007_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0007_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/au_io_0008.c b/app/dbio/au_io_0008.c new file mode 100644 index 0000000..5251367 --- /dev/null +++ b/app/dbio/au_io_0008.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/au_io_0008.pgc" +/* @tier hard @module au @transform authorization-dbio */ +/* + * au_io_0008.pgc - 승인한도 보조 DBIO (ECPG) [tier=hard] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "au_io_0008.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/au_io_0008.pgc" + + +int au_io_0008_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/au_io_0008.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/au_io_0008.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/au_io_0008.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from au_io_0008_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/au_io_0008.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0008_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int au_io_0008_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/au_io_0008.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/au_io_0008.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/au_io_0008.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update au_io_0008_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/au_io_0008.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0008_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long au_io_0008_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/au_io_0008.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/au_io_0008.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/au_io_0008.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from au_io_0008_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/au_io_0008.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0008_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/au_io_0008.pgc b/app/dbio/au_io_0008.pgc new file mode 100644 index 0000000..17a2ee8 --- /dev/null +++ b/app/dbio/au_io_0008.pgc @@ -0,0 +1,92 @@ +/* @tier hard @module au @transform authorization-dbio */ +/* + * au_io_0008.pgc - 승인한도 보조 DBIO (ECPG) [tier=hard] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "au_io_0008.h" + +EXEC SQL INCLUDE sqlca; + +int au_io_0008_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM au_io_0008_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0008_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int au_io_0008_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE au_io_0008_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0008_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long au_io_0008_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM au_io_0008_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0008_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/au_io_0009.c b/app/dbio/au_io_0009.c new file mode 100644 index 0000000..b42e871 --- /dev/null +++ b/app/dbio/au_io_0009.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/au_io_0009.pgc" +/* @tier easy @module au @transform authorization-dbio */ +/* + * au_io_0009.pgc - 승인한도 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "au_io_0009.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/au_io_0009.pgc" + + +int au_io_0009_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/au_io_0009.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/au_io_0009.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/au_io_0009.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from au_io_0009_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/au_io_0009.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0009_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int au_io_0009_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/au_io_0009.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/au_io_0009.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/au_io_0009.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update au_io_0009_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/au_io_0009.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0009_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long au_io_0009_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/au_io_0009.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/au_io_0009.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/au_io_0009.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from au_io_0009_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/au_io_0009.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0009_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/au_io_0009.pgc b/app/dbio/au_io_0009.pgc new file mode 100644 index 0000000..2dfda02 --- /dev/null +++ b/app/dbio/au_io_0009.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module au @transform authorization-dbio */ +/* + * au_io_0009.pgc - 승인한도 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "au_io_0009.h" + +EXEC SQL INCLUDE sqlca; + +int au_io_0009_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM au_io_0009_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0009_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int au_io_0009_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE au_io_0009_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0009_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long au_io_0009_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM au_io_0009_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0009_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/au_io_0010.c b/app/dbio/au_io_0010.c new file mode 100644 index 0000000..1a9e450 --- /dev/null +++ b/app/dbio/au_io_0010.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/au_io_0010.pgc" +/* @tier easy @module au @transform authorization-dbio */ +/* + * au_io_0010.pgc - 승인한도 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "au_io_0010.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/au_io_0010.pgc" + + +int au_io_0010_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/au_io_0010.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/au_io_0010.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/au_io_0010.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from au_io_0010_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/au_io_0010.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0010_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int au_io_0010_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/au_io_0010.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/au_io_0010.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/au_io_0010.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update au_io_0010_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/au_io_0010.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0010_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long au_io_0010_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/au_io_0010.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/au_io_0010.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/au_io_0010.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from au_io_0010_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/au_io_0010.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0010_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/au_io_0010.pgc b/app/dbio/au_io_0010.pgc new file mode 100644 index 0000000..cd5db21 --- /dev/null +++ b/app/dbio/au_io_0010.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module au @transform authorization-dbio */ +/* + * au_io_0010.pgc - 승인한도 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "au_io_0010.h" + +EXEC SQL INCLUDE sqlca; + +int au_io_0010_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM au_io_0010_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0010_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int au_io_0010_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE au_io_0010_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0010_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long au_io_0010_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM au_io_0010_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0010_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/au_io_0011.c b/app/dbio/au_io_0011.c new file mode 100644 index 0000000..fc54471 --- /dev/null +++ b/app/dbio/au_io_0011.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/au_io_0011.pgc" +/* @tier medium @module au @transform authorization-dbio */ +/* + * au_io_0011.pgc - 승인한도 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "au_io_0011.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/au_io_0011.pgc" + + +int au_io_0011_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/au_io_0011.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/au_io_0011.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/au_io_0011.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from au_io_0011_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/au_io_0011.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0011_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int au_io_0011_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/au_io_0011.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/au_io_0011.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/au_io_0011.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update au_io_0011_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/au_io_0011.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0011_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long au_io_0011_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/au_io_0011.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/au_io_0011.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/au_io_0011.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from au_io_0011_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/au_io_0011.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0011_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/au_io_0011.pgc b/app/dbio/au_io_0011.pgc new file mode 100644 index 0000000..508273b --- /dev/null +++ b/app/dbio/au_io_0011.pgc @@ -0,0 +1,92 @@ +/* @tier medium @module au @transform authorization-dbio */ +/* + * au_io_0011.pgc - 승인한도 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "au_io_0011.h" + +EXEC SQL INCLUDE sqlca; + +int au_io_0011_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM au_io_0011_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0011_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int au_io_0011_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE au_io_0011_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0011_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long au_io_0011_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM au_io_0011_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0011_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/au_io_0012.c b/app/dbio/au_io_0012.c new file mode 100644 index 0000000..5fe9af1 --- /dev/null +++ b/app/dbio/au_io_0012.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/au_io_0012.pgc" +/* @tier easy @module au @transform authorization-dbio */ +/* + * au_io_0012.pgc - 승인한도 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "au_io_0012.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/au_io_0012.pgc" + + +int au_io_0012_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/au_io_0012.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/au_io_0012.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/au_io_0012.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from au_io_0012_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/au_io_0012.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0012_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int au_io_0012_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/au_io_0012.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/au_io_0012.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/au_io_0012.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update au_io_0012_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/au_io_0012.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0012_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long au_io_0012_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/au_io_0012.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/au_io_0012.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/au_io_0012.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from au_io_0012_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/au_io_0012.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0012_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/au_io_0012.pgc b/app/dbio/au_io_0012.pgc new file mode 100644 index 0000000..5a465cf --- /dev/null +++ b/app/dbio/au_io_0012.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module au @transform authorization-dbio */ +/* + * au_io_0012.pgc - 승인한도 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "au_io_0012.h" + +EXEC SQL INCLUDE sqlca; + +int au_io_0012_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM au_io_0012_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0012_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int au_io_0012_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE au_io_0012_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0012_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long au_io_0012_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM au_io_0012_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0012_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/au_io_0013.c b/app/dbio/au_io_0013.c new file mode 100644 index 0000000..71e5190 --- /dev/null +++ b/app/dbio/au_io_0013.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/au_io_0013.pgc" +/* @tier medium @module au @transform authorization-dbio */ +/* + * au_io_0013.pgc - 승인한도 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "au_io_0013.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/au_io_0013.pgc" + + +int au_io_0013_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/au_io_0013.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/au_io_0013.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/au_io_0013.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from au_io_0013_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/au_io_0013.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0013_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int au_io_0013_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/au_io_0013.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/au_io_0013.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/au_io_0013.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update au_io_0013_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/au_io_0013.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0013_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long au_io_0013_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/au_io_0013.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/au_io_0013.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/au_io_0013.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from au_io_0013_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/au_io_0013.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0013_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/au_io_0013.pgc b/app/dbio/au_io_0013.pgc new file mode 100644 index 0000000..b0b0383 --- /dev/null +++ b/app/dbio/au_io_0013.pgc @@ -0,0 +1,92 @@ +/* @tier medium @module au @transform authorization-dbio */ +/* + * au_io_0013.pgc - 승인한도 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "au_io_0013.h" + +EXEC SQL INCLUDE sqlca; + +int au_io_0013_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM au_io_0013_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0013_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int au_io_0013_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE au_io_0013_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0013_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long au_io_0013_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM au_io_0013_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0013_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/au_io_0014.c b/app/dbio/au_io_0014.c new file mode 100644 index 0000000..21e7395 --- /dev/null +++ b/app/dbio/au_io_0014.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/au_io_0014.pgc" +/* @tier easy @module au @transform authorization-dbio */ +/* + * au_io_0014.pgc - 승인한도 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "au_io_0014.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/au_io_0014.pgc" + + +int au_io_0014_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/au_io_0014.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/au_io_0014.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/au_io_0014.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from au_io_0014_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/au_io_0014.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0014_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int au_io_0014_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/au_io_0014.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/au_io_0014.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/au_io_0014.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update au_io_0014_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/au_io_0014.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0014_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long au_io_0014_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/au_io_0014.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/au_io_0014.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/au_io_0014.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from au_io_0014_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/au_io_0014.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0014_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/au_io_0014.pgc b/app/dbio/au_io_0014.pgc new file mode 100644 index 0000000..07e07ec --- /dev/null +++ b/app/dbio/au_io_0014.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module au @transform authorization-dbio */ +/* + * au_io_0014.pgc - 승인한도 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "au_io_0014.h" + +EXEC SQL INCLUDE sqlca; + +int au_io_0014_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM au_io_0014_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0014_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int au_io_0014_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE au_io_0014_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0014_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long au_io_0014_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM au_io_0014_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0014_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/au_io_0015.c b/app/dbio/au_io_0015.c new file mode 100644 index 0000000..64a4deb --- /dev/null +++ b/app/dbio/au_io_0015.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/au_io_0015.pgc" +/* @tier medium @module au @transform authorization-dbio */ +/* + * au_io_0015.pgc - 승인한도 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "au_io_0015.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/au_io_0015.pgc" + + +int au_io_0015_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/au_io_0015.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/au_io_0015.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/au_io_0015.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from au_io_0015_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/au_io_0015.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0015_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int au_io_0015_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/au_io_0015.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/au_io_0015.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/au_io_0015.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update au_io_0015_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/au_io_0015.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0015_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long au_io_0015_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/au_io_0015.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/au_io_0015.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/au_io_0015.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from au_io_0015_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/au_io_0015.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0015_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/au_io_0015.pgc b/app/dbio/au_io_0015.pgc new file mode 100644 index 0000000..4fe4e86 --- /dev/null +++ b/app/dbio/au_io_0015.pgc @@ -0,0 +1,92 @@ +/* @tier medium @module au @transform authorization-dbio */ +/* + * au_io_0015.pgc - 승인한도 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "au_io_0015.h" + +EXEC SQL INCLUDE sqlca; + +int au_io_0015_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM au_io_0015_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0015_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int au_io_0015_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE au_io_0015_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0015_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long au_io_0015_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM au_io_0015_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0015_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/au_io_0016.c b/app/dbio/au_io_0016.c new file mode 100644 index 0000000..5b88a8b --- /dev/null +++ b/app/dbio/au_io_0016.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/au_io_0016.pgc" +/* @tier easy @module au @transform authorization-dbio */ +/* + * au_io_0016.pgc - 승인한도 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "au_io_0016.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/au_io_0016.pgc" + + +int au_io_0016_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/au_io_0016.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/au_io_0016.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/au_io_0016.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from au_io_0016_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/au_io_0016.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0016_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int au_io_0016_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/au_io_0016.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/au_io_0016.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/au_io_0016.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update au_io_0016_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/au_io_0016.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0016_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long au_io_0016_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/au_io_0016.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/au_io_0016.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/au_io_0016.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from au_io_0016_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/au_io_0016.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0016_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/au_io_0016.pgc b/app/dbio/au_io_0016.pgc new file mode 100644 index 0000000..2204cee --- /dev/null +++ b/app/dbio/au_io_0016.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module au @transform authorization-dbio */ +/* + * au_io_0016.pgc - 승인한도 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "au_io_0016.h" + +EXEC SQL INCLUDE sqlca; + +int au_io_0016_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM au_io_0016_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0016_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int au_io_0016_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE au_io_0016_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0016_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long au_io_0016_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM au_io_0016_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0016_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/au_io_0017.c b/app/dbio/au_io_0017.c new file mode 100644 index 0000000..99f1561 --- /dev/null +++ b/app/dbio/au_io_0017.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/au_io_0017.pgc" +/* @tier hard @module au @transform authorization-dbio */ +/* + * au_io_0017.pgc - 승인한도 보조 DBIO (ECPG) [tier=hard] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "au_io_0017.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/au_io_0017.pgc" + + +int au_io_0017_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/au_io_0017.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/au_io_0017.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/au_io_0017.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from au_io_0017_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/au_io_0017.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0017_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int au_io_0017_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/au_io_0017.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/au_io_0017.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/au_io_0017.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update au_io_0017_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/au_io_0017.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0017_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long au_io_0017_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/au_io_0017.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/au_io_0017.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/au_io_0017.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from au_io_0017_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/au_io_0017.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0017_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/au_io_0017.pgc b/app/dbio/au_io_0017.pgc new file mode 100644 index 0000000..c4e2b33 --- /dev/null +++ b/app/dbio/au_io_0017.pgc @@ -0,0 +1,92 @@ +/* @tier hard @module au @transform authorization-dbio */ +/* + * au_io_0017.pgc - 승인한도 보조 DBIO (ECPG) [tier=hard] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "au_io_0017.h" + +EXEC SQL INCLUDE sqlca; + +int au_io_0017_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM au_io_0017_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0017_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int au_io_0017_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE au_io_0017_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0017_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long au_io_0017_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM au_io_0017_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0017_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/au_io_0018.c b/app/dbio/au_io_0018.c new file mode 100644 index 0000000..dcea524 --- /dev/null +++ b/app/dbio/au_io_0018.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/au_io_0018.pgc" +/* @tier easy @module au @transform authorization-dbio */ +/* + * au_io_0018.pgc - 승인한도 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "au_io_0018.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/au_io_0018.pgc" + + +int au_io_0018_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/au_io_0018.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/au_io_0018.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/au_io_0018.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from au_io_0018_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/au_io_0018.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0018_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int au_io_0018_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/au_io_0018.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/au_io_0018.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/au_io_0018.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update au_io_0018_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/au_io_0018.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0018_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long au_io_0018_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/au_io_0018.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/au_io_0018.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/au_io_0018.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from au_io_0018_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/au_io_0018.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0018_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/au_io_0018.pgc b/app/dbio/au_io_0018.pgc new file mode 100644 index 0000000..368fe80 --- /dev/null +++ b/app/dbio/au_io_0018.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module au @transform authorization-dbio */ +/* + * au_io_0018.pgc - 승인한도 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "au_io_0018.h" + +EXEC SQL INCLUDE sqlca; + +int au_io_0018_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM au_io_0018_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0018_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int au_io_0018_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE au_io_0018_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0018_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long au_io_0018_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM au_io_0018_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0018_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/au_io_0019.c b/app/dbio/au_io_0019.c new file mode 100644 index 0000000..2848b41 --- /dev/null +++ b/app/dbio/au_io_0019.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/au_io_0019.pgc" +/* @tier hard @module au @transform authorization-dbio */ +/* + * au_io_0019.pgc - 승인한도 보조 DBIO (ECPG) [tier=hard] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "au_io_0019.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/au_io_0019.pgc" + + +int au_io_0019_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/au_io_0019.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/au_io_0019.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/au_io_0019.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from au_io_0019_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/au_io_0019.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0019_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int au_io_0019_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/au_io_0019.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/au_io_0019.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/au_io_0019.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update au_io_0019_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/au_io_0019.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0019_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long au_io_0019_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/au_io_0019.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/au_io_0019.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/au_io_0019.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from au_io_0019_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/au_io_0019.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0019_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/au_io_0019.pgc b/app/dbio/au_io_0019.pgc new file mode 100644 index 0000000..02c725f --- /dev/null +++ b/app/dbio/au_io_0019.pgc @@ -0,0 +1,92 @@ +/* @tier hard @module au @transform authorization-dbio */ +/* + * au_io_0019.pgc - 승인한도 보조 DBIO (ECPG) [tier=hard] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "au_io_0019.h" + +EXEC SQL INCLUDE sqlca; + +int au_io_0019_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM au_io_0019_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0019_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int au_io_0019_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE au_io_0019_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0019_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long au_io_0019_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM au_io_0019_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0019_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/au_io_0020.c b/app/dbio/au_io_0020.c new file mode 100644 index 0000000..588a388 --- /dev/null +++ b/app/dbio/au_io_0020.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/au_io_0020.pgc" +/* @tier easy @module au @transform authorization-dbio */ +/* + * au_io_0020.pgc - 승인한도 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "au_io_0020.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/au_io_0020.pgc" + + +int au_io_0020_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/au_io_0020.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/au_io_0020.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/au_io_0020.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from au_io_0020_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/au_io_0020.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0020_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int au_io_0020_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/au_io_0020.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/au_io_0020.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/au_io_0020.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update au_io_0020_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/au_io_0020.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0020_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long au_io_0020_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/au_io_0020.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/au_io_0020.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/au_io_0020.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from au_io_0020_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/au_io_0020.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0020_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/au_io_0020.pgc b/app/dbio/au_io_0020.pgc new file mode 100644 index 0000000..18771a0 --- /dev/null +++ b/app/dbio/au_io_0020.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module au @transform authorization-dbio */ +/* + * au_io_0020.pgc - 승인한도 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "au_io_0020.h" + +EXEC SQL INCLUDE sqlca; + +int au_io_0020_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM au_io_0020_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0020_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int au_io_0020_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE au_io_0020_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0020_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long au_io_0020_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM au_io_0020_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0020_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/au_io_0021.c b/app/dbio/au_io_0021.c new file mode 100644 index 0000000..9fccf30 --- /dev/null +++ b/app/dbio/au_io_0021.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/au_io_0021.pgc" +/* @tier easy @module au @transform authorization-dbio */ +/* + * au_io_0021.pgc - 승인한도 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "au_io_0021.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/au_io_0021.pgc" + + +int au_io_0021_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/au_io_0021.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/au_io_0021.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/au_io_0021.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from au_io_0021_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/au_io_0021.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0021_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int au_io_0021_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/au_io_0021.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/au_io_0021.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/au_io_0021.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update au_io_0021_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/au_io_0021.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0021_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long au_io_0021_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/au_io_0021.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/au_io_0021.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/au_io_0021.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from au_io_0021_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/au_io_0021.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0021_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/au_io_0021.pgc b/app/dbio/au_io_0021.pgc new file mode 100644 index 0000000..2838813 --- /dev/null +++ b/app/dbio/au_io_0021.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module au @transform authorization-dbio */ +/* + * au_io_0021.pgc - 승인한도 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "au_io_0021.h" + +EXEC SQL INCLUDE sqlca; + +int au_io_0021_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM au_io_0021_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0021_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int au_io_0021_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE au_io_0021_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0021_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long au_io_0021_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM au_io_0021_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0021_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/au_io_0022.c b/app/dbio/au_io_0022.c new file mode 100644 index 0000000..a9bf845 --- /dev/null +++ b/app/dbio/au_io_0022.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/au_io_0022.pgc" +/* @tier medium @module au @transform authorization-dbio */ +/* + * au_io_0022.pgc - 승인한도 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "au_io_0022.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/au_io_0022.pgc" + + +int au_io_0022_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/au_io_0022.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/au_io_0022.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/au_io_0022.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from au_io_0022_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/au_io_0022.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0022_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int au_io_0022_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/au_io_0022.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/au_io_0022.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/au_io_0022.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update au_io_0022_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/au_io_0022.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0022_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long au_io_0022_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/au_io_0022.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/au_io_0022.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/au_io_0022.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from au_io_0022_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/au_io_0022.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0022_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/au_io_0022.pgc b/app/dbio/au_io_0022.pgc new file mode 100644 index 0000000..bd1836c --- /dev/null +++ b/app/dbio/au_io_0022.pgc @@ -0,0 +1,92 @@ +/* @tier medium @module au @transform authorization-dbio */ +/* + * au_io_0022.pgc - 승인한도 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "au_io_0022.h" + +EXEC SQL INCLUDE sqlca; + +int au_io_0022_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM au_io_0022_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0022_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int au_io_0022_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE au_io_0022_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0022_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long au_io_0022_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM au_io_0022_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0022_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/au_io_0023.c b/app/dbio/au_io_0023.c new file mode 100644 index 0000000..f182abb --- /dev/null +++ b/app/dbio/au_io_0023.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/au_io_0023.pgc" +/* @tier easy @module au @transform authorization-dbio */ +/* + * au_io_0023.pgc - 승인한도 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "au_io_0023.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/au_io_0023.pgc" + + +int au_io_0023_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/au_io_0023.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/au_io_0023.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/au_io_0023.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from au_io_0023_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/au_io_0023.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0023_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int au_io_0023_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/au_io_0023.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/au_io_0023.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/au_io_0023.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update au_io_0023_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/au_io_0023.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0023_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long au_io_0023_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/au_io_0023.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/au_io_0023.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/au_io_0023.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from au_io_0023_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/au_io_0023.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0023_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/au_io_0023.pgc b/app/dbio/au_io_0023.pgc new file mode 100644 index 0000000..be687ac --- /dev/null +++ b/app/dbio/au_io_0023.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module au @transform authorization-dbio */ +/* + * au_io_0023.pgc - 승인한도 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "au_io_0023.h" + +EXEC SQL INCLUDE sqlca; + +int au_io_0023_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM au_io_0023_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0023_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int au_io_0023_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE au_io_0023_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0023_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long au_io_0023_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM au_io_0023_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0023_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/au_io_0024.c b/app/dbio/au_io_0024.c new file mode 100644 index 0000000..4ecaee9 --- /dev/null +++ b/app/dbio/au_io_0024.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/au_io_0024.pgc" +/* @tier medium @module au @transform authorization-dbio */ +/* + * au_io_0024.pgc - 승인한도 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "au_io_0024.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/au_io_0024.pgc" + + +int au_io_0024_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/au_io_0024.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/au_io_0024.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/au_io_0024.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from au_io_0024_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/au_io_0024.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0024_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int au_io_0024_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/au_io_0024.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/au_io_0024.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/au_io_0024.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update au_io_0024_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/au_io_0024.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0024_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long au_io_0024_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/au_io_0024.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/au_io_0024.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/au_io_0024.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from au_io_0024_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/au_io_0024.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0024_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/au_io_0024.pgc b/app/dbio/au_io_0024.pgc new file mode 100644 index 0000000..d617cc9 --- /dev/null +++ b/app/dbio/au_io_0024.pgc @@ -0,0 +1,92 @@ +/* @tier medium @module au @transform authorization-dbio */ +/* + * au_io_0024.pgc - 승인한도 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "au_io_0024.h" + +EXEC SQL INCLUDE sqlca; + +int au_io_0024_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM au_io_0024_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0024_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int au_io_0024_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE au_io_0024_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0024_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long au_io_0024_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM au_io_0024_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0024_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/au_io_0025.c b/app/dbio/au_io_0025.c new file mode 100644 index 0000000..9a20bac --- /dev/null +++ b/app/dbio/au_io_0025.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/au_io_0025.pgc" +/* @tier easy @module au @transform authorization-dbio */ +/* + * au_io_0025.pgc - 승인한도 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "au_io_0025.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/au_io_0025.pgc" + + +int au_io_0025_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/au_io_0025.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/au_io_0025.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/au_io_0025.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from au_io_0025_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/au_io_0025.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0025_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int au_io_0025_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/au_io_0025.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/au_io_0025.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/au_io_0025.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update au_io_0025_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/au_io_0025.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0025_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long au_io_0025_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/au_io_0025.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/au_io_0025.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/au_io_0025.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from au_io_0025_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/au_io_0025.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0025_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/au_io_0025.pgc b/app/dbio/au_io_0025.pgc new file mode 100644 index 0000000..58337a2 --- /dev/null +++ b/app/dbio/au_io_0025.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module au @transform authorization-dbio */ +/* + * au_io_0025.pgc - 승인한도 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "au_io_0025.h" + +EXEC SQL INCLUDE sqlca; + +int au_io_0025_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM au_io_0025_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0025_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int au_io_0025_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE au_io_0025_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0025_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long au_io_0025_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM au_io_0025_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0025_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/au_io_0026.c b/app/dbio/au_io_0026.c new file mode 100644 index 0000000..438b67b --- /dev/null +++ b/app/dbio/au_io_0026.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/au_io_0026.pgc" +/* @tier medium @module au @transform authorization-dbio */ +/* + * au_io_0026.pgc - 승인한도 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "au_io_0026.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/au_io_0026.pgc" + + +int au_io_0026_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/au_io_0026.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/au_io_0026.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/au_io_0026.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from au_io_0026_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/au_io_0026.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0026_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int au_io_0026_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/au_io_0026.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/au_io_0026.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/au_io_0026.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update au_io_0026_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/au_io_0026.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0026_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long au_io_0026_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/au_io_0026.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/au_io_0026.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/au_io_0026.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from au_io_0026_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/au_io_0026.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0026_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/au_io_0026.pgc b/app/dbio/au_io_0026.pgc new file mode 100644 index 0000000..83e3ded --- /dev/null +++ b/app/dbio/au_io_0026.pgc @@ -0,0 +1,92 @@ +/* @tier medium @module au @transform authorization-dbio */ +/* + * au_io_0026.pgc - 승인한도 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "au_io_0026.h" + +EXEC SQL INCLUDE sqlca; + +int au_io_0026_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM au_io_0026_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0026_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int au_io_0026_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE au_io_0026_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0026_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long au_io_0026_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM au_io_0026_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0026_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/au_io_0027.c b/app/dbio/au_io_0027.c new file mode 100644 index 0000000..9fe8933 --- /dev/null +++ b/app/dbio/au_io_0027.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/au_io_0027.pgc" +/* @tier easy @module au @transform authorization-dbio */ +/* + * au_io_0027.pgc - 승인한도 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "au_io_0027.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/au_io_0027.pgc" + + +int au_io_0027_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/au_io_0027.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/au_io_0027.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/au_io_0027.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from au_io_0027_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/au_io_0027.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0027_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int au_io_0027_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/au_io_0027.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/au_io_0027.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/au_io_0027.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update au_io_0027_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/au_io_0027.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0027_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long au_io_0027_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/au_io_0027.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/au_io_0027.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/au_io_0027.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from au_io_0027_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/au_io_0027.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0027_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/au_io_0027.pgc b/app/dbio/au_io_0027.pgc new file mode 100644 index 0000000..df9a08c --- /dev/null +++ b/app/dbio/au_io_0027.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module au @transform authorization-dbio */ +/* + * au_io_0027.pgc - 승인한도 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "au_io_0027.h" + +EXEC SQL INCLUDE sqlca; + +int au_io_0027_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM au_io_0027_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0027_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int au_io_0027_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE au_io_0027_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0027_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long au_io_0027_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM au_io_0027_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("au_io_0027_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/cl_dbio_main.c b/app/dbio/cl_dbio_main.c new file mode 100644 index 0000000..1eb8892 --- /dev/null +++ b/app/dbio/cl_dbio_main.c @@ -0,0 +1,399 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/cl_dbio_main.pgc" +/* @tier medium @module cl @transform closing-dbio */ +/* + * cl_dbio_main.pgc - 마감 표준 DBIO (ECPG 임베디드 SQL) + * + * cl_core.h 의 표준 API 를 cl_ledger 테이블에 대해 구현한다. + * 온라인/배치 프로그램은 이 함수들만 호출한다 (self-contained). + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "cl_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/dbio/cl_dbio_main.pgc" + + +int cl_dbio_connect(const char *target) +{ + /* exec sql begin declare section */ + + +#line 20 "app/dbio/cl_dbio_main.pgc" + const char * h_target ; +/* exec sql end declare section */ +#line 21 "app/dbio/cl_dbio_main.pgc" + + + h_target = (target && target[0]) ? target : "acquire@localhost"; + + { ECPGconnect(__LINE__, 0, h_target , NULL, NULL , NULL, 0); } +#line 25 "app/dbio/cl_dbio_main.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl CONNECT"); + return TX_EDB; + } + tx_log(TX_LOG_INFO, "[cl] DB 접속 완료 target=%s", h_target); + return TX_OK; +} + +int cl_dbio_disconnect(void) +{ + { ECPGdisconnect(__LINE__, "CURRENT");} +#line 36 "app/dbio/cl_dbio_main.pgc" + + return TX_OK; +} + +int cl_rec_insert(const cl_rec_t *rec) +{ + /* exec sql begin declare section */ + + + + + + + + +#line 43 "app/dbio/cl_dbio_main.pgc" + char h_key [ 16 ] ; + +#line 44 "app/dbio/cl_dbio_main.pgc" + char h_merch_id [ 16 ] ; + +#line 45 "app/dbio/cl_dbio_main.pgc" + char h_card_no [ 20 ] ; + +#line 46 "app/dbio/cl_dbio_main.pgc" + long h_amount ; + +#line 47 "app/dbio/cl_dbio_main.pgc" + char h_biz_date [ 9 ] ; + +#line 48 "app/dbio/cl_dbio_main.pgc" + char h_status [ 2 ] ; + +#line 49 "app/dbio/cl_dbio_main.pgc" + long h_fee ; +/* exec sql end declare section */ +#line 50 "app/dbio/cl_dbio_main.pgc" + + + if (!rec) + return TX_EINVAL; + + strncpy(h_key, rec->key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + strncpy(h_merch_id, rec->merch_id, sizeof(h_merch_id) - 1); + h_merch_id[sizeof(h_merch_id) - 1] = '\0'; + strncpy(h_card_no, rec->card_no, sizeof(h_card_no) - 1); + h_card_no[sizeof(h_card_no) - 1] = '\0'; + strncpy(h_biz_date, rec->biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + strncpy(h_status, rec->status, sizeof(h_status) - 1); + h_status[sizeof(h_status) - 1] = '\0'; + h_amount = rec->amount; + h_fee = rec->fee; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into cl_ledger ( key , merch_id , card_no , amount , biz_date , status , fee ) values ( $1 , $2 , $3 , $4 , $5 , $6 , $7 )", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_card_no),(long)20,(long)1,(20)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_status),(long)2,(long)1,(2)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_fee),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 71 "app/dbio/cl_dbio_main.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_rec_insert"); + return TX_EDB; + } + return TX_OK; +} + +int cl_rec_select(const char *key, cl_rec_t *out) +{ + /* exec sql begin declare section */ + + + + + + + + +#line 83 "app/dbio/cl_dbio_main.pgc" + char h_key [ 16 ] ; + +#line 84 "app/dbio/cl_dbio_main.pgc" + char h_merch_id [ 16 ] ; + +#line 85 "app/dbio/cl_dbio_main.pgc" + char h_card_no [ 20 ] ; + +#line 86 "app/dbio/cl_dbio_main.pgc" + long h_amount ; + +#line 87 "app/dbio/cl_dbio_main.pgc" + char h_biz_date [ 9 ] ; + +#line 88 "app/dbio/cl_dbio_main.pgc" + char h_status [ 2 ] ; + +#line 89 "app/dbio/cl_dbio_main.pgc" + long h_fee ; +/* exec sql end declare section */ +#line 90 "app/dbio/cl_dbio_main.pgc" + + + if (!key || !out) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select merch_id , card_no , amount , biz_date , status , fee from cl_ledger where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_card_no),(long)20,(long)1,(20)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_status),(long)2,(long)1,(2)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_fee),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 101 "app/dbio/cl_dbio_main.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_rec_select"); + return TX_EDB; + } + + memset(out, 0, sizeof(*out)); + strncpy(out->key, h_key, sizeof(out->key) - 1); + strncpy(out->merch_id, h_merch_id, sizeof(out->merch_id) - 1); + strncpy(out->card_no, h_card_no, sizeof(out->card_no) - 1); + strncpy(out->biz_date, h_biz_date, sizeof(out->biz_date) - 1); + strncpy(out->status, h_status, sizeof(out->status) - 1); + out->amount = h_amount; + out->fee = h_fee; + return TX_OK; +} + +int cl_rec_update_status(const char *key, const char *status) +{ + /* exec sql begin declare section */ + + + +#line 124 "app/dbio/cl_dbio_main.pgc" + char h_key [ 16 ] ; + +#line 125 "app/dbio/cl_dbio_main.pgc" + char h_status [ 2 ] ; +/* exec sql end declare section */ +#line 126 "app/dbio/cl_dbio_main.pgc" + + + if (!key || !status) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + strncpy(h_status, status, sizeof(h_status) - 1); + h_status[sizeof(h_status) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update cl_ledger set status = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_char,(h_status),(long)2,(long)1,(2)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 138 "app/dbio/cl_dbio_main.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_rec_update_status"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long cl_rec_count(const char *biz_date, const char *status) +{ + /* exec sql begin declare section */ + + + + +#line 152 "app/dbio/cl_dbio_main.pgc" + char h_biz_date [ 9 ] ; + +#line 153 "app/dbio/cl_dbio_main.pgc" + char h_status [ 2 ] ; + +#line 154 "app/dbio/cl_dbio_main.pgc" + int h_cnt ; +/* exec sql end declare section */ +#line 155 "app/dbio/cl_dbio_main.pgc" + + + if (!biz_date || !status) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + strncpy(h_status, status, sizeof(h_status) - 1); + h_status[sizeof(h_status) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select count ( * ) from cl_ledger where biz_date = $1 and status = $2 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_status),(long)2,(long)1,(2)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_int,&(h_cnt),(long)1,(long)1,sizeof(int), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 169 "app/dbio/cl_dbio_main.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_rec_count"); + return -1; + } + return (long)h_cnt; +} + +int cl_rec_sum(const char *biz_date, long *out_sum) +{ + /* exec sql begin declare section */ + + + +#line 181 "app/dbio/cl_dbio_main.pgc" + char h_biz_date [ 9 ] ; + +#line 182 "app/dbio/cl_dbio_main.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 183 "app/dbio/cl_dbio_main.pgc" + + + if (!biz_date || !out_sum) + return TX_EINVAL; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from cl_ledger where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 194 "app/dbio/cl_dbio_main.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_rec_sum"); + return TX_EDB; + } + *out_sum = h_sum; + return TX_OK; +} diff --git a/app/dbio/cl_dbio_main.pgc b/app/dbio/cl_dbio_main.pgc new file mode 100644 index 0000000..10b323b --- /dev/null +++ b/app/dbio/cl_dbio_main.pgc @@ -0,0 +1,202 @@ +/* @tier medium @module cl @transform closing-dbio */ +/* + * cl_dbio_main.pgc - 마감 표준 DBIO (ECPG 임베디드 SQL) + * + * cl_core.h 의 표준 API 를 cl_ledger 테이블에 대해 구현한다. + * 온라인/배치 프로그램은 이 함수들만 호출한다 (self-contained). + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "cl_core.h" + +EXEC SQL INCLUDE sqlca; + +int cl_dbio_connect(const char *target) +{ + EXEC SQL BEGIN DECLARE SECTION; + const char *h_target; + EXEC SQL END DECLARE SECTION; + + h_target = (target && target[0]) ? target : "acquire@localhost"; + + EXEC SQL CONNECT TO :h_target; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl CONNECT"); + return TX_EDB; + } + tx_log(TX_LOG_INFO, "[cl] DB 접속 완료 target=%s", h_target); + return TX_OK; +} + +int cl_dbio_disconnect(void) +{ + EXEC SQL DISCONNECT CURRENT; + return TX_OK; +} + +int cl_rec_insert(const cl_rec_t *rec) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + char h_merch_id[16]; + char h_card_no[20]; + long h_amount; + char h_biz_date[9]; + char h_status[2]; + long h_fee; + EXEC SQL END DECLARE SECTION; + + if (!rec) + return TX_EINVAL; + + strncpy(h_key, rec->key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + strncpy(h_merch_id, rec->merch_id, sizeof(h_merch_id) - 1); + h_merch_id[sizeof(h_merch_id) - 1] = '\0'; + strncpy(h_card_no, rec->card_no, sizeof(h_card_no) - 1); + h_card_no[sizeof(h_card_no) - 1] = '\0'; + strncpy(h_biz_date, rec->biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + strncpy(h_status, rec->status, sizeof(h_status) - 1); + h_status[sizeof(h_status) - 1] = '\0'; + h_amount = rec->amount; + h_fee = rec->fee; + + EXEC SQL INSERT INTO cl_ledger + (key, merch_id, card_no, amount, biz_date, status, fee) + VALUES + (:h_key, :h_merch_id, :h_card_no, :h_amount, :h_biz_date, :h_status, :h_fee); + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_rec_insert"); + return TX_EDB; + } + return TX_OK; +} + +int cl_rec_select(const char *key, cl_rec_t *out) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + char h_merch_id[16]; + char h_card_no[20]; + long h_amount; + char h_biz_date[9]; + char h_status[2]; + long h_fee; + EXEC SQL END DECLARE SECTION; + + if (!key || !out) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT merch_id, card_no, amount, biz_date, status, fee + INTO :h_merch_id, :h_card_no, :h_amount, :h_biz_date, :h_status, :h_fee + FROM cl_ledger + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_rec_select"); + return TX_EDB; + } + + memset(out, 0, sizeof(*out)); + strncpy(out->key, h_key, sizeof(out->key) - 1); + strncpy(out->merch_id, h_merch_id, sizeof(out->merch_id) - 1); + strncpy(out->card_no, h_card_no, sizeof(out->card_no) - 1); + strncpy(out->biz_date, h_biz_date, sizeof(out->biz_date) - 1); + strncpy(out->status, h_status, sizeof(out->status) - 1); + out->amount = h_amount; + out->fee = h_fee; + return TX_OK; +} + +int cl_rec_update_status(const char *key, const char *status) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + char h_status[2]; + EXEC SQL END DECLARE SECTION; + + if (!key || !status) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + strncpy(h_status, status, sizeof(h_status) - 1); + h_status[sizeof(h_status) - 1] = '\0'; + + EXEC SQL UPDATE cl_ledger + SET status = :h_status, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_rec_update_status"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long cl_rec_count(const char *biz_date, const char *status) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_status[2]; + int h_cnt; + EXEC SQL END DECLARE SECTION; + + if (!biz_date || !status) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + strncpy(h_status, status, sizeof(h_status) - 1); + h_status[sizeof(h_status) - 1] = '\0'; + + EXEC SQL SELECT count(*) + INTO :h_cnt + FROM cl_ledger + WHERE biz_date = :h_biz_date + AND status = :h_status; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_rec_count"); + return -1; + } + return (long)h_cnt; +} + +int cl_rec_sum(const char *biz_date, long *out_sum) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date || !out_sum) + return TX_EINVAL; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM cl_ledger + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_rec_sum"); + return TX_EDB; + } + *out_sum = h_sum; + return TX_OK; +} diff --git a/app/dbio/cl_io_0001.c b/app/dbio/cl_io_0001.c new file mode 100644 index 0000000..722d759 --- /dev/null +++ b/app/dbio/cl_io_0001.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/cl_io_0001.pgc" +/* @tier easy @module cl @transform closing-dbio */ +/* + * cl_io_0001.pgc - 마감 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "cl_io_0001.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/cl_io_0001.pgc" + + +int cl_io_0001_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/cl_io_0001.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/cl_io_0001.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/cl_io_0001.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from cl_io_0001_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/cl_io_0001.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0001_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int cl_io_0001_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/cl_io_0001.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/cl_io_0001.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/cl_io_0001.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update cl_io_0001_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/cl_io_0001.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0001_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long cl_io_0001_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/cl_io_0001.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/cl_io_0001.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/cl_io_0001.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from cl_io_0001_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/cl_io_0001.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0001_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/cl_io_0001.pgc b/app/dbio/cl_io_0001.pgc new file mode 100644 index 0000000..ba24fd6 --- /dev/null +++ b/app/dbio/cl_io_0001.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module cl @transform closing-dbio */ +/* + * cl_io_0001.pgc - 마감 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "cl_io_0001.h" + +EXEC SQL INCLUDE sqlca; + +int cl_io_0001_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM cl_io_0001_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0001_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int cl_io_0001_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE cl_io_0001_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0001_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long cl_io_0001_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM cl_io_0001_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0001_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/cl_io_0002.c b/app/dbio/cl_io_0002.c new file mode 100644 index 0000000..0188b22 --- /dev/null +++ b/app/dbio/cl_io_0002.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/cl_io_0002.pgc" +/* @tier easy @module cl @transform closing-dbio */ +/* + * cl_io_0002.pgc - 마감 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "cl_io_0002.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/cl_io_0002.pgc" + + +int cl_io_0002_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/cl_io_0002.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/cl_io_0002.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/cl_io_0002.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from cl_io_0002_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/cl_io_0002.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0002_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int cl_io_0002_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/cl_io_0002.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/cl_io_0002.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/cl_io_0002.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update cl_io_0002_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/cl_io_0002.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0002_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long cl_io_0002_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/cl_io_0002.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/cl_io_0002.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/cl_io_0002.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from cl_io_0002_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/cl_io_0002.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0002_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/cl_io_0002.pgc b/app/dbio/cl_io_0002.pgc new file mode 100644 index 0000000..30dccd7 --- /dev/null +++ b/app/dbio/cl_io_0002.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module cl @transform closing-dbio */ +/* + * cl_io_0002.pgc - 마감 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "cl_io_0002.h" + +EXEC SQL INCLUDE sqlca; + +int cl_io_0002_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM cl_io_0002_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0002_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int cl_io_0002_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE cl_io_0002_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0002_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long cl_io_0002_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM cl_io_0002_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0002_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/cl_io_0003.c b/app/dbio/cl_io_0003.c new file mode 100644 index 0000000..4a91da2 --- /dev/null +++ b/app/dbio/cl_io_0003.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/cl_io_0003.pgc" +/* @tier medium @module cl @transform closing-dbio */ +/* + * cl_io_0003.pgc - 마감 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "cl_io_0003.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/cl_io_0003.pgc" + + +int cl_io_0003_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/cl_io_0003.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/cl_io_0003.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/cl_io_0003.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from cl_io_0003_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/cl_io_0003.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0003_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int cl_io_0003_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/cl_io_0003.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/cl_io_0003.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/cl_io_0003.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update cl_io_0003_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/cl_io_0003.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0003_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long cl_io_0003_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/cl_io_0003.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/cl_io_0003.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/cl_io_0003.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from cl_io_0003_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/cl_io_0003.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0003_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/cl_io_0003.pgc b/app/dbio/cl_io_0003.pgc new file mode 100644 index 0000000..5d61359 --- /dev/null +++ b/app/dbio/cl_io_0003.pgc @@ -0,0 +1,92 @@ +/* @tier medium @module cl @transform closing-dbio */ +/* + * cl_io_0003.pgc - 마감 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "cl_io_0003.h" + +EXEC SQL INCLUDE sqlca; + +int cl_io_0003_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM cl_io_0003_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0003_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int cl_io_0003_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE cl_io_0003_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0003_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long cl_io_0003_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM cl_io_0003_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0003_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/cl_io_0004.c b/app/dbio/cl_io_0004.c new file mode 100644 index 0000000..9d8c0ef --- /dev/null +++ b/app/dbio/cl_io_0004.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/cl_io_0004.pgc" +/* @tier easy @module cl @transform closing-dbio */ +/* + * cl_io_0004.pgc - 마감 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "cl_io_0004.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/cl_io_0004.pgc" + + +int cl_io_0004_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/cl_io_0004.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/cl_io_0004.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/cl_io_0004.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from cl_io_0004_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/cl_io_0004.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0004_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int cl_io_0004_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/cl_io_0004.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/cl_io_0004.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/cl_io_0004.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update cl_io_0004_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/cl_io_0004.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0004_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long cl_io_0004_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/cl_io_0004.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/cl_io_0004.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/cl_io_0004.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from cl_io_0004_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/cl_io_0004.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0004_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/cl_io_0004.pgc b/app/dbio/cl_io_0004.pgc new file mode 100644 index 0000000..892178b --- /dev/null +++ b/app/dbio/cl_io_0004.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module cl @transform closing-dbio */ +/* + * cl_io_0004.pgc - 마감 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "cl_io_0004.h" + +EXEC SQL INCLUDE sqlca; + +int cl_io_0004_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM cl_io_0004_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0004_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int cl_io_0004_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE cl_io_0004_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0004_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long cl_io_0004_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM cl_io_0004_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0004_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/cl_io_0005.c b/app/dbio/cl_io_0005.c new file mode 100644 index 0000000..4c62daa --- /dev/null +++ b/app/dbio/cl_io_0005.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/cl_io_0005.pgc" +/* @tier medium @module cl @transform closing-dbio */ +/* + * cl_io_0005.pgc - 마감 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "cl_io_0005.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/cl_io_0005.pgc" + + +int cl_io_0005_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/cl_io_0005.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/cl_io_0005.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/cl_io_0005.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from cl_io_0005_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/cl_io_0005.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0005_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int cl_io_0005_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/cl_io_0005.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/cl_io_0005.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/cl_io_0005.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update cl_io_0005_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/cl_io_0005.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0005_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long cl_io_0005_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/cl_io_0005.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/cl_io_0005.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/cl_io_0005.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from cl_io_0005_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/cl_io_0005.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0005_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/cl_io_0005.pgc b/app/dbio/cl_io_0005.pgc new file mode 100644 index 0000000..7f8bd1b --- /dev/null +++ b/app/dbio/cl_io_0005.pgc @@ -0,0 +1,92 @@ +/* @tier medium @module cl @transform closing-dbio */ +/* + * cl_io_0005.pgc - 마감 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "cl_io_0005.h" + +EXEC SQL INCLUDE sqlca; + +int cl_io_0005_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM cl_io_0005_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0005_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int cl_io_0005_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE cl_io_0005_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0005_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long cl_io_0005_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM cl_io_0005_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0005_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/cl_io_0006.c b/app/dbio/cl_io_0006.c new file mode 100644 index 0000000..fbee7bd --- /dev/null +++ b/app/dbio/cl_io_0006.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/cl_io_0006.pgc" +/* @tier easy @module cl @transform closing-dbio */ +/* + * cl_io_0006.pgc - 마감 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "cl_io_0006.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/cl_io_0006.pgc" + + +int cl_io_0006_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/cl_io_0006.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/cl_io_0006.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/cl_io_0006.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from cl_io_0006_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/cl_io_0006.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0006_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int cl_io_0006_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/cl_io_0006.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/cl_io_0006.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/cl_io_0006.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update cl_io_0006_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/cl_io_0006.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0006_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long cl_io_0006_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/cl_io_0006.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/cl_io_0006.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/cl_io_0006.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from cl_io_0006_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/cl_io_0006.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0006_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/cl_io_0006.pgc b/app/dbio/cl_io_0006.pgc new file mode 100644 index 0000000..076351c --- /dev/null +++ b/app/dbio/cl_io_0006.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module cl @transform closing-dbio */ +/* + * cl_io_0006.pgc - 마감 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "cl_io_0006.h" + +EXEC SQL INCLUDE sqlca; + +int cl_io_0006_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM cl_io_0006_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0006_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int cl_io_0006_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE cl_io_0006_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0006_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long cl_io_0006_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM cl_io_0006_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0006_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/cl_io_0007.c b/app/dbio/cl_io_0007.c new file mode 100644 index 0000000..4776abc --- /dev/null +++ b/app/dbio/cl_io_0007.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/cl_io_0007.pgc" +/* @tier medium @module cl @transform closing-dbio */ +/* + * cl_io_0007.pgc - 마감 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "cl_io_0007.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/cl_io_0007.pgc" + + +int cl_io_0007_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/cl_io_0007.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/cl_io_0007.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/cl_io_0007.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from cl_io_0007_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/cl_io_0007.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0007_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int cl_io_0007_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/cl_io_0007.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/cl_io_0007.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/cl_io_0007.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update cl_io_0007_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/cl_io_0007.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0007_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long cl_io_0007_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/cl_io_0007.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/cl_io_0007.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/cl_io_0007.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from cl_io_0007_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/cl_io_0007.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0007_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/cl_io_0007.pgc b/app/dbio/cl_io_0007.pgc new file mode 100644 index 0000000..155c890 --- /dev/null +++ b/app/dbio/cl_io_0007.pgc @@ -0,0 +1,92 @@ +/* @tier medium @module cl @transform closing-dbio */ +/* + * cl_io_0007.pgc - 마감 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "cl_io_0007.h" + +EXEC SQL INCLUDE sqlca; + +int cl_io_0007_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM cl_io_0007_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0007_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int cl_io_0007_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE cl_io_0007_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0007_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long cl_io_0007_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM cl_io_0007_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0007_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/cl_io_0008.c b/app/dbio/cl_io_0008.c new file mode 100644 index 0000000..e1216da --- /dev/null +++ b/app/dbio/cl_io_0008.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/cl_io_0008.pgc" +/* @tier easy @module cl @transform closing-dbio */ +/* + * cl_io_0008.pgc - 마감 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "cl_io_0008.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/cl_io_0008.pgc" + + +int cl_io_0008_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/cl_io_0008.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/cl_io_0008.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/cl_io_0008.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from cl_io_0008_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/cl_io_0008.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0008_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int cl_io_0008_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/cl_io_0008.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/cl_io_0008.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/cl_io_0008.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update cl_io_0008_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/cl_io_0008.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0008_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long cl_io_0008_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/cl_io_0008.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/cl_io_0008.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/cl_io_0008.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from cl_io_0008_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/cl_io_0008.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0008_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/cl_io_0008.pgc b/app/dbio/cl_io_0008.pgc new file mode 100644 index 0000000..f9d8fcd --- /dev/null +++ b/app/dbio/cl_io_0008.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module cl @transform closing-dbio */ +/* + * cl_io_0008.pgc - 마감 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "cl_io_0008.h" + +EXEC SQL INCLUDE sqlca; + +int cl_io_0008_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM cl_io_0008_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0008_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int cl_io_0008_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE cl_io_0008_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0008_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long cl_io_0008_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM cl_io_0008_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0008_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/cl_io_0009.c b/app/dbio/cl_io_0009.c new file mode 100644 index 0000000..746d91c --- /dev/null +++ b/app/dbio/cl_io_0009.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/cl_io_0009.pgc" +/* @tier hard @module cl @transform closing-dbio */ +/* + * cl_io_0009.pgc - 마감 보조 DBIO (ECPG) [tier=hard] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "cl_io_0009.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/cl_io_0009.pgc" + + +int cl_io_0009_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/cl_io_0009.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/cl_io_0009.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/cl_io_0009.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from cl_io_0009_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/cl_io_0009.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0009_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int cl_io_0009_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/cl_io_0009.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/cl_io_0009.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/cl_io_0009.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update cl_io_0009_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/cl_io_0009.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0009_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long cl_io_0009_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/cl_io_0009.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/cl_io_0009.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/cl_io_0009.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from cl_io_0009_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/cl_io_0009.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0009_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/cl_io_0009.pgc b/app/dbio/cl_io_0009.pgc new file mode 100644 index 0000000..a57cfce --- /dev/null +++ b/app/dbio/cl_io_0009.pgc @@ -0,0 +1,92 @@ +/* @tier hard @module cl @transform closing-dbio */ +/* + * cl_io_0009.pgc - 마감 보조 DBIO (ECPG) [tier=hard] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "cl_io_0009.h" + +EXEC SQL INCLUDE sqlca; + +int cl_io_0009_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM cl_io_0009_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0009_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int cl_io_0009_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE cl_io_0009_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0009_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long cl_io_0009_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM cl_io_0009_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0009_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/cl_io_0010.c b/app/dbio/cl_io_0010.c new file mode 100644 index 0000000..655b337 --- /dev/null +++ b/app/dbio/cl_io_0010.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/cl_io_0010.pgc" +/* @tier easy @module cl @transform closing-dbio */ +/* + * cl_io_0010.pgc - 마감 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "cl_io_0010.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/cl_io_0010.pgc" + + +int cl_io_0010_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/cl_io_0010.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/cl_io_0010.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/cl_io_0010.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from cl_io_0010_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/cl_io_0010.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0010_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int cl_io_0010_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/cl_io_0010.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/cl_io_0010.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/cl_io_0010.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update cl_io_0010_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/cl_io_0010.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0010_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long cl_io_0010_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/cl_io_0010.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/cl_io_0010.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/cl_io_0010.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from cl_io_0010_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/cl_io_0010.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0010_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/cl_io_0010.pgc b/app/dbio/cl_io_0010.pgc new file mode 100644 index 0000000..a335c0f --- /dev/null +++ b/app/dbio/cl_io_0010.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module cl @transform closing-dbio */ +/* + * cl_io_0010.pgc - 마감 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "cl_io_0010.h" + +EXEC SQL INCLUDE sqlca; + +int cl_io_0010_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM cl_io_0010_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0010_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int cl_io_0010_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE cl_io_0010_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0010_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long cl_io_0010_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM cl_io_0010_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0010_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/cl_io_0011.c b/app/dbio/cl_io_0011.c new file mode 100644 index 0000000..b42928f --- /dev/null +++ b/app/dbio/cl_io_0011.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/cl_io_0011.pgc" +/* @tier easy @module cl @transform closing-dbio */ +/* + * cl_io_0011.pgc - 마감 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "cl_io_0011.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/cl_io_0011.pgc" + + +int cl_io_0011_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/cl_io_0011.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/cl_io_0011.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/cl_io_0011.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from cl_io_0011_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/cl_io_0011.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0011_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int cl_io_0011_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/cl_io_0011.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/cl_io_0011.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/cl_io_0011.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update cl_io_0011_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/cl_io_0011.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0011_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long cl_io_0011_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/cl_io_0011.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/cl_io_0011.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/cl_io_0011.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from cl_io_0011_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/cl_io_0011.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0011_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/cl_io_0011.pgc b/app/dbio/cl_io_0011.pgc new file mode 100644 index 0000000..1c4a635 --- /dev/null +++ b/app/dbio/cl_io_0011.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module cl @transform closing-dbio */ +/* + * cl_io_0011.pgc - 마감 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "cl_io_0011.h" + +EXEC SQL INCLUDE sqlca; + +int cl_io_0011_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM cl_io_0011_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0011_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int cl_io_0011_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE cl_io_0011_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0011_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long cl_io_0011_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM cl_io_0011_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0011_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/cl_io_0012.c b/app/dbio/cl_io_0012.c new file mode 100644 index 0000000..1afa8e0 --- /dev/null +++ b/app/dbio/cl_io_0012.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/cl_io_0012.pgc" +/* @tier medium @module cl @transform closing-dbio */ +/* + * cl_io_0012.pgc - 마감 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "cl_io_0012.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/cl_io_0012.pgc" + + +int cl_io_0012_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/cl_io_0012.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/cl_io_0012.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/cl_io_0012.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from cl_io_0012_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/cl_io_0012.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0012_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int cl_io_0012_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/cl_io_0012.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/cl_io_0012.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/cl_io_0012.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update cl_io_0012_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/cl_io_0012.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0012_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long cl_io_0012_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/cl_io_0012.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/cl_io_0012.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/cl_io_0012.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from cl_io_0012_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/cl_io_0012.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0012_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/cl_io_0012.pgc b/app/dbio/cl_io_0012.pgc new file mode 100644 index 0000000..31d19ea --- /dev/null +++ b/app/dbio/cl_io_0012.pgc @@ -0,0 +1,92 @@ +/* @tier medium @module cl @transform closing-dbio */ +/* + * cl_io_0012.pgc - 마감 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "cl_io_0012.h" + +EXEC SQL INCLUDE sqlca; + +int cl_io_0012_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM cl_io_0012_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0012_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int cl_io_0012_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE cl_io_0012_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0012_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long cl_io_0012_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM cl_io_0012_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0012_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/cl_io_0013.c b/app/dbio/cl_io_0013.c new file mode 100644 index 0000000..afffbfe --- /dev/null +++ b/app/dbio/cl_io_0013.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/cl_io_0013.pgc" +/* @tier easy @module cl @transform closing-dbio */ +/* + * cl_io_0013.pgc - 마감 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "cl_io_0013.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/cl_io_0013.pgc" + + +int cl_io_0013_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/cl_io_0013.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/cl_io_0013.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/cl_io_0013.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from cl_io_0013_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/cl_io_0013.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0013_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int cl_io_0013_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/cl_io_0013.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/cl_io_0013.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/cl_io_0013.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update cl_io_0013_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/cl_io_0013.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0013_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long cl_io_0013_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/cl_io_0013.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/cl_io_0013.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/cl_io_0013.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from cl_io_0013_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/cl_io_0013.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0013_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/cl_io_0013.pgc b/app/dbio/cl_io_0013.pgc new file mode 100644 index 0000000..b546811 --- /dev/null +++ b/app/dbio/cl_io_0013.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module cl @transform closing-dbio */ +/* + * cl_io_0013.pgc - 마감 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "cl_io_0013.h" + +EXEC SQL INCLUDE sqlca; + +int cl_io_0013_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM cl_io_0013_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0013_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int cl_io_0013_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE cl_io_0013_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0013_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long cl_io_0013_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM cl_io_0013_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0013_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/cl_io_0014.c b/app/dbio/cl_io_0014.c new file mode 100644 index 0000000..6d7eb31 --- /dev/null +++ b/app/dbio/cl_io_0014.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/cl_io_0014.pgc" +/* @tier medium @module cl @transform closing-dbio */ +/* + * cl_io_0014.pgc - 마감 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "cl_io_0014.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/cl_io_0014.pgc" + + +int cl_io_0014_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/cl_io_0014.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/cl_io_0014.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/cl_io_0014.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from cl_io_0014_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/cl_io_0014.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0014_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int cl_io_0014_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/cl_io_0014.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/cl_io_0014.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/cl_io_0014.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update cl_io_0014_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/cl_io_0014.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0014_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long cl_io_0014_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/cl_io_0014.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/cl_io_0014.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/cl_io_0014.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from cl_io_0014_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/cl_io_0014.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0014_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/cl_io_0014.pgc b/app/dbio/cl_io_0014.pgc new file mode 100644 index 0000000..66989a6 --- /dev/null +++ b/app/dbio/cl_io_0014.pgc @@ -0,0 +1,92 @@ +/* @tier medium @module cl @transform closing-dbio */ +/* + * cl_io_0014.pgc - 마감 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "cl_io_0014.h" + +EXEC SQL INCLUDE sqlca; + +int cl_io_0014_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM cl_io_0014_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0014_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int cl_io_0014_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE cl_io_0014_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0014_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long cl_io_0014_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM cl_io_0014_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0014_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/cl_io_0015.c b/app/dbio/cl_io_0015.c new file mode 100644 index 0000000..ff1a1cc --- /dev/null +++ b/app/dbio/cl_io_0015.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/cl_io_0015.pgc" +/* @tier easy @module cl @transform closing-dbio */ +/* + * cl_io_0015.pgc - 마감 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "cl_io_0015.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/cl_io_0015.pgc" + + +int cl_io_0015_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/cl_io_0015.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/cl_io_0015.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/cl_io_0015.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from cl_io_0015_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/cl_io_0015.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0015_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int cl_io_0015_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/cl_io_0015.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/cl_io_0015.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/cl_io_0015.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update cl_io_0015_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/cl_io_0015.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0015_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long cl_io_0015_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/cl_io_0015.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/cl_io_0015.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/cl_io_0015.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from cl_io_0015_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/cl_io_0015.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0015_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/cl_io_0015.pgc b/app/dbio/cl_io_0015.pgc new file mode 100644 index 0000000..b7f63c4 --- /dev/null +++ b/app/dbio/cl_io_0015.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module cl @transform closing-dbio */ +/* + * cl_io_0015.pgc - 마감 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "cl_io_0015.h" + +EXEC SQL INCLUDE sqlca; + +int cl_io_0015_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM cl_io_0015_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0015_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int cl_io_0015_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE cl_io_0015_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0015_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long cl_io_0015_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM cl_io_0015_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0015_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/cl_io_0016.c b/app/dbio/cl_io_0016.c new file mode 100644 index 0000000..cce89a6 --- /dev/null +++ b/app/dbio/cl_io_0016.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/cl_io_0016.pgc" +/* @tier medium @module cl @transform closing-dbio */ +/* + * cl_io_0016.pgc - 마감 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "cl_io_0016.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/cl_io_0016.pgc" + + +int cl_io_0016_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/cl_io_0016.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/cl_io_0016.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/cl_io_0016.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from cl_io_0016_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/cl_io_0016.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0016_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int cl_io_0016_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/cl_io_0016.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/cl_io_0016.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/cl_io_0016.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update cl_io_0016_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/cl_io_0016.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0016_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long cl_io_0016_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/cl_io_0016.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/cl_io_0016.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/cl_io_0016.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from cl_io_0016_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/cl_io_0016.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0016_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/cl_io_0016.pgc b/app/dbio/cl_io_0016.pgc new file mode 100644 index 0000000..ccef9a7 --- /dev/null +++ b/app/dbio/cl_io_0016.pgc @@ -0,0 +1,92 @@ +/* @tier medium @module cl @transform closing-dbio */ +/* + * cl_io_0016.pgc - 마감 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "cl_io_0016.h" + +EXEC SQL INCLUDE sqlca; + +int cl_io_0016_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM cl_io_0016_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0016_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int cl_io_0016_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE cl_io_0016_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0016_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long cl_io_0016_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM cl_io_0016_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0016_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/cl_io_0017.c b/app/dbio/cl_io_0017.c new file mode 100644 index 0000000..5d608ce --- /dev/null +++ b/app/dbio/cl_io_0017.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/cl_io_0017.pgc" +/* @tier easy @module cl @transform closing-dbio */ +/* + * cl_io_0017.pgc - 마감 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "cl_io_0017.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/cl_io_0017.pgc" + + +int cl_io_0017_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/cl_io_0017.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/cl_io_0017.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/cl_io_0017.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from cl_io_0017_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/cl_io_0017.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0017_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int cl_io_0017_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/cl_io_0017.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/cl_io_0017.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/cl_io_0017.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update cl_io_0017_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/cl_io_0017.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0017_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long cl_io_0017_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/cl_io_0017.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/cl_io_0017.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/cl_io_0017.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from cl_io_0017_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/cl_io_0017.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0017_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/cl_io_0017.pgc b/app/dbio/cl_io_0017.pgc new file mode 100644 index 0000000..dc3cfff --- /dev/null +++ b/app/dbio/cl_io_0017.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module cl @transform closing-dbio */ +/* + * cl_io_0017.pgc - 마감 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "cl_io_0017.h" + +EXEC SQL INCLUDE sqlca; + +int cl_io_0017_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM cl_io_0017_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0017_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int cl_io_0017_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE cl_io_0017_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0017_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long cl_io_0017_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM cl_io_0017_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0017_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/cl_io_0018.c b/app/dbio/cl_io_0018.c new file mode 100644 index 0000000..48d0791 --- /dev/null +++ b/app/dbio/cl_io_0018.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/cl_io_0018.pgc" +/* @tier hard @module cl @transform closing-dbio */ +/* + * cl_io_0018.pgc - 마감 보조 DBIO (ECPG) [tier=hard] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "cl_io_0018.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/cl_io_0018.pgc" + + +int cl_io_0018_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/cl_io_0018.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/cl_io_0018.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/cl_io_0018.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from cl_io_0018_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/cl_io_0018.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0018_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int cl_io_0018_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/cl_io_0018.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/cl_io_0018.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/cl_io_0018.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update cl_io_0018_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/cl_io_0018.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0018_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long cl_io_0018_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/cl_io_0018.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/cl_io_0018.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/cl_io_0018.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from cl_io_0018_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/cl_io_0018.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0018_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/cl_io_0018.pgc b/app/dbio/cl_io_0018.pgc new file mode 100644 index 0000000..e2ae243 --- /dev/null +++ b/app/dbio/cl_io_0018.pgc @@ -0,0 +1,92 @@ +/* @tier hard @module cl @transform closing-dbio */ +/* + * cl_io_0018.pgc - 마감 보조 DBIO (ECPG) [tier=hard] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "cl_io_0018.h" + +EXEC SQL INCLUDE sqlca; + +int cl_io_0018_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM cl_io_0018_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0018_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int cl_io_0018_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE cl_io_0018_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0018_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long cl_io_0018_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM cl_io_0018_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0018_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/cl_io_0019.c b/app/dbio/cl_io_0019.c new file mode 100644 index 0000000..0aa8ae7 --- /dev/null +++ b/app/dbio/cl_io_0019.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/cl_io_0019.pgc" +/* @tier easy @module cl @transform closing-dbio */ +/* + * cl_io_0019.pgc - 마감 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "cl_io_0019.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/cl_io_0019.pgc" + + +int cl_io_0019_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/cl_io_0019.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/cl_io_0019.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/cl_io_0019.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from cl_io_0019_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/cl_io_0019.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0019_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int cl_io_0019_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/cl_io_0019.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/cl_io_0019.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/cl_io_0019.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update cl_io_0019_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/cl_io_0019.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0019_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long cl_io_0019_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/cl_io_0019.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/cl_io_0019.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/cl_io_0019.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from cl_io_0019_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/cl_io_0019.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0019_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/cl_io_0019.pgc b/app/dbio/cl_io_0019.pgc new file mode 100644 index 0000000..af29b6f --- /dev/null +++ b/app/dbio/cl_io_0019.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module cl @transform closing-dbio */ +/* + * cl_io_0019.pgc - 마감 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "cl_io_0019.h" + +EXEC SQL INCLUDE sqlca; + +int cl_io_0019_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM cl_io_0019_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0019_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int cl_io_0019_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE cl_io_0019_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0019_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long cl_io_0019_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM cl_io_0019_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0019_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/cl_io_0020.c b/app/dbio/cl_io_0020.c new file mode 100644 index 0000000..4401ed6 --- /dev/null +++ b/app/dbio/cl_io_0020.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/cl_io_0020.pgc" +/* @tier hard @module cl @transform closing-dbio */ +/* + * cl_io_0020.pgc - 마감 보조 DBIO (ECPG) [tier=hard] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "cl_io_0020.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/cl_io_0020.pgc" + + +int cl_io_0020_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/cl_io_0020.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/cl_io_0020.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/cl_io_0020.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from cl_io_0020_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/cl_io_0020.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0020_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int cl_io_0020_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/cl_io_0020.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/cl_io_0020.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/cl_io_0020.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update cl_io_0020_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/cl_io_0020.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0020_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long cl_io_0020_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/cl_io_0020.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/cl_io_0020.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/cl_io_0020.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from cl_io_0020_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/cl_io_0020.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0020_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/cl_io_0020.pgc b/app/dbio/cl_io_0020.pgc new file mode 100644 index 0000000..95dbdd7 --- /dev/null +++ b/app/dbio/cl_io_0020.pgc @@ -0,0 +1,92 @@ +/* @tier hard @module cl @transform closing-dbio */ +/* + * cl_io_0020.pgc - 마감 보조 DBIO (ECPG) [tier=hard] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "cl_io_0020.h" + +EXEC SQL INCLUDE sqlca; + +int cl_io_0020_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM cl_io_0020_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0020_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int cl_io_0020_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE cl_io_0020_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0020_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long cl_io_0020_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM cl_io_0020_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0020_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/cl_io_0021.c b/app/dbio/cl_io_0021.c new file mode 100644 index 0000000..10841fa --- /dev/null +++ b/app/dbio/cl_io_0021.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/cl_io_0021.pgc" +/* @tier easy @module cl @transform closing-dbio */ +/* + * cl_io_0021.pgc - 마감 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "cl_io_0021.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/cl_io_0021.pgc" + + +int cl_io_0021_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/cl_io_0021.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/cl_io_0021.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/cl_io_0021.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from cl_io_0021_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/cl_io_0021.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0021_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int cl_io_0021_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/cl_io_0021.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/cl_io_0021.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/cl_io_0021.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update cl_io_0021_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/cl_io_0021.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0021_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long cl_io_0021_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/cl_io_0021.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/cl_io_0021.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/cl_io_0021.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from cl_io_0021_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/cl_io_0021.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0021_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/cl_io_0021.pgc b/app/dbio/cl_io_0021.pgc new file mode 100644 index 0000000..f409cde --- /dev/null +++ b/app/dbio/cl_io_0021.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module cl @transform closing-dbio */ +/* + * cl_io_0021.pgc - 마감 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "cl_io_0021.h" + +EXEC SQL INCLUDE sqlca; + +int cl_io_0021_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM cl_io_0021_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0021_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int cl_io_0021_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE cl_io_0021_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0021_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long cl_io_0021_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM cl_io_0021_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0021_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/cl_io_0022.c b/app/dbio/cl_io_0022.c new file mode 100644 index 0000000..414a9f4 --- /dev/null +++ b/app/dbio/cl_io_0022.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/cl_io_0022.pgc" +/* @tier easy @module cl @transform closing-dbio */ +/* + * cl_io_0022.pgc - 마감 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "cl_io_0022.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/cl_io_0022.pgc" + + +int cl_io_0022_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/cl_io_0022.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/cl_io_0022.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/cl_io_0022.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from cl_io_0022_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/cl_io_0022.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0022_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int cl_io_0022_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/cl_io_0022.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/cl_io_0022.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/cl_io_0022.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update cl_io_0022_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/cl_io_0022.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0022_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long cl_io_0022_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/cl_io_0022.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/cl_io_0022.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/cl_io_0022.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from cl_io_0022_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/cl_io_0022.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0022_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/cl_io_0022.pgc b/app/dbio/cl_io_0022.pgc new file mode 100644 index 0000000..728427d --- /dev/null +++ b/app/dbio/cl_io_0022.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module cl @transform closing-dbio */ +/* + * cl_io_0022.pgc - 마감 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "cl_io_0022.h" + +EXEC SQL INCLUDE sqlca; + +int cl_io_0022_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM cl_io_0022_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0022_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int cl_io_0022_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE cl_io_0022_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0022_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long cl_io_0022_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM cl_io_0022_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0022_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/cl_io_0023.c b/app/dbio/cl_io_0023.c new file mode 100644 index 0000000..f33dc9f --- /dev/null +++ b/app/dbio/cl_io_0023.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/cl_io_0023.pgc" +/* @tier medium @module cl @transform closing-dbio */ +/* + * cl_io_0023.pgc - 마감 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "cl_io_0023.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/cl_io_0023.pgc" + + +int cl_io_0023_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/cl_io_0023.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/cl_io_0023.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/cl_io_0023.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from cl_io_0023_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/cl_io_0023.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0023_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int cl_io_0023_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/cl_io_0023.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/cl_io_0023.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/cl_io_0023.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update cl_io_0023_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/cl_io_0023.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0023_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long cl_io_0023_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/cl_io_0023.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/cl_io_0023.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/cl_io_0023.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from cl_io_0023_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/cl_io_0023.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0023_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/cl_io_0023.pgc b/app/dbio/cl_io_0023.pgc new file mode 100644 index 0000000..af2acfc --- /dev/null +++ b/app/dbio/cl_io_0023.pgc @@ -0,0 +1,92 @@ +/* @tier medium @module cl @transform closing-dbio */ +/* + * cl_io_0023.pgc - 마감 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "cl_io_0023.h" + +EXEC SQL INCLUDE sqlca; + +int cl_io_0023_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM cl_io_0023_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0023_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int cl_io_0023_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE cl_io_0023_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0023_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long cl_io_0023_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM cl_io_0023_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0023_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/cl_io_0024.c b/app/dbio/cl_io_0024.c new file mode 100644 index 0000000..5e474eb --- /dev/null +++ b/app/dbio/cl_io_0024.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/cl_io_0024.pgc" +/* @tier easy @module cl @transform closing-dbio */ +/* + * cl_io_0024.pgc - 마감 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "cl_io_0024.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/cl_io_0024.pgc" + + +int cl_io_0024_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/cl_io_0024.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/cl_io_0024.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/cl_io_0024.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from cl_io_0024_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/cl_io_0024.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0024_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int cl_io_0024_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/cl_io_0024.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/cl_io_0024.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/cl_io_0024.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update cl_io_0024_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/cl_io_0024.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0024_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long cl_io_0024_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/cl_io_0024.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/cl_io_0024.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/cl_io_0024.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from cl_io_0024_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/cl_io_0024.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0024_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/cl_io_0024.pgc b/app/dbio/cl_io_0024.pgc new file mode 100644 index 0000000..923dcea --- /dev/null +++ b/app/dbio/cl_io_0024.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module cl @transform closing-dbio */ +/* + * cl_io_0024.pgc - 마감 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "cl_io_0024.h" + +EXEC SQL INCLUDE sqlca; + +int cl_io_0024_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM cl_io_0024_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0024_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int cl_io_0024_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE cl_io_0024_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0024_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long cl_io_0024_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM cl_io_0024_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0024_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/cl_io_0025.c b/app/dbio/cl_io_0025.c new file mode 100644 index 0000000..908a7ba --- /dev/null +++ b/app/dbio/cl_io_0025.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/cl_io_0025.pgc" +/* @tier medium @module cl @transform closing-dbio */ +/* + * cl_io_0025.pgc - 마감 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "cl_io_0025.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/cl_io_0025.pgc" + + +int cl_io_0025_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/cl_io_0025.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/cl_io_0025.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/cl_io_0025.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from cl_io_0025_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/cl_io_0025.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0025_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int cl_io_0025_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/cl_io_0025.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/cl_io_0025.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/cl_io_0025.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update cl_io_0025_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/cl_io_0025.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0025_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long cl_io_0025_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/cl_io_0025.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/cl_io_0025.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/cl_io_0025.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from cl_io_0025_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/cl_io_0025.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0025_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/cl_io_0025.pgc b/app/dbio/cl_io_0025.pgc new file mode 100644 index 0000000..44fde1b --- /dev/null +++ b/app/dbio/cl_io_0025.pgc @@ -0,0 +1,92 @@ +/* @tier medium @module cl @transform closing-dbio */ +/* + * cl_io_0025.pgc - 마감 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "cl_io_0025.h" + +EXEC SQL INCLUDE sqlca; + +int cl_io_0025_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM cl_io_0025_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0025_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int cl_io_0025_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE cl_io_0025_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0025_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long cl_io_0025_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM cl_io_0025_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0025_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/cl_io_0026.c b/app/dbio/cl_io_0026.c new file mode 100644 index 0000000..b2bea54 --- /dev/null +++ b/app/dbio/cl_io_0026.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/cl_io_0026.pgc" +/* @tier easy @module cl @transform closing-dbio */ +/* + * cl_io_0026.pgc - 마감 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "cl_io_0026.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/cl_io_0026.pgc" + + +int cl_io_0026_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/cl_io_0026.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/cl_io_0026.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/cl_io_0026.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from cl_io_0026_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/cl_io_0026.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0026_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int cl_io_0026_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/cl_io_0026.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/cl_io_0026.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/cl_io_0026.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update cl_io_0026_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/cl_io_0026.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0026_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long cl_io_0026_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/cl_io_0026.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/cl_io_0026.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/cl_io_0026.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from cl_io_0026_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/cl_io_0026.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0026_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/cl_io_0026.pgc b/app/dbio/cl_io_0026.pgc new file mode 100644 index 0000000..a74bbac --- /dev/null +++ b/app/dbio/cl_io_0026.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module cl @transform closing-dbio */ +/* + * cl_io_0026.pgc - 마감 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "cl_io_0026.h" + +EXEC SQL INCLUDE sqlca; + +int cl_io_0026_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM cl_io_0026_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0026_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int cl_io_0026_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE cl_io_0026_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0026_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long cl_io_0026_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM cl_io_0026_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cl_io_0026_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/cm_dbio_main.c b/app/dbio/cm_dbio_main.c new file mode 100644 index 0000000..4f33c31 --- /dev/null +++ b/app/dbio/cm_dbio_main.c @@ -0,0 +1,399 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/cm_dbio_main.pgc" +/* @tier medium @module cm @transform common-dbio */ +/* + * cm_dbio_main.pgc - 공통 표준 DBIO (ECPG 임베디드 SQL) + * + * cm_core.h 의 표준 API 를 cm_ledger 테이블에 대해 구현한다. + * 온라인/배치 프로그램은 이 함수들만 호출한다 (self-contained). + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "cm_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/dbio/cm_dbio_main.pgc" + + +int cm_dbio_connect(const char *target) +{ + /* exec sql begin declare section */ + + +#line 20 "app/dbio/cm_dbio_main.pgc" + const char * h_target ; +/* exec sql end declare section */ +#line 21 "app/dbio/cm_dbio_main.pgc" + + + h_target = (target && target[0]) ? target : "acquire@localhost"; + + { ECPGconnect(__LINE__, 0, h_target , NULL, NULL , NULL, 0); } +#line 25 "app/dbio/cm_dbio_main.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm CONNECT"); + return TX_EDB; + } + tx_log(TX_LOG_INFO, "[cm] DB 접속 완료 target=%s", h_target); + return TX_OK; +} + +int cm_dbio_disconnect(void) +{ + { ECPGdisconnect(__LINE__, "CURRENT");} +#line 36 "app/dbio/cm_dbio_main.pgc" + + return TX_OK; +} + +int cm_rec_insert(const cm_rec_t *rec) +{ + /* exec sql begin declare section */ + + + + + + + + +#line 43 "app/dbio/cm_dbio_main.pgc" + char h_key [ 16 ] ; + +#line 44 "app/dbio/cm_dbio_main.pgc" + char h_merch_id [ 16 ] ; + +#line 45 "app/dbio/cm_dbio_main.pgc" + char h_card_no [ 20 ] ; + +#line 46 "app/dbio/cm_dbio_main.pgc" + long h_amount ; + +#line 47 "app/dbio/cm_dbio_main.pgc" + char h_biz_date [ 9 ] ; + +#line 48 "app/dbio/cm_dbio_main.pgc" + char h_status [ 2 ] ; + +#line 49 "app/dbio/cm_dbio_main.pgc" + long h_fee ; +/* exec sql end declare section */ +#line 50 "app/dbio/cm_dbio_main.pgc" + + + if (!rec) + return TX_EINVAL; + + strncpy(h_key, rec->key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + strncpy(h_merch_id, rec->merch_id, sizeof(h_merch_id) - 1); + h_merch_id[sizeof(h_merch_id) - 1] = '\0'; + strncpy(h_card_no, rec->card_no, sizeof(h_card_no) - 1); + h_card_no[sizeof(h_card_no) - 1] = '\0'; + strncpy(h_biz_date, rec->biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + strncpy(h_status, rec->status, sizeof(h_status) - 1); + h_status[sizeof(h_status) - 1] = '\0'; + h_amount = rec->amount; + h_fee = rec->fee; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into cm_ledger ( key , merch_id , card_no , amount , biz_date , status , fee ) values ( $1 , $2 , $3 , $4 , $5 , $6 , $7 )", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_card_no),(long)20,(long)1,(20)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_status),(long)2,(long)1,(2)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_fee),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 71 "app/dbio/cm_dbio_main.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_rec_insert"); + return TX_EDB; + } + return TX_OK; +} + +int cm_rec_select(const char *key, cm_rec_t *out) +{ + /* exec sql begin declare section */ + + + + + + + + +#line 83 "app/dbio/cm_dbio_main.pgc" + char h_key [ 16 ] ; + +#line 84 "app/dbio/cm_dbio_main.pgc" + char h_merch_id [ 16 ] ; + +#line 85 "app/dbio/cm_dbio_main.pgc" + char h_card_no [ 20 ] ; + +#line 86 "app/dbio/cm_dbio_main.pgc" + long h_amount ; + +#line 87 "app/dbio/cm_dbio_main.pgc" + char h_biz_date [ 9 ] ; + +#line 88 "app/dbio/cm_dbio_main.pgc" + char h_status [ 2 ] ; + +#line 89 "app/dbio/cm_dbio_main.pgc" + long h_fee ; +/* exec sql end declare section */ +#line 90 "app/dbio/cm_dbio_main.pgc" + + + if (!key || !out) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select merch_id , card_no , amount , biz_date , status , fee from cm_ledger where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_card_no),(long)20,(long)1,(20)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_status),(long)2,(long)1,(2)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_fee),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 101 "app/dbio/cm_dbio_main.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_rec_select"); + return TX_EDB; + } + + memset(out, 0, sizeof(*out)); + strncpy(out->key, h_key, sizeof(out->key) - 1); + strncpy(out->merch_id, h_merch_id, sizeof(out->merch_id) - 1); + strncpy(out->card_no, h_card_no, sizeof(out->card_no) - 1); + strncpy(out->biz_date, h_biz_date, sizeof(out->biz_date) - 1); + strncpy(out->status, h_status, sizeof(out->status) - 1); + out->amount = h_amount; + out->fee = h_fee; + return TX_OK; +} + +int cm_rec_update_status(const char *key, const char *status) +{ + /* exec sql begin declare section */ + + + +#line 124 "app/dbio/cm_dbio_main.pgc" + char h_key [ 16 ] ; + +#line 125 "app/dbio/cm_dbio_main.pgc" + char h_status [ 2 ] ; +/* exec sql end declare section */ +#line 126 "app/dbio/cm_dbio_main.pgc" + + + if (!key || !status) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + strncpy(h_status, status, sizeof(h_status) - 1); + h_status[sizeof(h_status) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update cm_ledger set status = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_char,(h_status),(long)2,(long)1,(2)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 138 "app/dbio/cm_dbio_main.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_rec_update_status"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long cm_rec_count(const char *biz_date, const char *status) +{ + /* exec sql begin declare section */ + + + + +#line 152 "app/dbio/cm_dbio_main.pgc" + char h_biz_date [ 9 ] ; + +#line 153 "app/dbio/cm_dbio_main.pgc" + char h_status [ 2 ] ; + +#line 154 "app/dbio/cm_dbio_main.pgc" + int h_cnt ; +/* exec sql end declare section */ +#line 155 "app/dbio/cm_dbio_main.pgc" + + + if (!biz_date || !status) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + strncpy(h_status, status, sizeof(h_status) - 1); + h_status[sizeof(h_status) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select count ( * ) from cm_ledger where biz_date = $1 and status = $2 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_status),(long)2,(long)1,(2)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_int,&(h_cnt),(long)1,(long)1,sizeof(int), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 169 "app/dbio/cm_dbio_main.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_rec_count"); + return -1; + } + return (long)h_cnt; +} + +int cm_rec_sum(const char *biz_date, long *out_sum) +{ + /* exec sql begin declare section */ + + + +#line 181 "app/dbio/cm_dbio_main.pgc" + char h_biz_date [ 9 ] ; + +#line 182 "app/dbio/cm_dbio_main.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 183 "app/dbio/cm_dbio_main.pgc" + + + if (!biz_date || !out_sum) + return TX_EINVAL; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from cm_ledger where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 194 "app/dbio/cm_dbio_main.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_rec_sum"); + return TX_EDB; + } + *out_sum = h_sum; + return TX_OK; +} diff --git a/app/dbio/cm_dbio_main.pgc b/app/dbio/cm_dbio_main.pgc new file mode 100644 index 0000000..4fe05dc --- /dev/null +++ b/app/dbio/cm_dbio_main.pgc @@ -0,0 +1,202 @@ +/* @tier medium @module cm @transform common-dbio */ +/* + * cm_dbio_main.pgc - 공통 표준 DBIO (ECPG 임베디드 SQL) + * + * cm_core.h 의 표준 API 를 cm_ledger 테이블에 대해 구현한다. + * 온라인/배치 프로그램은 이 함수들만 호출한다 (self-contained). + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "cm_core.h" + +EXEC SQL INCLUDE sqlca; + +int cm_dbio_connect(const char *target) +{ + EXEC SQL BEGIN DECLARE SECTION; + const char *h_target; + EXEC SQL END DECLARE SECTION; + + h_target = (target && target[0]) ? target : "acquire@localhost"; + + EXEC SQL CONNECT TO :h_target; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm CONNECT"); + return TX_EDB; + } + tx_log(TX_LOG_INFO, "[cm] DB 접속 완료 target=%s", h_target); + return TX_OK; +} + +int cm_dbio_disconnect(void) +{ + EXEC SQL DISCONNECT CURRENT; + return TX_OK; +} + +int cm_rec_insert(const cm_rec_t *rec) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + char h_merch_id[16]; + char h_card_no[20]; + long h_amount; + char h_biz_date[9]; + char h_status[2]; + long h_fee; + EXEC SQL END DECLARE SECTION; + + if (!rec) + return TX_EINVAL; + + strncpy(h_key, rec->key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + strncpy(h_merch_id, rec->merch_id, sizeof(h_merch_id) - 1); + h_merch_id[sizeof(h_merch_id) - 1] = '\0'; + strncpy(h_card_no, rec->card_no, sizeof(h_card_no) - 1); + h_card_no[sizeof(h_card_no) - 1] = '\0'; + strncpy(h_biz_date, rec->biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + strncpy(h_status, rec->status, sizeof(h_status) - 1); + h_status[sizeof(h_status) - 1] = '\0'; + h_amount = rec->amount; + h_fee = rec->fee; + + EXEC SQL INSERT INTO cm_ledger + (key, merch_id, card_no, amount, biz_date, status, fee) + VALUES + (:h_key, :h_merch_id, :h_card_no, :h_amount, :h_biz_date, :h_status, :h_fee); + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_rec_insert"); + return TX_EDB; + } + return TX_OK; +} + +int cm_rec_select(const char *key, cm_rec_t *out) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + char h_merch_id[16]; + char h_card_no[20]; + long h_amount; + char h_biz_date[9]; + char h_status[2]; + long h_fee; + EXEC SQL END DECLARE SECTION; + + if (!key || !out) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT merch_id, card_no, amount, biz_date, status, fee + INTO :h_merch_id, :h_card_no, :h_amount, :h_biz_date, :h_status, :h_fee + FROM cm_ledger + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_rec_select"); + return TX_EDB; + } + + memset(out, 0, sizeof(*out)); + strncpy(out->key, h_key, sizeof(out->key) - 1); + strncpy(out->merch_id, h_merch_id, sizeof(out->merch_id) - 1); + strncpy(out->card_no, h_card_no, sizeof(out->card_no) - 1); + strncpy(out->biz_date, h_biz_date, sizeof(out->biz_date) - 1); + strncpy(out->status, h_status, sizeof(out->status) - 1); + out->amount = h_amount; + out->fee = h_fee; + return TX_OK; +} + +int cm_rec_update_status(const char *key, const char *status) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + char h_status[2]; + EXEC SQL END DECLARE SECTION; + + if (!key || !status) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + strncpy(h_status, status, sizeof(h_status) - 1); + h_status[sizeof(h_status) - 1] = '\0'; + + EXEC SQL UPDATE cm_ledger + SET status = :h_status, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_rec_update_status"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long cm_rec_count(const char *biz_date, const char *status) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_status[2]; + int h_cnt; + EXEC SQL END DECLARE SECTION; + + if (!biz_date || !status) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + strncpy(h_status, status, sizeof(h_status) - 1); + h_status[sizeof(h_status) - 1] = '\0'; + + EXEC SQL SELECT count(*) + INTO :h_cnt + FROM cm_ledger + WHERE biz_date = :h_biz_date + AND status = :h_status; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_rec_count"); + return -1; + } + return (long)h_cnt; +} + +int cm_rec_sum(const char *biz_date, long *out_sum) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date || !out_sum) + return TX_EINVAL; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM cm_ledger + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_rec_sum"); + return TX_EDB; + } + *out_sum = h_sum; + return TX_OK; +} diff --git a/app/dbio/cm_io_0001.c b/app/dbio/cm_io_0001.c new file mode 100644 index 0000000..f47f73b --- /dev/null +++ b/app/dbio/cm_io_0001.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/cm_io_0001.pgc" +/* @tier easy @module cm @transform common-dbio */ +/* + * cm_io_0001.pgc - 공통 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "cm_io_0001.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/cm_io_0001.pgc" + + +int cm_io_0001_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/cm_io_0001.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/cm_io_0001.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/cm_io_0001.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from cm_io_0001_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/cm_io_0001.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0001_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int cm_io_0001_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/cm_io_0001.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/cm_io_0001.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/cm_io_0001.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update cm_io_0001_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/cm_io_0001.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0001_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long cm_io_0001_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/cm_io_0001.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/cm_io_0001.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/cm_io_0001.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from cm_io_0001_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/cm_io_0001.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0001_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/cm_io_0001.pgc b/app/dbio/cm_io_0001.pgc new file mode 100644 index 0000000..901ff1c --- /dev/null +++ b/app/dbio/cm_io_0001.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module cm @transform common-dbio */ +/* + * cm_io_0001.pgc - 공통 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "cm_io_0001.h" + +EXEC SQL INCLUDE sqlca; + +int cm_io_0001_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM cm_io_0001_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0001_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int cm_io_0001_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE cm_io_0001_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0001_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long cm_io_0001_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM cm_io_0001_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0001_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/cm_io_0002.c b/app/dbio/cm_io_0002.c new file mode 100644 index 0000000..dd48270 --- /dev/null +++ b/app/dbio/cm_io_0002.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/cm_io_0002.pgc" +/* @tier easy @module cm @transform common-dbio */ +/* + * cm_io_0002.pgc - 공통 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "cm_io_0002.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/cm_io_0002.pgc" + + +int cm_io_0002_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/cm_io_0002.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/cm_io_0002.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/cm_io_0002.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from cm_io_0002_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/cm_io_0002.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0002_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int cm_io_0002_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/cm_io_0002.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/cm_io_0002.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/cm_io_0002.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update cm_io_0002_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/cm_io_0002.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0002_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long cm_io_0002_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/cm_io_0002.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/cm_io_0002.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/cm_io_0002.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from cm_io_0002_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/cm_io_0002.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0002_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/cm_io_0002.pgc b/app/dbio/cm_io_0002.pgc new file mode 100644 index 0000000..96e76ef --- /dev/null +++ b/app/dbio/cm_io_0002.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module cm @transform common-dbio */ +/* + * cm_io_0002.pgc - 공통 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "cm_io_0002.h" + +EXEC SQL INCLUDE sqlca; + +int cm_io_0002_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM cm_io_0002_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0002_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int cm_io_0002_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE cm_io_0002_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0002_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long cm_io_0002_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM cm_io_0002_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0002_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/cm_io_0003.c b/app/dbio/cm_io_0003.c new file mode 100644 index 0000000..2292227 --- /dev/null +++ b/app/dbio/cm_io_0003.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/cm_io_0003.pgc" +/* @tier medium @module cm @transform common-dbio */ +/* + * cm_io_0003.pgc - 공통 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "cm_io_0003.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/cm_io_0003.pgc" + + +int cm_io_0003_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/cm_io_0003.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/cm_io_0003.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/cm_io_0003.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from cm_io_0003_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/cm_io_0003.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0003_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int cm_io_0003_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/cm_io_0003.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/cm_io_0003.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/cm_io_0003.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update cm_io_0003_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/cm_io_0003.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0003_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long cm_io_0003_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/cm_io_0003.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/cm_io_0003.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/cm_io_0003.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from cm_io_0003_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/cm_io_0003.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0003_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/cm_io_0003.pgc b/app/dbio/cm_io_0003.pgc new file mode 100644 index 0000000..c473666 --- /dev/null +++ b/app/dbio/cm_io_0003.pgc @@ -0,0 +1,92 @@ +/* @tier medium @module cm @transform common-dbio */ +/* + * cm_io_0003.pgc - 공통 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "cm_io_0003.h" + +EXEC SQL INCLUDE sqlca; + +int cm_io_0003_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM cm_io_0003_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0003_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int cm_io_0003_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE cm_io_0003_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0003_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long cm_io_0003_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM cm_io_0003_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0003_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/cm_io_0004.c b/app/dbio/cm_io_0004.c new file mode 100644 index 0000000..05b9e63 --- /dev/null +++ b/app/dbio/cm_io_0004.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/cm_io_0004.pgc" +/* @tier easy @module cm @transform common-dbio */ +/* + * cm_io_0004.pgc - 공통 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "cm_io_0004.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/cm_io_0004.pgc" + + +int cm_io_0004_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/cm_io_0004.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/cm_io_0004.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/cm_io_0004.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from cm_io_0004_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/cm_io_0004.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0004_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int cm_io_0004_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/cm_io_0004.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/cm_io_0004.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/cm_io_0004.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update cm_io_0004_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/cm_io_0004.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0004_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long cm_io_0004_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/cm_io_0004.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/cm_io_0004.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/cm_io_0004.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from cm_io_0004_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/cm_io_0004.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0004_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/cm_io_0004.pgc b/app/dbio/cm_io_0004.pgc new file mode 100644 index 0000000..adf033d --- /dev/null +++ b/app/dbio/cm_io_0004.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module cm @transform common-dbio */ +/* + * cm_io_0004.pgc - 공통 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "cm_io_0004.h" + +EXEC SQL INCLUDE sqlca; + +int cm_io_0004_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM cm_io_0004_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0004_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int cm_io_0004_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE cm_io_0004_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0004_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long cm_io_0004_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM cm_io_0004_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0004_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/cm_io_0005.c b/app/dbio/cm_io_0005.c new file mode 100644 index 0000000..3813a44 --- /dev/null +++ b/app/dbio/cm_io_0005.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/cm_io_0005.pgc" +/* @tier medium @module cm @transform common-dbio */ +/* + * cm_io_0005.pgc - 공통 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "cm_io_0005.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/cm_io_0005.pgc" + + +int cm_io_0005_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/cm_io_0005.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/cm_io_0005.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/cm_io_0005.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from cm_io_0005_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/cm_io_0005.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0005_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int cm_io_0005_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/cm_io_0005.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/cm_io_0005.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/cm_io_0005.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update cm_io_0005_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/cm_io_0005.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0005_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long cm_io_0005_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/cm_io_0005.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/cm_io_0005.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/cm_io_0005.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from cm_io_0005_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/cm_io_0005.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0005_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/cm_io_0005.pgc b/app/dbio/cm_io_0005.pgc new file mode 100644 index 0000000..430287b --- /dev/null +++ b/app/dbio/cm_io_0005.pgc @@ -0,0 +1,92 @@ +/* @tier medium @module cm @transform common-dbio */ +/* + * cm_io_0005.pgc - 공통 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "cm_io_0005.h" + +EXEC SQL INCLUDE sqlca; + +int cm_io_0005_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM cm_io_0005_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0005_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int cm_io_0005_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE cm_io_0005_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0005_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long cm_io_0005_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM cm_io_0005_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0005_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/cm_io_0006.c b/app/dbio/cm_io_0006.c new file mode 100644 index 0000000..37bb03e --- /dev/null +++ b/app/dbio/cm_io_0006.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/cm_io_0006.pgc" +/* @tier easy @module cm @transform common-dbio */ +/* + * cm_io_0006.pgc - 공통 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "cm_io_0006.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/cm_io_0006.pgc" + + +int cm_io_0006_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/cm_io_0006.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/cm_io_0006.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/cm_io_0006.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from cm_io_0006_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/cm_io_0006.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0006_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int cm_io_0006_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/cm_io_0006.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/cm_io_0006.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/cm_io_0006.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update cm_io_0006_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/cm_io_0006.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0006_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long cm_io_0006_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/cm_io_0006.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/cm_io_0006.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/cm_io_0006.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from cm_io_0006_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/cm_io_0006.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0006_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/cm_io_0006.pgc b/app/dbio/cm_io_0006.pgc new file mode 100644 index 0000000..ef1c8c7 --- /dev/null +++ b/app/dbio/cm_io_0006.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module cm @transform common-dbio */ +/* + * cm_io_0006.pgc - 공통 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "cm_io_0006.h" + +EXEC SQL INCLUDE sqlca; + +int cm_io_0006_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM cm_io_0006_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0006_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int cm_io_0006_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE cm_io_0006_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0006_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long cm_io_0006_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM cm_io_0006_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0006_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/cm_io_0007.c b/app/dbio/cm_io_0007.c new file mode 100644 index 0000000..2c47a77 --- /dev/null +++ b/app/dbio/cm_io_0007.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/cm_io_0007.pgc" +/* @tier medium @module cm @transform common-dbio */ +/* + * cm_io_0007.pgc - 공통 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "cm_io_0007.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/cm_io_0007.pgc" + + +int cm_io_0007_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/cm_io_0007.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/cm_io_0007.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/cm_io_0007.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from cm_io_0007_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/cm_io_0007.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0007_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int cm_io_0007_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/cm_io_0007.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/cm_io_0007.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/cm_io_0007.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update cm_io_0007_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/cm_io_0007.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0007_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long cm_io_0007_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/cm_io_0007.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/cm_io_0007.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/cm_io_0007.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from cm_io_0007_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/cm_io_0007.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0007_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/cm_io_0007.pgc b/app/dbio/cm_io_0007.pgc new file mode 100644 index 0000000..a158e95 --- /dev/null +++ b/app/dbio/cm_io_0007.pgc @@ -0,0 +1,92 @@ +/* @tier medium @module cm @transform common-dbio */ +/* + * cm_io_0007.pgc - 공통 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "cm_io_0007.h" + +EXEC SQL INCLUDE sqlca; + +int cm_io_0007_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM cm_io_0007_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0007_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int cm_io_0007_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE cm_io_0007_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0007_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long cm_io_0007_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM cm_io_0007_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0007_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/cm_io_0008.c b/app/dbio/cm_io_0008.c new file mode 100644 index 0000000..039965d --- /dev/null +++ b/app/dbio/cm_io_0008.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/cm_io_0008.pgc" +/* @tier easy @module cm @transform common-dbio */ +/* + * cm_io_0008.pgc - 공통 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "cm_io_0008.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/cm_io_0008.pgc" + + +int cm_io_0008_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/cm_io_0008.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/cm_io_0008.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/cm_io_0008.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from cm_io_0008_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/cm_io_0008.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0008_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int cm_io_0008_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/cm_io_0008.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/cm_io_0008.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/cm_io_0008.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update cm_io_0008_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/cm_io_0008.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0008_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long cm_io_0008_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/cm_io_0008.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/cm_io_0008.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/cm_io_0008.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from cm_io_0008_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/cm_io_0008.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0008_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/cm_io_0008.pgc b/app/dbio/cm_io_0008.pgc new file mode 100644 index 0000000..aff6c85 --- /dev/null +++ b/app/dbio/cm_io_0008.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module cm @transform common-dbio */ +/* + * cm_io_0008.pgc - 공통 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "cm_io_0008.h" + +EXEC SQL INCLUDE sqlca; + +int cm_io_0008_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM cm_io_0008_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0008_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int cm_io_0008_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE cm_io_0008_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0008_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long cm_io_0008_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM cm_io_0008_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0008_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/cm_io_0009.c b/app/dbio/cm_io_0009.c new file mode 100644 index 0000000..ef39882 --- /dev/null +++ b/app/dbio/cm_io_0009.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/cm_io_0009.pgc" +/* @tier hard @module cm @transform common-dbio */ +/* + * cm_io_0009.pgc - 공통 보조 DBIO (ECPG) [tier=hard] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "cm_io_0009.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/cm_io_0009.pgc" + + +int cm_io_0009_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/cm_io_0009.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/cm_io_0009.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/cm_io_0009.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from cm_io_0009_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/cm_io_0009.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0009_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int cm_io_0009_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/cm_io_0009.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/cm_io_0009.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/cm_io_0009.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update cm_io_0009_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/cm_io_0009.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0009_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long cm_io_0009_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/cm_io_0009.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/cm_io_0009.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/cm_io_0009.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from cm_io_0009_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/cm_io_0009.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0009_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/cm_io_0009.pgc b/app/dbio/cm_io_0009.pgc new file mode 100644 index 0000000..251aa76 --- /dev/null +++ b/app/dbio/cm_io_0009.pgc @@ -0,0 +1,92 @@ +/* @tier hard @module cm @transform common-dbio */ +/* + * cm_io_0009.pgc - 공통 보조 DBIO (ECPG) [tier=hard] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "cm_io_0009.h" + +EXEC SQL INCLUDE sqlca; + +int cm_io_0009_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM cm_io_0009_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0009_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int cm_io_0009_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE cm_io_0009_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0009_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long cm_io_0009_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM cm_io_0009_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0009_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/cm_io_0010.c b/app/dbio/cm_io_0010.c new file mode 100644 index 0000000..3b03669 --- /dev/null +++ b/app/dbio/cm_io_0010.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/cm_io_0010.pgc" +/* @tier easy @module cm @transform common-dbio */ +/* + * cm_io_0010.pgc - 공통 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "cm_io_0010.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/cm_io_0010.pgc" + + +int cm_io_0010_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/cm_io_0010.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/cm_io_0010.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/cm_io_0010.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from cm_io_0010_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/cm_io_0010.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0010_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int cm_io_0010_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/cm_io_0010.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/cm_io_0010.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/cm_io_0010.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update cm_io_0010_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/cm_io_0010.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0010_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long cm_io_0010_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/cm_io_0010.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/cm_io_0010.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/cm_io_0010.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from cm_io_0010_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/cm_io_0010.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0010_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/cm_io_0010.pgc b/app/dbio/cm_io_0010.pgc new file mode 100644 index 0000000..38661b0 --- /dev/null +++ b/app/dbio/cm_io_0010.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module cm @transform common-dbio */ +/* + * cm_io_0010.pgc - 공통 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "cm_io_0010.h" + +EXEC SQL INCLUDE sqlca; + +int cm_io_0010_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM cm_io_0010_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0010_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int cm_io_0010_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE cm_io_0010_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0010_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long cm_io_0010_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM cm_io_0010_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0010_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/cm_io_0011.c b/app/dbio/cm_io_0011.c new file mode 100644 index 0000000..745790d --- /dev/null +++ b/app/dbio/cm_io_0011.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/cm_io_0011.pgc" +/* @tier hard @module cm @transform common-dbio */ +/* + * cm_io_0011.pgc - 공통 보조 DBIO (ECPG) [tier=hard] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "cm_io_0011.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/cm_io_0011.pgc" + + +int cm_io_0011_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/cm_io_0011.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/cm_io_0011.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/cm_io_0011.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from cm_io_0011_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/cm_io_0011.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0011_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int cm_io_0011_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/cm_io_0011.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/cm_io_0011.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/cm_io_0011.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update cm_io_0011_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/cm_io_0011.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0011_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long cm_io_0011_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/cm_io_0011.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/cm_io_0011.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/cm_io_0011.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from cm_io_0011_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/cm_io_0011.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0011_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/cm_io_0011.pgc b/app/dbio/cm_io_0011.pgc new file mode 100644 index 0000000..1375176 --- /dev/null +++ b/app/dbio/cm_io_0011.pgc @@ -0,0 +1,92 @@ +/* @tier hard @module cm @transform common-dbio */ +/* + * cm_io_0011.pgc - 공통 보조 DBIO (ECPG) [tier=hard] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "cm_io_0011.h" + +EXEC SQL INCLUDE sqlca; + +int cm_io_0011_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM cm_io_0011_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0011_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int cm_io_0011_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE cm_io_0011_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0011_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long cm_io_0011_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM cm_io_0011_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0011_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/cm_io_0012.c b/app/dbio/cm_io_0012.c new file mode 100644 index 0000000..a901eea --- /dev/null +++ b/app/dbio/cm_io_0012.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/cm_io_0012.pgc" +/* @tier easy @module cm @transform common-dbio */ +/* + * cm_io_0012.pgc - 공통 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "cm_io_0012.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/cm_io_0012.pgc" + + +int cm_io_0012_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/cm_io_0012.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/cm_io_0012.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/cm_io_0012.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from cm_io_0012_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/cm_io_0012.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0012_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int cm_io_0012_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/cm_io_0012.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/cm_io_0012.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/cm_io_0012.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update cm_io_0012_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/cm_io_0012.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0012_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long cm_io_0012_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/cm_io_0012.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/cm_io_0012.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/cm_io_0012.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from cm_io_0012_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/cm_io_0012.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0012_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/cm_io_0012.pgc b/app/dbio/cm_io_0012.pgc new file mode 100644 index 0000000..aa625e3 --- /dev/null +++ b/app/dbio/cm_io_0012.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module cm @transform common-dbio */ +/* + * cm_io_0012.pgc - 공통 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "cm_io_0012.h" + +EXEC SQL INCLUDE sqlca; + +int cm_io_0012_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM cm_io_0012_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0012_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int cm_io_0012_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE cm_io_0012_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0012_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long cm_io_0012_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM cm_io_0012_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0012_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/cm_io_0013.c b/app/dbio/cm_io_0013.c new file mode 100644 index 0000000..4591f2f --- /dev/null +++ b/app/dbio/cm_io_0013.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/cm_io_0013.pgc" +/* @tier easy @module cm @transform common-dbio */ +/* + * cm_io_0013.pgc - 공통 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "cm_io_0013.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/cm_io_0013.pgc" + + +int cm_io_0013_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/cm_io_0013.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/cm_io_0013.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/cm_io_0013.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from cm_io_0013_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/cm_io_0013.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0013_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int cm_io_0013_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/cm_io_0013.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/cm_io_0013.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/cm_io_0013.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update cm_io_0013_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/cm_io_0013.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0013_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long cm_io_0013_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/cm_io_0013.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/cm_io_0013.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/cm_io_0013.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from cm_io_0013_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/cm_io_0013.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0013_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/cm_io_0013.pgc b/app/dbio/cm_io_0013.pgc new file mode 100644 index 0000000..db36460 --- /dev/null +++ b/app/dbio/cm_io_0013.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module cm @transform common-dbio */ +/* + * cm_io_0013.pgc - 공통 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "cm_io_0013.h" + +EXEC SQL INCLUDE sqlca; + +int cm_io_0013_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM cm_io_0013_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0013_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int cm_io_0013_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE cm_io_0013_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0013_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long cm_io_0013_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM cm_io_0013_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0013_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/cm_io_0014.c b/app/dbio/cm_io_0014.c new file mode 100644 index 0000000..6d2320c --- /dev/null +++ b/app/dbio/cm_io_0014.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/cm_io_0014.pgc" +/* @tier medium @module cm @transform common-dbio */ +/* + * cm_io_0014.pgc - 공통 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "cm_io_0014.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/cm_io_0014.pgc" + + +int cm_io_0014_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/cm_io_0014.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/cm_io_0014.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/cm_io_0014.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from cm_io_0014_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/cm_io_0014.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0014_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int cm_io_0014_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/cm_io_0014.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/cm_io_0014.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/cm_io_0014.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update cm_io_0014_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/cm_io_0014.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0014_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long cm_io_0014_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/cm_io_0014.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/cm_io_0014.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/cm_io_0014.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from cm_io_0014_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/cm_io_0014.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0014_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/cm_io_0014.pgc b/app/dbio/cm_io_0014.pgc new file mode 100644 index 0000000..6bb9e7c --- /dev/null +++ b/app/dbio/cm_io_0014.pgc @@ -0,0 +1,92 @@ +/* @tier medium @module cm @transform common-dbio */ +/* + * cm_io_0014.pgc - 공통 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "cm_io_0014.h" + +EXEC SQL INCLUDE sqlca; + +int cm_io_0014_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM cm_io_0014_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0014_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int cm_io_0014_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE cm_io_0014_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0014_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long cm_io_0014_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM cm_io_0014_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0014_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/cm_io_0015.c b/app/dbio/cm_io_0015.c new file mode 100644 index 0000000..8b62a7d --- /dev/null +++ b/app/dbio/cm_io_0015.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/cm_io_0015.pgc" +/* @tier easy @module cm @transform common-dbio */ +/* + * cm_io_0015.pgc - 공통 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "cm_io_0015.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/cm_io_0015.pgc" + + +int cm_io_0015_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/cm_io_0015.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/cm_io_0015.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/cm_io_0015.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from cm_io_0015_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/cm_io_0015.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0015_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int cm_io_0015_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/cm_io_0015.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/cm_io_0015.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/cm_io_0015.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update cm_io_0015_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/cm_io_0015.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0015_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long cm_io_0015_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/cm_io_0015.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/cm_io_0015.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/cm_io_0015.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from cm_io_0015_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/cm_io_0015.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0015_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/cm_io_0015.pgc b/app/dbio/cm_io_0015.pgc new file mode 100644 index 0000000..f8032fc --- /dev/null +++ b/app/dbio/cm_io_0015.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module cm @transform common-dbio */ +/* + * cm_io_0015.pgc - 공통 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "cm_io_0015.h" + +EXEC SQL INCLUDE sqlca; + +int cm_io_0015_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM cm_io_0015_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0015_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int cm_io_0015_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE cm_io_0015_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0015_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long cm_io_0015_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM cm_io_0015_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0015_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/cm_io_0016.c b/app/dbio/cm_io_0016.c new file mode 100644 index 0000000..d1d3572 --- /dev/null +++ b/app/dbio/cm_io_0016.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/cm_io_0016.pgc" +/* @tier medium @module cm @transform common-dbio */ +/* + * cm_io_0016.pgc - 공통 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "cm_io_0016.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/cm_io_0016.pgc" + + +int cm_io_0016_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/cm_io_0016.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/cm_io_0016.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/cm_io_0016.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from cm_io_0016_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/cm_io_0016.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0016_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int cm_io_0016_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/cm_io_0016.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/cm_io_0016.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/cm_io_0016.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update cm_io_0016_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/cm_io_0016.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0016_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long cm_io_0016_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/cm_io_0016.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/cm_io_0016.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/cm_io_0016.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from cm_io_0016_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/cm_io_0016.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0016_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/cm_io_0016.pgc b/app/dbio/cm_io_0016.pgc new file mode 100644 index 0000000..a05a7c1 --- /dev/null +++ b/app/dbio/cm_io_0016.pgc @@ -0,0 +1,92 @@ +/* @tier medium @module cm @transform common-dbio */ +/* + * cm_io_0016.pgc - 공통 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "cm_io_0016.h" + +EXEC SQL INCLUDE sqlca; + +int cm_io_0016_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM cm_io_0016_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0016_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int cm_io_0016_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE cm_io_0016_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0016_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long cm_io_0016_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM cm_io_0016_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0016_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/cm_io_0017.c b/app/dbio/cm_io_0017.c new file mode 100644 index 0000000..e8a4e7f --- /dev/null +++ b/app/dbio/cm_io_0017.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/cm_io_0017.pgc" +/* @tier easy @module cm @transform common-dbio */ +/* + * cm_io_0017.pgc - 공통 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "cm_io_0017.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/cm_io_0017.pgc" + + +int cm_io_0017_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/cm_io_0017.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/cm_io_0017.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/cm_io_0017.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from cm_io_0017_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/cm_io_0017.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0017_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int cm_io_0017_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/cm_io_0017.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/cm_io_0017.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/cm_io_0017.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update cm_io_0017_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/cm_io_0017.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0017_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long cm_io_0017_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/cm_io_0017.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/cm_io_0017.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/cm_io_0017.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from cm_io_0017_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/cm_io_0017.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0017_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/cm_io_0017.pgc b/app/dbio/cm_io_0017.pgc new file mode 100644 index 0000000..8f9967e --- /dev/null +++ b/app/dbio/cm_io_0017.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module cm @transform common-dbio */ +/* + * cm_io_0017.pgc - 공통 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "cm_io_0017.h" + +EXEC SQL INCLUDE sqlca; + +int cm_io_0017_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM cm_io_0017_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0017_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int cm_io_0017_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE cm_io_0017_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0017_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long cm_io_0017_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM cm_io_0017_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0017_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/cm_io_0018.c b/app/dbio/cm_io_0018.c new file mode 100644 index 0000000..dea3649 --- /dev/null +++ b/app/dbio/cm_io_0018.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/cm_io_0018.pgc" +/* @tier medium @module cm @transform common-dbio */ +/* + * cm_io_0018.pgc - 공통 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "cm_io_0018.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/cm_io_0018.pgc" + + +int cm_io_0018_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/cm_io_0018.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/cm_io_0018.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/cm_io_0018.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from cm_io_0018_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/cm_io_0018.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0018_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int cm_io_0018_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/cm_io_0018.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/cm_io_0018.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/cm_io_0018.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update cm_io_0018_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/cm_io_0018.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0018_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long cm_io_0018_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/cm_io_0018.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/cm_io_0018.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/cm_io_0018.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from cm_io_0018_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/cm_io_0018.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0018_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/cm_io_0018.pgc b/app/dbio/cm_io_0018.pgc new file mode 100644 index 0000000..a38e2a9 --- /dev/null +++ b/app/dbio/cm_io_0018.pgc @@ -0,0 +1,92 @@ +/* @tier medium @module cm @transform common-dbio */ +/* + * cm_io_0018.pgc - 공통 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "cm_io_0018.h" + +EXEC SQL INCLUDE sqlca; + +int cm_io_0018_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM cm_io_0018_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0018_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int cm_io_0018_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE cm_io_0018_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0018_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long cm_io_0018_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM cm_io_0018_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0018_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/cm_io_0019.c b/app/dbio/cm_io_0019.c new file mode 100644 index 0000000..62b287e --- /dev/null +++ b/app/dbio/cm_io_0019.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/cm_io_0019.pgc" +/* @tier easy @module cm @transform common-dbio */ +/* + * cm_io_0019.pgc - 공통 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "cm_io_0019.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/cm_io_0019.pgc" + + +int cm_io_0019_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/cm_io_0019.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/cm_io_0019.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/cm_io_0019.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from cm_io_0019_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/cm_io_0019.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0019_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int cm_io_0019_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/cm_io_0019.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/cm_io_0019.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/cm_io_0019.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update cm_io_0019_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/cm_io_0019.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0019_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long cm_io_0019_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/cm_io_0019.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/cm_io_0019.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/cm_io_0019.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from cm_io_0019_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/cm_io_0019.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0019_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/cm_io_0019.pgc b/app/dbio/cm_io_0019.pgc new file mode 100644 index 0000000..a2e3824 --- /dev/null +++ b/app/dbio/cm_io_0019.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module cm @transform common-dbio */ +/* + * cm_io_0019.pgc - 공통 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "cm_io_0019.h" + +EXEC SQL INCLUDE sqlca; + +int cm_io_0019_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM cm_io_0019_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0019_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int cm_io_0019_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE cm_io_0019_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0019_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long cm_io_0019_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM cm_io_0019_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0019_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/cm_io_0020.c b/app/dbio/cm_io_0020.c new file mode 100644 index 0000000..90accd2 --- /dev/null +++ b/app/dbio/cm_io_0020.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/cm_io_0020.pgc" +/* @tier hard @module cm @transform common-dbio */ +/* + * cm_io_0020.pgc - 공통 보조 DBIO (ECPG) [tier=hard] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "cm_io_0020.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/cm_io_0020.pgc" + + +int cm_io_0020_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/cm_io_0020.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/cm_io_0020.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/cm_io_0020.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from cm_io_0020_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/cm_io_0020.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0020_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int cm_io_0020_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/cm_io_0020.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/cm_io_0020.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/cm_io_0020.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update cm_io_0020_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/cm_io_0020.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0020_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long cm_io_0020_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/cm_io_0020.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/cm_io_0020.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/cm_io_0020.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from cm_io_0020_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/cm_io_0020.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0020_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/cm_io_0020.pgc b/app/dbio/cm_io_0020.pgc new file mode 100644 index 0000000..2129ed9 --- /dev/null +++ b/app/dbio/cm_io_0020.pgc @@ -0,0 +1,92 @@ +/* @tier hard @module cm @transform common-dbio */ +/* + * cm_io_0020.pgc - 공통 보조 DBIO (ECPG) [tier=hard] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "cm_io_0020.h" + +EXEC SQL INCLUDE sqlca; + +int cm_io_0020_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM cm_io_0020_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0020_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int cm_io_0020_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE cm_io_0020_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0020_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long cm_io_0020_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM cm_io_0020_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0020_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/cm_io_0021.c b/app/dbio/cm_io_0021.c new file mode 100644 index 0000000..c52f13d --- /dev/null +++ b/app/dbio/cm_io_0021.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/cm_io_0021.pgc" +/* @tier easy @module cm @transform common-dbio */ +/* + * cm_io_0021.pgc - 공통 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "cm_io_0021.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/cm_io_0021.pgc" + + +int cm_io_0021_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/cm_io_0021.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/cm_io_0021.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/cm_io_0021.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from cm_io_0021_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/cm_io_0021.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0021_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int cm_io_0021_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/cm_io_0021.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/cm_io_0021.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/cm_io_0021.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update cm_io_0021_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/cm_io_0021.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0021_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long cm_io_0021_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/cm_io_0021.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/cm_io_0021.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/cm_io_0021.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from cm_io_0021_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/cm_io_0021.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0021_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/cm_io_0021.pgc b/app/dbio/cm_io_0021.pgc new file mode 100644 index 0000000..9f359b4 --- /dev/null +++ b/app/dbio/cm_io_0021.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module cm @transform common-dbio */ +/* + * cm_io_0021.pgc - 공통 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "cm_io_0021.h" + +EXEC SQL INCLUDE sqlca; + +int cm_io_0021_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM cm_io_0021_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0021_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int cm_io_0021_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE cm_io_0021_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0021_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long cm_io_0021_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM cm_io_0021_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0021_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/cm_io_0022.c b/app/dbio/cm_io_0022.c new file mode 100644 index 0000000..5392a17 --- /dev/null +++ b/app/dbio/cm_io_0022.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/cm_io_0022.pgc" +/* @tier easy @module cm @transform common-dbio */ +/* + * cm_io_0022.pgc - 공통 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "cm_io_0022.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/cm_io_0022.pgc" + + +int cm_io_0022_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/cm_io_0022.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/cm_io_0022.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/cm_io_0022.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from cm_io_0022_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/cm_io_0022.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0022_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int cm_io_0022_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/cm_io_0022.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/cm_io_0022.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/cm_io_0022.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update cm_io_0022_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/cm_io_0022.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0022_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long cm_io_0022_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/cm_io_0022.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/cm_io_0022.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/cm_io_0022.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from cm_io_0022_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/cm_io_0022.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0022_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/cm_io_0022.pgc b/app/dbio/cm_io_0022.pgc new file mode 100644 index 0000000..cfb36db --- /dev/null +++ b/app/dbio/cm_io_0022.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module cm @transform common-dbio */ +/* + * cm_io_0022.pgc - 공통 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "cm_io_0022.h" + +EXEC SQL INCLUDE sqlca; + +int cm_io_0022_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM cm_io_0022_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0022_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int cm_io_0022_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE cm_io_0022_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0022_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long cm_io_0022_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM cm_io_0022_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0022_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/cm_io_0023.c b/app/dbio/cm_io_0023.c new file mode 100644 index 0000000..abd6314 --- /dev/null +++ b/app/dbio/cm_io_0023.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/cm_io_0023.pgc" +/* @tier medium @module cm @transform common-dbio */ +/* + * cm_io_0023.pgc - 공통 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "cm_io_0023.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/cm_io_0023.pgc" + + +int cm_io_0023_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/cm_io_0023.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/cm_io_0023.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/cm_io_0023.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from cm_io_0023_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/cm_io_0023.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0023_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int cm_io_0023_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/cm_io_0023.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/cm_io_0023.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/cm_io_0023.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update cm_io_0023_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/cm_io_0023.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0023_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long cm_io_0023_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/cm_io_0023.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/cm_io_0023.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/cm_io_0023.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from cm_io_0023_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/cm_io_0023.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0023_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/cm_io_0023.pgc b/app/dbio/cm_io_0023.pgc new file mode 100644 index 0000000..815a745 --- /dev/null +++ b/app/dbio/cm_io_0023.pgc @@ -0,0 +1,92 @@ +/* @tier medium @module cm @transform common-dbio */ +/* + * cm_io_0023.pgc - 공통 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "cm_io_0023.h" + +EXEC SQL INCLUDE sqlca; + +int cm_io_0023_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM cm_io_0023_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0023_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int cm_io_0023_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE cm_io_0023_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0023_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long cm_io_0023_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM cm_io_0023_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0023_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/cm_io_0024.c b/app/dbio/cm_io_0024.c new file mode 100644 index 0000000..9055231 --- /dev/null +++ b/app/dbio/cm_io_0024.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/cm_io_0024.pgc" +/* @tier easy @module cm @transform common-dbio */ +/* + * cm_io_0024.pgc - 공통 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "cm_io_0024.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/cm_io_0024.pgc" + + +int cm_io_0024_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/cm_io_0024.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/cm_io_0024.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/cm_io_0024.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from cm_io_0024_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/cm_io_0024.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0024_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int cm_io_0024_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/cm_io_0024.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/cm_io_0024.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/cm_io_0024.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update cm_io_0024_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/cm_io_0024.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0024_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long cm_io_0024_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/cm_io_0024.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/cm_io_0024.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/cm_io_0024.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from cm_io_0024_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/cm_io_0024.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0024_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/cm_io_0024.pgc b/app/dbio/cm_io_0024.pgc new file mode 100644 index 0000000..6539de7 --- /dev/null +++ b/app/dbio/cm_io_0024.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module cm @transform common-dbio */ +/* + * cm_io_0024.pgc - 공통 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "cm_io_0024.h" + +EXEC SQL INCLUDE sqlca; + +int cm_io_0024_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM cm_io_0024_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0024_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int cm_io_0024_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE cm_io_0024_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0024_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long cm_io_0024_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM cm_io_0024_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0024_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/cm_io_0025.c b/app/dbio/cm_io_0025.c new file mode 100644 index 0000000..844ed89 --- /dev/null +++ b/app/dbio/cm_io_0025.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/cm_io_0025.pgc" +/* @tier medium @module cm @transform common-dbio */ +/* + * cm_io_0025.pgc - 공통 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "cm_io_0025.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/cm_io_0025.pgc" + + +int cm_io_0025_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/cm_io_0025.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/cm_io_0025.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/cm_io_0025.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from cm_io_0025_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/cm_io_0025.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0025_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int cm_io_0025_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/cm_io_0025.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/cm_io_0025.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/cm_io_0025.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update cm_io_0025_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/cm_io_0025.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0025_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long cm_io_0025_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/cm_io_0025.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/cm_io_0025.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/cm_io_0025.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from cm_io_0025_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/cm_io_0025.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0025_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/cm_io_0025.pgc b/app/dbio/cm_io_0025.pgc new file mode 100644 index 0000000..5b7aae9 --- /dev/null +++ b/app/dbio/cm_io_0025.pgc @@ -0,0 +1,92 @@ +/* @tier medium @module cm @transform common-dbio */ +/* + * cm_io_0025.pgc - 공통 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "cm_io_0025.h" + +EXEC SQL INCLUDE sqlca; + +int cm_io_0025_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM cm_io_0025_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0025_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int cm_io_0025_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE cm_io_0025_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0025_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long cm_io_0025_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM cm_io_0025_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0025_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/cm_io_0026.c b/app/dbio/cm_io_0026.c new file mode 100644 index 0000000..3e7bc48 --- /dev/null +++ b/app/dbio/cm_io_0026.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/cm_io_0026.pgc" +/* @tier easy @module cm @transform common-dbio */ +/* + * cm_io_0026.pgc - 공통 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "cm_io_0026.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/cm_io_0026.pgc" + + +int cm_io_0026_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/cm_io_0026.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/cm_io_0026.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/cm_io_0026.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from cm_io_0026_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/cm_io_0026.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0026_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int cm_io_0026_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/cm_io_0026.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/cm_io_0026.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/cm_io_0026.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update cm_io_0026_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/cm_io_0026.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0026_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long cm_io_0026_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/cm_io_0026.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/cm_io_0026.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/cm_io_0026.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from cm_io_0026_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/cm_io_0026.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0026_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/cm_io_0026.pgc b/app/dbio/cm_io_0026.pgc new file mode 100644 index 0000000..196d66c --- /dev/null +++ b/app/dbio/cm_io_0026.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module cm @transform common-dbio */ +/* + * cm_io_0026.pgc - 공통 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "cm_io_0026.h" + +EXEC SQL INCLUDE sqlca; + +int cm_io_0026_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM cm_io_0026_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0026_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int cm_io_0026_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE cm_io_0026_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0026_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long cm_io_0026_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM cm_io_0026_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("cm_io_0026_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/lg_dbio_main.c b/app/dbio/lg_dbio_main.c new file mode 100644 index 0000000..c11015b --- /dev/null +++ b/app/dbio/lg_dbio_main.c @@ -0,0 +1,399 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/lg_dbio_main.pgc" +/* @tier medium @module lg @transform ledger-dbio */ +/* + * lg_dbio_main.pgc - 원장 표준 DBIO (ECPG 임베디드 SQL) + * + * lg_core.h 의 표준 API 를 lg_ledger 테이블에 대해 구현한다. + * 온라인/배치 프로그램은 이 함수들만 호출한다 (self-contained). + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "lg_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/dbio/lg_dbio_main.pgc" + + +int lg_dbio_connect(const char *target) +{ + /* exec sql begin declare section */ + + +#line 20 "app/dbio/lg_dbio_main.pgc" + const char * h_target ; +/* exec sql end declare section */ +#line 21 "app/dbio/lg_dbio_main.pgc" + + + h_target = (target && target[0]) ? target : "acquire@localhost"; + + { ECPGconnect(__LINE__, 0, h_target , NULL, NULL , NULL, 0); } +#line 25 "app/dbio/lg_dbio_main.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg CONNECT"); + return TX_EDB; + } + tx_log(TX_LOG_INFO, "[lg] DB 접속 완료 target=%s", h_target); + return TX_OK; +} + +int lg_dbio_disconnect(void) +{ + { ECPGdisconnect(__LINE__, "CURRENT");} +#line 36 "app/dbio/lg_dbio_main.pgc" + + return TX_OK; +} + +int lg_rec_insert(const lg_rec_t *rec) +{ + /* exec sql begin declare section */ + + + + + + + + +#line 43 "app/dbio/lg_dbio_main.pgc" + char h_key [ 16 ] ; + +#line 44 "app/dbio/lg_dbio_main.pgc" + char h_merch_id [ 16 ] ; + +#line 45 "app/dbio/lg_dbio_main.pgc" + char h_card_no [ 20 ] ; + +#line 46 "app/dbio/lg_dbio_main.pgc" + long h_amount ; + +#line 47 "app/dbio/lg_dbio_main.pgc" + char h_biz_date [ 9 ] ; + +#line 48 "app/dbio/lg_dbio_main.pgc" + char h_status [ 2 ] ; + +#line 49 "app/dbio/lg_dbio_main.pgc" + long h_fee ; +/* exec sql end declare section */ +#line 50 "app/dbio/lg_dbio_main.pgc" + + + if (!rec) + return TX_EINVAL; + + strncpy(h_key, rec->key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + strncpy(h_merch_id, rec->merch_id, sizeof(h_merch_id) - 1); + h_merch_id[sizeof(h_merch_id) - 1] = '\0'; + strncpy(h_card_no, rec->card_no, sizeof(h_card_no) - 1); + h_card_no[sizeof(h_card_no) - 1] = '\0'; + strncpy(h_biz_date, rec->biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + strncpy(h_status, rec->status, sizeof(h_status) - 1); + h_status[sizeof(h_status) - 1] = '\0'; + h_amount = rec->amount; + h_fee = rec->fee; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into lg_ledger ( key , merch_id , card_no , amount , biz_date , status , fee ) values ( $1 , $2 , $3 , $4 , $5 , $6 , $7 )", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_card_no),(long)20,(long)1,(20)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_status),(long)2,(long)1,(2)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_fee),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 71 "app/dbio/lg_dbio_main.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_rec_insert"); + return TX_EDB; + } + return TX_OK; +} + +int lg_rec_select(const char *key, lg_rec_t *out) +{ + /* exec sql begin declare section */ + + + + + + + + +#line 83 "app/dbio/lg_dbio_main.pgc" + char h_key [ 16 ] ; + +#line 84 "app/dbio/lg_dbio_main.pgc" + char h_merch_id [ 16 ] ; + +#line 85 "app/dbio/lg_dbio_main.pgc" + char h_card_no [ 20 ] ; + +#line 86 "app/dbio/lg_dbio_main.pgc" + long h_amount ; + +#line 87 "app/dbio/lg_dbio_main.pgc" + char h_biz_date [ 9 ] ; + +#line 88 "app/dbio/lg_dbio_main.pgc" + char h_status [ 2 ] ; + +#line 89 "app/dbio/lg_dbio_main.pgc" + long h_fee ; +/* exec sql end declare section */ +#line 90 "app/dbio/lg_dbio_main.pgc" + + + if (!key || !out) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select merch_id , card_no , amount , biz_date , status , fee from lg_ledger where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_card_no),(long)20,(long)1,(20)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_status),(long)2,(long)1,(2)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_fee),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 101 "app/dbio/lg_dbio_main.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_rec_select"); + return TX_EDB; + } + + memset(out, 0, sizeof(*out)); + strncpy(out->key, h_key, sizeof(out->key) - 1); + strncpy(out->merch_id, h_merch_id, sizeof(out->merch_id) - 1); + strncpy(out->card_no, h_card_no, sizeof(out->card_no) - 1); + strncpy(out->biz_date, h_biz_date, sizeof(out->biz_date) - 1); + strncpy(out->status, h_status, sizeof(out->status) - 1); + out->amount = h_amount; + out->fee = h_fee; + return TX_OK; +} + +int lg_rec_update_status(const char *key, const char *status) +{ + /* exec sql begin declare section */ + + + +#line 124 "app/dbio/lg_dbio_main.pgc" + char h_key [ 16 ] ; + +#line 125 "app/dbio/lg_dbio_main.pgc" + char h_status [ 2 ] ; +/* exec sql end declare section */ +#line 126 "app/dbio/lg_dbio_main.pgc" + + + if (!key || !status) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + strncpy(h_status, status, sizeof(h_status) - 1); + h_status[sizeof(h_status) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update lg_ledger set status = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_char,(h_status),(long)2,(long)1,(2)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 138 "app/dbio/lg_dbio_main.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_rec_update_status"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long lg_rec_count(const char *biz_date, const char *status) +{ + /* exec sql begin declare section */ + + + + +#line 152 "app/dbio/lg_dbio_main.pgc" + char h_biz_date [ 9 ] ; + +#line 153 "app/dbio/lg_dbio_main.pgc" + char h_status [ 2 ] ; + +#line 154 "app/dbio/lg_dbio_main.pgc" + int h_cnt ; +/* exec sql end declare section */ +#line 155 "app/dbio/lg_dbio_main.pgc" + + + if (!biz_date || !status) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + strncpy(h_status, status, sizeof(h_status) - 1); + h_status[sizeof(h_status) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select count ( * ) from lg_ledger where biz_date = $1 and status = $2 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_status),(long)2,(long)1,(2)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_int,&(h_cnt),(long)1,(long)1,sizeof(int), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 169 "app/dbio/lg_dbio_main.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_rec_count"); + return -1; + } + return (long)h_cnt; +} + +int lg_rec_sum(const char *biz_date, long *out_sum) +{ + /* exec sql begin declare section */ + + + +#line 181 "app/dbio/lg_dbio_main.pgc" + char h_biz_date [ 9 ] ; + +#line 182 "app/dbio/lg_dbio_main.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 183 "app/dbio/lg_dbio_main.pgc" + + + if (!biz_date || !out_sum) + return TX_EINVAL; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from lg_ledger where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 194 "app/dbio/lg_dbio_main.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_rec_sum"); + return TX_EDB; + } + *out_sum = h_sum; + return TX_OK; +} diff --git a/app/dbio/lg_dbio_main.pgc b/app/dbio/lg_dbio_main.pgc new file mode 100644 index 0000000..89b0544 --- /dev/null +++ b/app/dbio/lg_dbio_main.pgc @@ -0,0 +1,202 @@ +/* @tier medium @module lg @transform ledger-dbio */ +/* + * lg_dbio_main.pgc - 원장 표준 DBIO (ECPG 임베디드 SQL) + * + * lg_core.h 의 표준 API 를 lg_ledger 테이블에 대해 구현한다. + * 온라인/배치 프로그램은 이 함수들만 호출한다 (self-contained). + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "lg_core.h" + +EXEC SQL INCLUDE sqlca; + +int lg_dbio_connect(const char *target) +{ + EXEC SQL BEGIN DECLARE SECTION; + const char *h_target; + EXEC SQL END DECLARE SECTION; + + h_target = (target && target[0]) ? target : "acquire@localhost"; + + EXEC SQL CONNECT TO :h_target; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg CONNECT"); + return TX_EDB; + } + tx_log(TX_LOG_INFO, "[lg] DB 접속 완료 target=%s", h_target); + return TX_OK; +} + +int lg_dbio_disconnect(void) +{ + EXEC SQL DISCONNECT CURRENT; + return TX_OK; +} + +int lg_rec_insert(const lg_rec_t *rec) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + char h_merch_id[16]; + char h_card_no[20]; + long h_amount; + char h_biz_date[9]; + char h_status[2]; + long h_fee; + EXEC SQL END DECLARE SECTION; + + if (!rec) + return TX_EINVAL; + + strncpy(h_key, rec->key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + strncpy(h_merch_id, rec->merch_id, sizeof(h_merch_id) - 1); + h_merch_id[sizeof(h_merch_id) - 1] = '\0'; + strncpy(h_card_no, rec->card_no, sizeof(h_card_no) - 1); + h_card_no[sizeof(h_card_no) - 1] = '\0'; + strncpy(h_biz_date, rec->biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + strncpy(h_status, rec->status, sizeof(h_status) - 1); + h_status[sizeof(h_status) - 1] = '\0'; + h_amount = rec->amount; + h_fee = rec->fee; + + EXEC SQL INSERT INTO lg_ledger + (key, merch_id, card_no, amount, biz_date, status, fee) + VALUES + (:h_key, :h_merch_id, :h_card_no, :h_amount, :h_biz_date, :h_status, :h_fee); + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_rec_insert"); + return TX_EDB; + } + return TX_OK; +} + +int lg_rec_select(const char *key, lg_rec_t *out) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + char h_merch_id[16]; + char h_card_no[20]; + long h_amount; + char h_biz_date[9]; + char h_status[2]; + long h_fee; + EXEC SQL END DECLARE SECTION; + + if (!key || !out) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT merch_id, card_no, amount, biz_date, status, fee + INTO :h_merch_id, :h_card_no, :h_amount, :h_biz_date, :h_status, :h_fee + FROM lg_ledger + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_rec_select"); + return TX_EDB; + } + + memset(out, 0, sizeof(*out)); + strncpy(out->key, h_key, sizeof(out->key) - 1); + strncpy(out->merch_id, h_merch_id, sizeof(out->merch_id) - 1); + strncpy(out->card_no, h_card_no, sizeof(out->card_no) - 1); + strncpy(out->biz_date, h_biz_date, sizeof(out->biz_date) - 1); + strncpy(out->status, h_status, sizeof(out->status) - 1); + out->amount = h_amount; + out->fee = h_fee; + return TX_OK; +} + +int lg_rec_update_status(const char *key, const char *status) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + char h_status[2]; + EXEC SQL END DECLARE SECTION; + + if (!key || !status) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + strncpy(h_status, status, sizeof(h_status) - 1); + h_status[sizeof(h_status) - 1] = '\0'; + + EXEC SQL UPDATE lg_ledger + SET status = :h_status, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_rec_update_status"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long lg_rec_count(const char *biz_date, const char *status) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_status[2]; + int h_cnt; + EXEC SQL END DECLARE SECTION; + + if (!biz_date || !status) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + strncpy(h_status, status, sizeof(h_status) - 1); + h_status[sizeof(h_status) - 1] = '\0'; + + EXEC SQL SELECT count(*) + INTO :h_cnt + FROM lg_ledger + WHERE biz_date = :h_biz_date + AND status = :h_status; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_rec_count"); + return -1; + } + return (long)h_cnt; +} + +int lg_rec_sum(const char *biz_date, long *out_sum) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date || !out_sum) + return TX_EINVAL; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM lg_ledger + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_rec_sum"); + return TX_EDB; + } + *out_sum = h_sum; + return TX_OK; +} diff --git a/app/dbio/lg_io_0001.c b/app/dbio/lg_io_0001.c new file mode 100644 index 0000000..169e8b2 --- /dev/null +++ b/app/dbio/lg_io_0001.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/lg_io_0001.pgc" +/* @tier easy @module lg @transform ledger-dbio */ +/* + * lg_io_0001.pgc - 원장 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "lg_io_0001.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/lg_io_0001.pgc" + + +int lg_io_0001_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/lg_io_0001.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/lg_io_0001.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/lg_io_0001.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from lg_io_0001_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/lg_io_0001.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0001_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int lg_io_0001_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/lg_io_0001.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/lg_io_0001.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/lg_io_0001.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update lg_io_0001_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/lg_io_0001.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0001_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long lg_io_0001_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/lg_io_0001.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/lg_io_0001.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/lg_io_0001.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from lg_io_0001_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/lg_io_0001.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0001_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/lg_io_0001.pgc b/app/dbio/lg_io_0001.pgc new file mode 100644 index 0000000..51f4cf7 --- /dev/null +++ b/app/dbio/lg_io_0001.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module lg @transform ledger-dbio */ +/* + * lg_io_0001.pgc - 원장 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "lg_io_0001.h" + +EXEC SQL INCLUDE sqlca; + +int lg_io_0001_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM lg_io_0001_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0001_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int lg_io_0001_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE lg_io_0001_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0001_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long lg_io_0001_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM lg_io_0001_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0001_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/lg_io_0002.c b/app/dbio/lg_io_0002.c new file mode 100644 index 0000000..add71c1 --- /dev/null +++ b/app/dbio/lg_io_0002.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/lg_io_0002.pgc" +/* @tier hard @module lg @transform ledger-dbio */ +/* + * lg_io_0002.pgc - 원장 보조 DBIO (ECPG) [tier=hard] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "lg_io_0002.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/lg_io_0002.pgc" + + +int lg_io_0002_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/lg_io_0002.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/lg_io_0002.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/lg_io_0002.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from lg_io_0002_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/lg_io_0002.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0002_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int lg_io_0002_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/lg_io_0002.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/lg_io_0002.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/lg_io_0002.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update lg_io_0002_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/lg_io_0002.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0002_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long lg_io_0002_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/lg_io_0002.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/lg_io_0002.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/lg_io_0002.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from lg_io_0002_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/lg_io_0002.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0002_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/lg_io_0002.pgc b/app/dbio/lg_io_0002.pgc new file mode 100644 index 0000000..59c8640 --- /dev/null +++ b/app/dbio/lg_io_0002.pgc @@ -0,0 +1,92 @@ +/* @tier hard @module lg @transform ledger-dbio */ +/* + * lg_io_0002.pgc - 원장 보조 DBIO (ECPG) [tier=hard] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "lg_io_0002.h" + +EXEC SQL INCLUDE sqlca; + +int lg_io_0002_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM lg_io_0002_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0002_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int lg_io_0002_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE lg_io_0002_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0002_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long lg_io_0002_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM lg_io_0002_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0002_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/lg_io_0003.c b/app/dbio/lg_io_0003.c new file mode 100644 index 0000000..70d9a30 --- /dev/null +++ b/app/dbio/lg_io_0003.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/lg_io_0003.pgc" +/* @tier easy @module lg @transform ledger-dbio */ +/* + * lg_io_0003.pgc - 원장 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "lg_io_0003.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/lg_io_0003.pgc" + + +int lg_io_0003_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/lg_io_0003.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/lg_io_0003.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/lg_io_0003.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from lg_io_0003_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/lg_io_0003.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0003_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int lg_io_0003_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/lg_io_0003.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/lg_io_0003.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/lg_io_0003.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update lg_io_0003_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/lg_io_0003.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0003_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long lg_io_0003_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/lg_io_0003.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/lg_io_0003.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/lg_io_0003.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from lg_io_0003_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/lg_io_0003.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0003_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/lg_io_0003.pgc b/app/dbio/lg_io_0003.pgc new file mode 100644 index 0000000..20a8ec8 --- /dev/null +++ b/app/dbio/lg_io_0003.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module lg @transform ledger-dbio */ +/* + * lg_io_0003.pgc - 원장 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "lg_io_0003.h" + +EXEC SQL INCLUDE sqlca; + +int lg_io_0003_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM lg_io_0003_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0003_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int lg_io_0003_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE lg_io_0003_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0003_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long lg_io_0003_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM lg_io_0003_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0003_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/lg_io_0004.c b/app/dbio/lg_io_0004.c new file mode 100644 index 0000000..6c8dae3 --- /dev/null +++ b/app/dbio/lg_io_0004.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/lg_io_0004.pgc" +/* @tier easy @module lg @transform ledger-dbio */ +/* + * lg_io_0004.pgc - 원장 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "lg_io_0004.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/lg_io_0004.pgc" + + +int lg_io_0004_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/lg_io_0004.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/lg_io_0004.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/lg_io_0004.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from lg_io_0004_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/lg_io_0004.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0004_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int lg_io_0004_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/lg_io_0004.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/lg_io_0004.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/lg_io_0004.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update lg_io_0004_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/lg_io_0004.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0004_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long lg_io_0004_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/lg_io_0004.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/lg_io_0004.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/lg_io_0004.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from lg_io_0004_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/lg_io_0004.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0004_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/lg_io_0004.pgc b/app/dbio/lg_io_0004.pgc new file mode 100644 index 0000000..664c098 --- /dev/null +++ b/app/dbio/lg_io_0004.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module lg @transform ledger-dbio */ +/* + * lg_io_0004.pgc - 원장 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "lg_io_0004.h" + +EXEC SQL INCLUDE sqlca; + +int lg_io_0004_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM lg_io_0004_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0004_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int lg_io_0004_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE lg_io_0004_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0004_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long lg_io_0004_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM lg_io_0004_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0004_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/lg_io_0005.c b/app/dbio/lg_io_0005.c new file mode 100644 index 0000000..1d939f5 --- /dev/null +++ b/app/dbio/lg_io_0005.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/lg_io_0005.pgc" +/* @tier medium @module lg @transform ledger-dbio */ +/* + * lg_io_0005.pgc - 원장 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "lg_io_0005.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/lg_io_0005.pgc" + + +int lg_io_0005_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/lg_io_0005.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/lg_io_0005.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/lg_io_0005.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from lg_io_0005_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/lg_io_0005.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0005_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int lg_io_0005_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/lg_io_0005.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/lg_io_0005.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/lg_io_0005.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update lg_io_0005_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/lg_io_0005.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0005_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long lg_io_0005_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/lg_io_0005.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/lg_io_0005.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/lg_io_0005.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from lg_io_0005_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/lg_io_0005.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0005_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/lg_io_0005.pgc b/app/dbio/lg_io_0005.pgc new file mode 100644 index 0000000..aaea0f6 --- /dev/null +++ b/app/dbio/lg_io_0005.pgc @@ -0,0 +1,92 @@ +/* @tier medium @module lg @transform ledger-dbio */ +/* + * lg_io_0005.pgc - 원장 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "lg_io_0005.h" + +EXEC SQL INCLUDE sqlca; + +int lg_io_0005_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM lg_io_0005_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0005_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int lg_io_0005_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE lg_io_0005_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0005_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long lg_io_0005_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM lg_io_0005_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0005_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/lg_io_0006.c b/app/dbio/lg_io_0006.c new file mode 100644 index 0000000..08c670c --- /dev/null +++ b/app/dbio/lg_io_0006.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/lg_io_0006.pgc" +/* @tier easy @module lg @transform ledger-dbio */ +/* + * lg_io_0006.pgc - 원장 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "lg_io_0006.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/lg_io_0006.pgc" + + +int lg_io_0006_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/lg_io_0006.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/lg_io_0006.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/lg_io_0006.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from lg_io_0006_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/lg_io_0006.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0006_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int lg_io_0006_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/lg_io_0006.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/lg_io_0006.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/lg_io_0006.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update lg_io_0006_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/lg_io_0006.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0006_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long lg_io_0006_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/lg_io_0006.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/lg_io_0006.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/lg_io_0006.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from lg_io_0006_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/lg_io_0006.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0006_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/lg_io_0006.pgc b/app/dbio/lg_io_0006.pgc new file mode 100644 index 0000000..42fb792 --- /dev/null +++ b/app/dbio/lg_io_0006.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module lg @transform ledger-dbio */ +/* + * lg_io_0006.pgc - 원장 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "lg_io_0006.h" + +EXEC SQL INCLUDE sqlca; + +int lg_io_0006_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM lg_io_0006_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0006_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int lg_io_0006_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE lg_io_0006_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0006_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long lg_io_0006_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM lg_io_0006_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0006_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/lg_io_0007.c b/app/dbio/lg_io_0007.c new file mode 100644 index 0000000..78f4afd --- /dev/null +++ b/app/dbio/lg_io_0007.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/lg_io_0007.pgc" +/* @tier medium @module lg @transform ledger-dbio */ +/* + * lg_io_0007.pgc - 원장 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "lg_io_0007.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/lg_io_0007.pgc" + + +int lg_io_0007_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/lg_io_0007.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/lg_io_0007.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/lg_io_0007.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from lg_io_0007_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/lg_io_0007.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0007_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int lg_io_0007_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/lg_io_0007.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/lg_io_0007.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/lg_io_0007.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update lg_io_0007_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/lg_io_0007.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0007_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long lg_io_0007_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/lg_io_0007.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/lg_io_0007.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/lg_io_0007.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from lg_io_0007_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/lg_io_0007.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0007_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/lg_io_0007.pgc b/app/dbio/lg_io_0007.pgc new file mode 100644 index 0000000..3b03b8f --- /dev/null +++ b/app/dbio/lg_io_0007.pgc @@ -0,0 +1,92 @@ +/* @tier medium @module lg @transform ledger-dbio */ +/* + * lg_io_0007.pgc - 원장 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "lg_io_0007.h" + +EXEC SQL INCLUDE sqlca; + +int lg_io_0007_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM lg_io_0007_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0007_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int lg_io_0007_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE lg_io_0007_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0007_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long lg_io_0007_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM lg_io_0007_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0007_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/lg_io_0008.c b/app/dbio/lg_io_0008.c new file mode 100644 index 0000000..e0a3b2c --- /dev/null +++ b/app/dbio/lg_io_0008.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/lg_io_0008.pgc" +/* @tier easy @module lg @transform ledger-dbio */ +/* + * lg_io_0008.pgc - 원장 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "lg_io_0008.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/lg_io_0008.pgc" + + +int lg_io_0008_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/lg_io_0008.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/lg_io_0008.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/lg_io_0008.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from lg_io_0008_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/lg_io_0008.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0008_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int lg_io_0008_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/lg_io_0008.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/lg_io_0008.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/lg_io_0008.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update lg_io_0008_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/lg_io_0008.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0008_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long lg_io_0008_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/lg_io_0008.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/lg_io_0008.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/lg_io_0008.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from lg_io_0008_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/lg_io_0008.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0008_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/lg_io_0008.pgc b/app/dbio/lg_io_0008.pgc new file mode 100644 index 0000000..480f355 --- /dev/null +++ b/app/dbio/lg_io_0008.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module lg @transform ledger-dbio */ +/* + * lg_io_0008.pgc - 원장 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "lg_io_0008.h" + +EXEC SQL INCLUDE sqlca; + +int lg_io_0008_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM lg_io_0008_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0008_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int lg_io_0008_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE lg_io_0008_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0008_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long lg_io_0008_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM lg_io_0008_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0008_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/lg_io_0009.c b/app/dbio/lg_io_0009.c new file mode 100644 index 0000000..3cbf874 --- /dev/null +++ b/app/dbio/lg_io_0009.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/lg_io_0009.pgc" +/* @tier medium @module lg @transform ledger-dbio */ +/* + * lg_io_0009.pgc - 원장 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "lg_io_0009.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/lg_io_0009.pgc" + + +int lg_io_0009_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/lg_io_0009.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/lg_io_0009.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/lg_io_0009.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from lg_io_0009_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/lg_io_0009.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0009_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int lg_io_0009_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/lg_io_0009.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/lg_io_0009.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/lg_io_0009.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update lg_io_0009_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/lg_io_0009.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0009_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long lg_io_0009_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/lg_io_0009.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/lg_io_0009.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/lg_io_0009.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from lg_io_0009_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/lg_io_0009.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0009_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/lg_io_0009.pgc b/app/dbio/lg_io_0009.pgc new file mode 100644 index 0000000..d3a12f2 --- /dev/null +++ b/app/dbio/lg_io_0009.pgc @@ -0,0 +1,92 @@ +/* @tier medium @module lg @transform ledger-dbio */ +/* + * lg_io_0009.pgc - 원장 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "lg_io_0009.h" + +EXEC SQL INCLUDE sqlca; + +int lg_io_0009_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM lg_io_0009_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0009_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int lg_io_0009_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE lg_io_0009_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0009_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long lg_io_0009_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM lg_io_0009_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0009_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/lg_io_0010.c b/app/dbio/lg_io_0010.c new file mode 100644 index 0000000..2299be6 --- /dev/null +++ b/app/dbio/lg_io_0010.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/lg_io_0010.pgc" +/* @tier easy @module lg @transform ledger-dbio */ +/* + * lg_io_0010.pgc - 원장 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "lg_io_0010.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/lg_io_0010.pgc" + + +int lg_io_0010_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/lg_io_0010.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/lg_io_0010.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/lg_io_0010.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from lg_io_0010_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/lg_io_0010.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0010_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int lg_io_0010_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/lg_io_0010.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/lg_io_0010.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/lg_io_0010.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update lg_io_0010_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/lg_io_0010.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0010_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long lg_io_0010_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/lg_io_0010.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/lg_io_0010.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/lg_io_0010.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from lg_io_0010_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/lg_io_0010.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0010_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/lg_io_0010.pgc b/app/dbio/lg_io_0010.pgc new file mode 100644 index 0000000..e5725a4 --- /dev/null +++ b/app/dbio/lg_io_0010.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module lg @transform ledger-dbio */ +/* + * lg_io_0010.pgc - 원장 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "lg_io_0010.h" + +EXEC SQL INCLUDE sqlca; + +int lg_io_0010_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM lg_io_0010_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0010_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int lg_io_0010_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE lg_io_0010_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0010_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long lg_io_0010_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM lg_io_0010_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0010_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/lg_io_0011.c b/app/dbio/lg_io_0011.c new file mode 100644 index 0000000..ae25af8 --- /dev/null +++ b/app/dbio/lg_io_0011.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/lg_io_0011.pgc" +/* @tier hard @module lg @transform ledger-dbio */ +/* + * lg_io_0011.pgc - 원장 보조 DBIO (ECPG) [tier=hard] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "lg_io_0011.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/lg_io_0011.pgc" + + +int lg_io_0011_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/lg_io_0011.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/lg_io_0011.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/lg_io_0011.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from lg_io_0011_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/lg_io_0011.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0011_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int lg_io_0011_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/lg_io_0011.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/lg_io_0011.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/lg_io_0011.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update lg_io_0011_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/lg_io_0011.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0011_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long lg_io_0011_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/lg_io_0011.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/lg_io_0011.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/lg_io_0011.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from lg_io_0011_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/lg_io_0011.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0011_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/lg_io_0011.pgc b/app/dbio/lg_io_0011.pgc new file mode 100644 index 0000000..ed92ace --- /dev/null +++ b/app/dbio/lg_io_0011.pgc @@ -0,0 +1,92 @@ +/* @tier hard @module lg @transform ledger-dbio */ +/* + * lg_io_0011.pgc - 원장 보조 DBIO (ECPG) [tier=hard] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "lg_io_0011.h" + +EXEC SQL INCLUDE sqlca; + +int lg_io_0011_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM lg_io_0011_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0011_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int lg_io_0011_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE lg_io_0011_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0011_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long lg_io_0011_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM lg_io_0011_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0011_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/lg_io_0012.c b/app/dbio/lg_io_0012.c new file mode 100644 index 0000000..2e77495 --- /dev/null +++ b/app/dbio/lg_io_0012.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/lg_io_0012.pgc" +/* @tier easy @module lg @transform ledger-dbio */ +/* + * lg_io_0012.pgc - 원장 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "lg_io_0012.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/lg_io_0012.pgc" + + +int lg_io_0012_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/lg_io_0012.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/lg_io_0012.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/lg_io_0012.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from lg_io_0012_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/lg_io_0012.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0012_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int lg_io_0012_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/lg_io_0012.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/lg_io_0012.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/lg_io_0012.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update lg_io_0012_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/lg_io_0012.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0012_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long lg_io_0012_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/lg_io_0012.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/lg_io_0012.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/lg_io_0012.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from lg_io_0012_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/lg_io_0012.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0012_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/lg_io_0012.pgc b/app/dbio/lg_io_0012.pgc new file mode 100644 index 0000000..d4724f6 --- /dev/null +++ b/app/dbio/lg_io_0012.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module lg @transform ledger-dbio */ +/* + * lg_io_0012.pgc - 원장 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "lg_io_0012.h" + +EXEC SQL INCLUDE sqlca; + +int lg_io_0012_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM lg_io_0012_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0012_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int lg_io_0012_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE lg_io_0012_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0012_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long lg_io_0012_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM lg_io_0012_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0012_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/lg_io_0013.c b/app/dbio/lg_io_0013.c new file mode 100644 index 0000000..5cabd68 --- /dev/null +++ b/app/dbio/lg_io_0013.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/lg_io_0013.pgc" +/* @tier hard @module lg @transform ledger-dbio */ +/* + * lg_io_0013.pgc - 원장 보조 DBIO (ECPG) [tier=hard] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "lg_io_0013.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/lg_io_0013.pgc" + + +int lg_io_0013_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/lg_io_0013.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/lg_io_0013.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/lg_io_0013.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from lg_io_0013_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/lg_io_0013.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0013_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int lg_io_0013_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/lg_io_0013.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/lg_io_0013.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/lg_io_0013.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update lg_io_0013_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/lg_io_0013.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0013_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long lg_io_0013_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/lg_io_0013.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/lg_io_0013.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/lg_io_0013.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from lg_io_0013_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/lg_io_0013.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0013_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/lg_io_0013.pgc b/app/dbio/lg_io_0013.pgc new file mode 100644 index 0000000..9d35872 --- /dev/null +++ b/app/dbio/lg_io_0013.pgc @@ -0,0 +1,92 @@ +/* @tier hard @module lg @transform ledger-dbio */ +/* + * lg_io_0013.pgc - 원장 보조 DBIO (ECPG) [tier=hard] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "lg_io_0013.h" + +EXEC SQL INCLUDE sqlca; + +int lg_io_0013_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM lg_io_0013_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0013_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int lg_io_0013_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE lg_io_0013_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0013_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long lg_io_0013_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM lg_io_0013_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0013_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/lg_io_0014.c b/app/dbio/lg_io_0014.c new file mode 100644 index 0000000..9f1536b --- /dev/null +++ b/app/dbio/lg_io_0014.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/lg_io_0014.pgc" +/* @tier easy @module lg @transform ledger-dbio */ +/* + * lg_io_0014.pgc - 원장 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "lg_io_0014.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/lg_io_0014.pgc" + + +int lg_io_0014_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/lg_io_0014.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/lg_io_0014.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/lg_io_0014.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from lg_io_0014_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/lg_io_0014.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0014_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int lg_io_0014_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/lg_io_0014.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/lg_io_0014.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/lg_io_0014.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update lg_io_0014_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/lg_io_0014.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0014_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long lg_io_0014_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/lg_io_0014.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/lg_io_0014.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/lg_io_0014.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from lg_io_0014_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/lg_io_0014.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0014_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/lg_io_0014.pgc b/app/dbio/lg_io_0014.pgc new file mode 100644 index 0000000..46a7e73 --- /dev/null +++ b/app/dbio/lg_io_0014.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module lg @transform ledger-dbio */ +/* + * lg_io_0014.pgc - 원장 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "lg_io_0014.h" + +EXEC SQL INCLUDE sqlca; + +int lg_io_0014_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM lg_io_0014_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0014_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int lg_io_0014_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE lg_io_0014_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0014_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long lg_io_0014_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM lg_io_0014_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0014_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/lg_io_0015.c b/app/dbio/lg_io_0015.c new file mode 100644 index 0000000..1b04609 --- /dev/null +++ b/app/dbio/lg_io_0015.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/lg_io_0015.pgc" +/* @tier easy @module lg @transform ledger-dbio */ +/* + * lg_io_0015.pgc - 원장 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "lg_io_0015.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/lg_io_0015.pgc" + + +int lg_io_0015_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/lg_io_0015.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/lg_io_0015.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/lg_io_0015.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from lg_io_0015_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/lg_io_0015.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0015_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int lg_io_0015_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/lg_io_0015.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/lg_io_0015.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/lg_io_0015.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update lg_io_0015_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/lg_io_0015.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0015_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long lg_io_0015_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/lg_io_0015.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/lg_io_0015.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/lg_io_0015.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from lg_io_0015_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/lg_io_0015.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0015_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/lg_io_0015.pgc b/app/dbio/lg_io_0015.pgc new file mode 100644 index 0000000..9a5e22b --- /dev/null +++ b/app/dbio/lg_io_0015.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module lg @transform ledger-dbio */ +/* + * lg_io_0015.pgc - 원장 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "lg_io_0015.h" + +EXEC SQL INCLUDE sqlca; + +int lg_io_0015_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM lg_io_0015_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0015_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int lg_io_0015_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE lg_io_0015_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0015_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long lg_io_0015_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM lg_io_0015_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0015_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/lg_io_0016.c b/app/dbio/lg_io_0016.c new file mode 100644 index 0000000..be98ad2 --- /dev/null +++ b/app/dbio/lg_io_0016.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/lg_io_0016.pgc" +/* @tier medium @module lg @transform ledger-dbio */ +/* + * lg_io_0016.pgc - 원장 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "lg_io_0016.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/lg_io_0016.pgc" + + +int lg_io_0016_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/lg_io_0016.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/lg_io_0016.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/lg_io_0016.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from lg_io_0016_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/lg_io_0016.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0016_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int lg_io_0016_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/lg_io_0016.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/lg_io_0016.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/lg_io_0016.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update lg_io_0016_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/lg_io_0016.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0016_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long lg_io_0016_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/lg_io_0016.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/lg_io_0016.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/lg_io_0016.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from lg_io_0016_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/lg_io_0016.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0016_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/lg_io_0016.pgc b/app/dbio/lg_io_0016.pgc new file mode 100644 index 0000000..3d90e62 --- /dev/null +++ b/app/dbio/lg_io_0016.pgc @@ -0,0 +1,92 @@ +/* @tier medium @module lg @transform ledger-dbio */ +/* + * lg_io_0016.pgc - 원장 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "lg_io_0016.h" + +EXEC SQL INCLUDE sqlca; + +int lg_io_0016_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM lg_io_0016_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0016_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int lg_io_0016_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE lg_io_0016_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0016_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long lg_io_0016_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM lg_io_0016_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0016_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/lg_io_0017.c b/app/dbio/lg_io_0017.c new file mode 100644 index 0000000..c2c9715 --- /dev/null +++ b/app/dbio/lg_io_0017.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/lg_io_0017.pgc" +/* @tier easy @module lg @transform ledger-dbio */ +/* + * lg_io_0017.pgc - 원장 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "lg_io_0017.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/lg_io_0017.pgc" + + +int lg_io_0017_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/lg_io_0017.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/lg_io_0017.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/lg_io_0017.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from lg_io_0017_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/lg_io_0017.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0017_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int lg_io_0017_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/lg_io_0017.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/lg_io_0017.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/lg_io_0017.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update lg_io_0017_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/lg_io_0017.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0017_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long lg_io_0017_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/lg_io_0017.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/lg_io_0017.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/lg_io_0017.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from lg_io_0017_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/lg_io_0017.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0017_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/lg_io_0017.pgc b/app/dbio/lg_io_0017.pgc new file mode 100644 index 0000000..9181e45 --- /dev/null +++ b/app/dbio/lg_io_0017.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module lg @transform ledger-dbio */ +/* + * lg_io_0017.pgc - 원장 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "lg_io_0017.h" + +EXEC SQL INCLUDE sqlca; + +int lg_io_0017_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM lg_io_0017_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0017_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int lg_io_0017_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE lg_io_0017_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0017_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long lg_io_0017_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM lg_io_0017_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0017_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/lg_io_0018.c b/app/dbio/lg_io_0018.c new file mode 100644 index 0000000..d1463ef --- /dev/null +++ b/app/dbio/lg_io_0018.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/lg_io_0018.pgc" +/* @tier medium @module lg @transform ledger-dbio */ +/* + * lg_io_0018.pgc - 원장 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "lg_io_0018.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/lg_io_0018.pgc" + + +int lg_io_0018_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/lg_io_0018.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/lg_io_0018.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/lg_io_0018.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from lg_io_0018_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/lg_io_0018.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0018_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int lg_io_0018_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/lg_io_0018.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/lg_io_0018.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/lg_io_0018.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update lg_io_0018_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/lg_io_0018.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0018_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long lg_io_0018_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/lg_io_0018.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/lg_io_0018.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/lg_io_0018.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from lg_io_0018_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/lg_io_0018.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0018_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/lg_io_0018.pgc b/app/dbio/lg_io_0018.pgc new file mode 100644 index 0000000..131f2d1 --- /dev/null +++ b/app/dbio/lg_io_0018.pgc @@ -0,0 +1,92 @@ +/* @tier medium @module lg @transform ledger-dbio */ +/* + * lg_io_0018.pgc - 원장 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "lg_io_0018.h" + +EXEC SQL INCLUDE sqlca; + +int lg_io_0018_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM lg_io_0018_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0018_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int lg_io_0018_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE lg_io_0018_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0018_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long lg_io_0018_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM lg_io_0018_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0018_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/lg_io_0019.c b/app/dbio/lg_io_0019.c new file mode 100644 index 0000000..480b837 --- /dev/null +++ b/app/dbio/lg_io_0019.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/lg_io_0019.pgc" +/* @tier easy @module lg @transform ledger-dbio */ +/* + * lg_io_0019.pgc - 원장 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "lg_io_0019.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/lg_io_0019.pgc" + + +int lg_io_0019_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/lg_io_0019.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/lg_io_0019.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/lg_io_0019.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from lg_io_0019_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/lg_io_0019.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0019_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int lg_io_0019_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/lg_io_0019.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/lg_io_0019.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/lg_io_0019.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update lg_io_0019_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/lg_io_0019.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0019_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long lg_io_0019_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/lg_io_0019.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/lg_io_0019.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/lg_io_0019.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from lg_io_0019_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/lg_io_0019.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0019_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/lg_io_0019.pgc b/app/dbio/lg_io_0019.pgc new file mode 100644 index 0000000..18e9cd0 --- /dev/null +++ b/app/dbio/lg_io_0019.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module lg @transform ledger-dbio */ +/* + * lg_io_0019.pgc - 원장 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "lg_io_0019.h" + +EXEC SQL INCLUDE sqlca; + +int lg_io_0019_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM lg_io_0019_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0019_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int lg_io_0019_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE lg_io_0019_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0019_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long lg_io_0019_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM lg_io_0019_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0019_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/lg_io_0020.c b/app/dbio/lg_io_0020.c new file mode 100644 index 0000000..2e6cb9c --- /dev/null +++ b/app/dbio/lg_io_0020.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/lg_io_0020.pgc" +/* @tier medium @module lg @transform ledger-dbio */ +/* + * lg_io_0020.pgc - 원장 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "lg_io_0020.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/lg_io_0020.pgc" + + +int lg_io_0020_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/lg_io_0020.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/lg_io_0020.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/lg_io_0020.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from lg_io_0020_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/lg_io_0020.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0020_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int lg_io_0020_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/lg_io_0020.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/lg_io_0020.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/lg_io_0020.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update lg_io_0020_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/lg_io_0020.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0020_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long lg_io_0020_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/lg_io_0020.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/lg_io_0020.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/lg_io_0020.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from lg_io_0020_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/lg_io_0020.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0020_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/lg_io_0020.pgc b/app/dbio/lg_io_0020.pgc new file mode 100644 index 0000000..712238f --- /dev/null +++ b/app/dbio/lg_io_0020.pgc @@ -0,0 +1,92 @@ +/* @tier medium @module lg @transform ledger-dbio */ +/* + * lg_io_0020.pgc - 원장 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "lg_io_0020.h" + +EXEC SQL INCLUDE sqlca; + +int lg_io_0020_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM lg_io_0020_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0020_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int lg_io_0020_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE lg_io_0020_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0020_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long lg_io_0020_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM lg_io_0020_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0020_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/lg_io_0021.c b/app/dbio/lg_io_0021.c new file mode 100644 index 0000000..d9192d9 --- /dev/null +++ b/app/dbio/lg_io_0021.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/lg_io_0021.pgc" +/* @tier easy @module lg @transform ledger-dbio */ +/* + * lg_io_0021.pgc - 원장 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "lg_io_0021.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/lg_io_0021.pgc" + + +int lg_io_0021_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/lg_io_0021.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/lg_io_0021.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/lg_io_0021.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from lg_io_0021_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/lg_io_0021.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0021_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int lg_io_0021_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/lg_io_0021.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/lg_io_0021.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/lg_io_0021.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update lg_io_0021_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/lg_io_0021.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0021_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long lg_io_0021_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/lg_io_0021.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/lg_io_0021.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/lg_io_0021.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from lg_io_0021_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/lg_io_0021.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0021_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/lg_io_0021.pgc b/app/dbio/lg_io_0021.pgc new file mode 100644 index 0000000..eea6f1b --- /dev/null +++ b/app/dbio/lg_io_0021.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module lg @transform ledger-dbio */ +/* + * lg_io_0021.pgc - 원장 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "lg_io_0021.h" + +EXEC SQL INCLUDE sqlca; + +int lg_io_0021_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM lg_io_0021_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0021_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int lg_io_0021_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE lg_io_0021_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0021_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long lg_io_0021_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM lg_io_0021_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0021_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/lg_io_0022.c b/app/dbio/lg_io_0022.c new file mode 100644 index 0000000..efde278 --- /dev/null +++ b/app/dbio/lg_io_0022.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/lg_io_0022.pgc" +/* @tier hard @module lg @transform ledger-dbio */ +/* + * lg_io_0022.pgc - 원장 보조 DBIO (ECPG) [tier=hard] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "lg_io_0022.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/lg_io_0022.pgc" + + +int lg_io_0022_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/lg_io_0022.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/lg_io_0022.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/lg_io_0022.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from lg_io_0022_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/lg_io_0022.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0022_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int lg_io_0022_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/lg_io_0022.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/lg_io_0022.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/lg_io_0022.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update lg_io_0022_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/lg_io_0022.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0022_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long lg_io_0022_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/lg_io_0022.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/lg_io_0022.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/lg_io_0022.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from lg_io_0022_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/lg_io_0022.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0022_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/lg_io_0022.pgc b/app/dbio/lg_io_0022.pgc new file mode 100644 index 0000000..9570705 --- /dev/null +++ b/app/dbio/lg_io_0022.pgc @@ -0,0 +1,92 @@ +/* @tier hard @module lg @transform ledger-dbio */ +/* + * lg_io_0022.pgc - 원장 보조 DBIO (ECPG) [tier=hard] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "lg_io_0022.h" + +EXEC SQL INCLUDE sqlca; + +int lg_io_0022_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM lg_io_0022_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0022_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int lg_io_0022_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE lg_io_0022_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0022_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long lg_io_0022_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM lg_io_0022_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0022_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/lg_io_0023.c b/app/dbio/lg_io_0023.c new file mode 100644 index 0000000..2fd2f53 --- /dev/null +++ b/app/dbio/lg_io_0023.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/lg_io_0023.pgc" +/* @tier easy @module lg @transform ledger-dbio */ +/* + * lg_io_0023.pgc - 원장 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "lg_io_0023.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/lg_io_0023.pgc" + + +int lg_io_0023_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/lg_io_0023.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/lg_io_0023.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/lg_io_0023.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from lg_io_0023_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/lg_io_0023.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0023_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int lg_io_0023_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/lg_io_0023.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/lg_io_0023.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/lg_io_0023.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update lg_io_0023_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/lg_io_0023.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0023_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long lg_io_0023_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/lg_io_0023.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/lg_io_0023.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/lg_io_0023.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from lg_io_0023_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/lg_io_0023.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0023_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/lg_io_0023.pgc b/app/dbio/lg_io_0023.pgc new file mode 100644 index 0000000..f8e52d8 --- /dev/null +++ b/app/dbio/lg_io_0023.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module lg @transform ledger-dbio */ +/* + * lg_io_0023.pgc - 원장 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "lg_io_0023.h" + +EXEC SQL INCLUDE sqlca; + +int lg_io_0023_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM lg_io_0023_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0023_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int lg_io_0023_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE lg_io_0023_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0023_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long lg_io_0023_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM lg_io_0023_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0023_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/lg_io_0024.c b/app/dbio/lg_io_0024.c new file mode 100644 index 0000000..6edeb91 --- /dev/null +++ b/app/dbio/lg_io_0024.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/lg_io_0024.pgc" +/* @tier easy @module lg @transform ledger-dbio */ +/* + * lg_io_0024.pgc - 원장 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "lg_io_0024.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/lg_io_0024.pgc" + + +int lg_io_0024_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/lg_io_0024.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/lg_io_0024.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/lg_io_0024.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from lg_io_0024_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/lg_io_0024.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0024_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int lg_io_0024_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/lg_io_0024.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/lg_io_0024.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/lg_io_0024.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update lg_io_0024_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/lg_io_0024.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0024_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long lg_io_0024_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/lg_io_0024.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/lg_io_0024.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/lg_io_0024.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from lg_io_0024_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/lg_io_0024.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0024_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/lg_io_0024.pgc b/app/dbio/lg_io_0024.pgc new file mode 100644 index 0000000..ef11537 --- /dev/null +++ b/app/dbio/lg_io_0024.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module lg @transform ledger-dbio */ +/* + * lg_io_0024.pgc - 원장 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "lg_io_0024.h" + +EXEC SQL INCLUDE sqlca; + +int lg_io_0024_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM lg_io_0024_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0024_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int lg_io_0024_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE lg_io_0024_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0024_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long lg_io_0024_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM lg_io_0024_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0024_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/lg_io_0025.c b/app/dbio/lg_io_0025.c new file mode 100644 index 0000000..29aced9 --- /dev/null +++ b/app/dbio/lg_io_0025.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/lg_io_0025.pgc" +/* @tier medium @module lg @transform ledger-dbio */ +/* + * lg_io_0025.pgc - 원장 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "lg_io_0025.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/lg_io_0025.pgc" + + +int lg_io_0025_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/lg_io_0025.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/lg_io_0025.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/lg_io_0025.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from lg_io_0025_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/lg_io_0025.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0025_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int lg_io_0025_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/lg_io_0025.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/lg_io_0025.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/lg_io_0025.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update lg_io_0025_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/lg_io_0025.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0025_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long lg_io_0025_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/lg_io_0025.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/lg_io_0025.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/lg_io_0025.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from lg_io_0025_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/lg_io_0025.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0025_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/lg_io_0025.pgc b/app/dbio/lg_io_0025.pgc new file mode 100644 index 0000000..eb933d3 --- /dev/null +++ b/app/dbio/lg_io_0025.pgc @@ -0,0 +1,92 @@ +/* @tier medium @module lg @transform ledger-dbio */ +/* + * lg_io_0025.pgc - 원장 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "lg_io_0025.h" + +EXEC SQL INCLUDE sqlca; + +int lg_io_0025_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM lg_io_0025_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0025_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int lg_io_0025_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE lg_io_0025_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0025_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long lg_io_0025_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM lg_io_0025_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0025_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/lg_io_0026.c b/app/dbio/lg_io_0026.c new file mode 100644 index 0000000..5c5eafb --- /dev/null +++ b/app/dbio/lg_io_0026.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/lg_io_0026.pgc" +/* @tier easy @module lg @transform ledger-dbio */ +/* + * lg_io_0026.pgc - 원장 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "lg_io_0026.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/lg_io_0026.pgc" + + +int lg_io_0026_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/lg_io_0026.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/lg_io_0026.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/lg_io_0026.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from lg_io_0026_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/lg_io_0026.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0026_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int lg_io_0026_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/lg_io_0026.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/lg_io_0026.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/lg_io_0026.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update lg_io_0026_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/lg_io_0026.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0026_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long lg_io_0026_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/lg_io_0026.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/lg_io_0026.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/lg_io_0026.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from lg_io_0026_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/lg_io_0026.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0026_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/lg_io_0026.pgc b/app/dbio/lg_io_0026.pgc new file mode 100644 index 0000000..2af3d09 --- /dev/null +++ b/app/dbio/lg_io_0026.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module lg @transform ledger-dbio */ +/* + * lg_io_0026.pgc - 원장 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "lg_io_0026.h" + +EXEC SQL INCLUDE sqlca; + +int lg_io_0026_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM lg_io_0026_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0026_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int lg_io_0026_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE lg_io_0026_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0026_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long lg_io_0026_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM lg_io_0026_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("lg_io_0026_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/mg_dbio_main.c b/app/dbio/mg_dbio_main.c new file mode 100644 index 0000000..87590df --- /dev/null +++ b/app/dbio/mg_dbio_main.c @@ -0,0 +1,399 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/mg_dbio_main.pgc" +/* @tier medium @module mg @transform msg-gateway-dbio */ +/* + * mg_dbio_main.pgc - 전문게이트웨이 표준 DBIO (ECPG 임베디드 SQL) + * + * mg_core.h 의 표준 API 를 mg_ledger 테이블에 대해 구현한다. + * 온라인/배치 프로그램은 이 함수들만 호출한다 (self-contained). + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mg_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/dbio/mg_dbio_main.pgc" + + +int mg_dbio_connect(const char *target) +{ + /* exec sql begin declare section */ + + +#line 20 "app/dbio/mg_dbio_main.pgc" + const char * h_target ; +/* exec sql end declare section */ +#line 21 "app/dbio/mg_dbio_main.pgc" + + + h_target = (target && target[0]) ? target : "acquire@localhost"; + + { ECPGconnect(__LINE__, 0, h_target , NULL, NULL , NULL, 0); } +#line 25 "app/dbio/mg_dbio_main.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg CONNECT"); + return TX_EDB; + } + tx_log(TX_LOG_INFO, "[mg] DB 접속 완료 target=%s", h_target); + return TX_OK; +} + +int mg_dbio_disconnect(void) +{ + { ECPGdisconnect(__LINE__, "CURRENT");} +#line 36 "app/dbio/mg_dbio_main.pgc" + + return TX_OK; +} + +int mg_rec_insert(const mg_rec_t *rec) +{ + /* exec sql begin declare section */ + + + + + + + + +#line 43 "app/dbio/mg_dbio_main.pgc" + char h_key [ 16 ] ; + +#line 44 "app/dbio/mg_dbio_main.pgc" + char h_merch_id [ 16 ] ; + +#line 45 "app/dbio/mg_dbio_main.pgc" + char h_card_no [ 20 ] ; + +#line 46 "app/dbio/mg_dbio_main.pgc" + long h_amount ; + +#line 47 "app/dbio/mg_dbio_main.pgc" + char h_biz_date [ 9 ] ; + +#line 48 "app/dbio/mg_dbio_main.pgc" + char h_status [ 2 ] ; + +#line 49 "app/dbio/mg_dbio_main.pgc" + long h_fee ; +/* exec sql end declare section */ +#line 50 "app/dbio/mg_dbio_main.pgc" + + + if (!rec) + return TX_EINVAL; + + strncpy(h_key, rec->key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + strncpy(h_merch_id, rec->merch_id, sizeof(h_merch_id) - 1); + h_merch_id[sizeof(h_merch_id) - 1] = '\0'; + strncpy(h_card_no, rec->card_no, sizeof(h_card_no) - 1); + h_card_no[sizeof(h_card_no) - 1] = '\0'; + strncpy(h_biz_date, rec->biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + strncpy(h_status, rec->status, sizeof(h_status) - 1); + h_status[sizeof(h_status) - 1] = '\0'; + h_amount = rec->amount; + h_fee = rec->fee; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into mg_ledger ( key , merch_id , card_no , amount , biz_date , status , fee ) values ( $1 , $2 , $3 , $4 , $5 , $6 , $7 )", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_card_no),(long)20,(long)1,(20)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_status),(long)2,(long)1,(2)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_fee),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 71 "app/dbio/mg_dbio_main.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_rec_insert"); + return TX_EDB; + } + return TX_OK; +} + +int mg_rec_select(const char *key, mg_rec_t *out) +{ + /* exec sql begin declare section */ + + + + + + + + +#line 83 "app/dbio/mg_dbio_main.pgc" + char h_key [ 16 ] ; + +#line 84 "app/dbio/mg_dbio_main.pgc" + char h_merch_id [ 16 ] ; + +#line 85 "app/dbio/mg_dbio_main.pgc" + char h_card_no [ 20 ] ; + +#line 86 "app/dbio/mg_dbio_main.pgc" + long h_amount ; + +#line 87 "app/dbio/mg_dbio_main.pgc" + char h_biz_date [ 9 ] ; + +#line 88 "app/dbio/mg_dbio_main.pgc" + char h_status [ 2 ] ; + +#line 89 "app/dbio/mg_dbio_main.pgc" + long h_fee ; +/* exec sql end declare section */ +#line 90 "app/dbio/mg_dbio_main.pgc" + + + if (!key || !out) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select merch_id , card_no , amount , biz_date , status , fee from mg_ledger where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_card_no),(long)20,(long)1,(20)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_status),(long)2,(long)1,(2)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_fee),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 101 "app/dbio/mg_dbio_main.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_rec_select"); + return TX_EDB; + } + + memset(out, 0, sizeof(*out)); + strncpy(out->key, h_key, sizeof(out->key) - 1); + strncpy(out->merch_id, h_merch_id, sizeof(out->merch_id) - 1); + strncpy(out->card_no, h_card_no, sizeof(out->card_no) - 1); + strncpy(out->biz_date, h_biz_date, sizeof(out->biz_date) - 1); + strncpy(out->status, h_status, sizeof(out->status) - 1); + out->amount = h_amount; + out->fee = h_fee; + return TX_OK; +} + +int mg_rec_update_status(const char *key, const char *status) +{ + /* exec sql begin declare section */ + + + +#line 124 "app/dbio/mg_dbio_main.pgc" + char h_key [ 16 ] ; + +#line 125 "app/dbio/mg_dbio_main.pgc" + char h_status [ 2 ] ; +/* exec sql end declare section */ +#line 126 "app/dbio/mg_dbio_main.pgc" + + + if (!key || !status) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + strncpy(h_status, status, sizeof(h_status) - 1); + h_status[sizeof(h_status) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update mg_ledger set status = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_char,(h_status),(long)2,(long)1,(2)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 138 "app/dbio/mg_dbio_main.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_rec_update_status"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mg_rec_count(const char *biz_date, const char *status) +{ + /* exec sql begin declare section */ + + + + +#line 152 "app/dbio/mg_dbio_main.pgc" + char h_biz_date [ 9 ] ; + +#line 153 "app/dbio/mg_dbio_main.pgc" + char h_status [ 2 ] ; + +#line 154 "app/dbio/mg_dbio_main.pgc" + int h_cnt ; +/* exec sql end declare section */ +#line 155 "app/dbio/mg_dbio_main.pgc" + + + if (!biz_date || !status) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + strncpy(h_status, status, sizeof(h_status) - 1); + h_status[sizeof(h_status) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select count ( * ) from mg_ledger where biz_date = $1 and status = $2 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_status),(long)2,(long)1,(2)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_int,&(h_cnt),(long)1,(long)1,sizeof(int), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 169 "app/dbio/mg_dbio_main.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_rec_count"); + return -1; + } + return (long)h_cnt; +} + +int mg_rec_sum(const char *biz_date, long *out_sum) +{ + /* exec sql begin declare section */ + + + +#line 181 "app/dbio/mg_dbio_main.pgc" + char h_biz_date [ 9 ] ; + +#line 182 "app/dbio/mg_dbio_main.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 183 "app/dbio/mg_dbio_main.pgc" + + + if (!biz_date || !out_sum) + return TX_EINVAL; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from mg_ledger where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 194 "app/dbio/mg_dbio_main.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_rec_sum"); + return TX_EDB; + } + *out_sum = h_sum; + return TX_OK; +} diff --git a/app/dbio/mg_dbio_main.pgc b/app/dbio/mg_dbio_main.pgc new file mode 100644 index 0000000..ba1e7e8 --- /dev/null +++ b/app/dbio/mg_dbio_main.pgc @@ -0,0 +1,202 @@ +/* @tier medium @module mg @transform msg-gateway-dbio */ +/* + * mg_dbio_main.pgc - 전문게이트웨이 표준 DBIO (ECPG 임베디드 SQL) + * + * mg_core.h 의 표준 API 를 mg_ledger 테이블에 대해 구현한다. + * 온라인/배치 프로그램은 이 함수들만 호출한다 (self-contained). + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mg_core.h" + +EXEC SQL INCLUDE sqlca; + +int mg_dbio_connect(const char *target) +{ + EXEC SQL BEGIN DECLARE SECTION; + const char *h_target; + EXEC SQL END DECLARE SECTION; + + h_target = (target && target[0]) ? target : "acquire@localhost"; + + EXEC SQL CONNECT TO :h_target; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg CONNECT"); + return TX_EDB; + } + tx_log(TX_LOG_INFO, "[mg] DB 접속 완료 target=%s", h_target); + return TX_OK; +} + +int mg_dbio_disconnect(void) +{ + EXEC SQL DISCONNECT CURRENT; + return TX_OK; +} + +int mg_rec_insert(const mg_rec_t *rec) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + char h_merch_id[16]; + char h_card_no[20]; + long h_amount; + char h_biz_date[9]; + char h_status[2]; + long h_fee; + EXEC SQL END DECLARE SECTION; + + if (!rec) + return TX_EINVAL; + + strncpy(h_key, rec->key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + strncpy(h_merch_id, rec->merch_id, sizeof(h_merch_id) - 1); + h_merch_id[sizeof(h_merch_id) - 1] = '\0'; + strncpy(h_card_no, rec->card_no, sizeof(h_card_no) - 1); + h_card_no[sizeof(h_card_no) - 1] = '\0'; + strncpy(h_biz_date, rec->biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + strncpy(h_status, rec->status, sizeof(h_status) - 1); + h_status[sizeof(h_status) - 1] = '\0'; + h_amount = rec->amount; + h_fee = rec->fee; + + EXEC SQL INSERT INTO mg_ledger + (key, merch_id, card_no, amount, biz_date, status, fee) + VALUES + (:h_key, :h_merch_id, :h_card_no, :h_amount, :h_biz_date, :h_status, :h_fee); + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_rec_insert"); + return TX_EDB; + } + return TX_OK; +} + +int mg_rec_select(const char *key, mg_rec_t *out) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + char h_merch_id[16]; + char h_card_no[20]; + long h_amount; + char h_biz_date[9]; + char h_status[2]; + long h_fee; + EXEC SQL END DECLARE SECTION; + + if (!key || !out) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT merch_id, card_no, amount, biz_date, status, fee + INTO :h_merch_id, :h_card_no, :h_amount, :h_biz_date, :h_status, :h_fee + FROM mg_ledger + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_rec_select"); + return TX_EDB; + } + + memset(out, 0, sizeof(*out)); + strncpy(out->key, h_key, sizeof(out->key) - 1); + strncpy(out->merch_id, h_merch_id, sizeof(out->merch_id) - 1); + strncpy(out->card_no, h_card_no, sizeof(out->card_no) - 1); + strncpy(out->biz_date, h_biz_date, sizeof(out->biz_date) - 1); + strncpy(out->status, h_status, sizeof(out->status) - 1); + out->amount = h_amount; + out->fee = h_fee; + return TX_OK; +} + +int mg_rec_update_status(const char *key, const char *status) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + char h_status[2]; + EXEC SQL END DECLARE SECTION; + + if (!key || !status) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + strncpy(h_status, status, sizeof(h_status) - 1); + h_status[sizeof(h_status) - 1] = '\0'; + + EXEC SQL UPDATE mg_ledger + SET status = :h_status, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_rec_update_status"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mg_rec_count(const char *biz_date, const char *status) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_status[2]; + int h_cnt; + EXEC SQL END DECLARE SECTION; + + if (!biz_date || !status) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + strncpy(h_status, status, sizeof(h_status) - 1); + h_status[sizeof(h_status) - 1] = '\0'; + + EXEC SQL SELECT count(*) + INTO :h_cnt + FROM mg_ledger + WHERE biz_date = :h_biz_date + AND status = :h_status; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_rec_count"); + return -1; + } + return (long)h_cnt; +} + +int mg_rec_sum(const char *biz_date, long *out_sum) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date || !out_sum) + return TX_EINVAL; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM mg_ledger + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_rec_sum"); + return TX_EDB; + } + *out_sum = h_sum; + return TX_OK; +} diff --git a/app/dbio/mg_io_0001.c b/app/dbio/mg_io_0001.c new file mode 100644 index 0000000..2de91e6 --- /dev/null +++ b/app/dbio/mg_io_0001.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/mg_io_0001.pgc" +/* @tier easy @module mg @transform msg-gateway-dbio */ +/* + * mg_io_0001.pgc - 전문게이트웨이 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mg_io_0001.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/mg_io_0001.pgc" + + +int mg_io_0001_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/mg_io_0001.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/mg_io_0001.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/mg_io_0001.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from mg_io_0001_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/mg_io_0001.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0001_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int mg_io_0001_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/mg_io_0001.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/mg_io_0001.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/mg_io_0001.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update mg_io_0001_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/mg_io_0001.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0001_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mg_io_0001_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/mg_io_0001.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/mg_io_0001.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/mg_io_0001.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from mg_io_0001_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/mg_io_0001.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0001_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/mg_io_0001.pgc b/app/dbio/mg_io_0001.pgc new file mode 100644 index 0000000..70b7863 --- /dev/null +++ b/app/dbio/mg_io_0001.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module mg @transform msg-gateway-dbio */ +/* + * mg_io_0001.pgc - 전문게이트웨이 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mg_io_0001.h" + +EXEC SQL INCLUDE sqlca; + +int mg_io_0001_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM mg_io_0001_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0001_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int mg_io_0001_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE mg_io_0001_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0001_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mg_io_0001_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM mg_io_0001_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0001_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/mg_io_0002.c b/app/dbio/mg_io_0002.c new file mode 100644 index 0000000..31cb03b --- /dev/null +++ b/app/dbio/mg_io_0002.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/mg_io_0002.pgc" +/* @tier medium @module mg @transform msg-gateway-dbio */ +/* + * mg_io_0002.pgc - 전문게이트웨이 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mg_io_0002.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/mg_io_0002.pgc" + + +int mg_io_0002_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/mg_io_0002.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/mg_io_0002.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/mg_io_0002.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from mg_io_0002_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/mg_io_0002.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0002_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int mg_io_0002_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/mg_io_0002.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/mg_io_0002.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/mg_io_0002.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update mg_io_0002_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/mg_io_0002.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0002_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mg_io_0002_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/mg_io_0002.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/mg_io_0002.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/mg_io_0002.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from mg_io_0002_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/mg_io_0002.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0002_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/mg_io_0002.pgc b/app/dbio/mg_io_0002.pgc new file mode 100644 index 0000000..4aee918 --- /dev/null +++ b/app/dbio/mg_io_0002.pgc @@ -0,0 +1,92 @@ +/* @tier medium @module mg @transform msg-gateway-dbio */ +/* + * mg_io_0002.pgc - 전문게이트웨이 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mg_io_0002.h" + +EXEC SQL INCLUDE sqlca; + +int mg_io_0002_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM mg_io_0002_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0002_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int mg_io_0002_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE mg_io_0002_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0002_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mg_io_0002_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM mg_io_0002_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0002_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/mg_io_0003.c b/app/dbio/mg_io_0003.c new file mode 100644 index 0000000..14c0d32 --- /dev/null +++ b/app/dbio/mg_io_0003.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/mg_io_0003.pgc" +/* @tier easy @module mg @transform msg-gateway-dbio */ +/* + * mg_io_0003.pgc - 전문게이트웨이 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mg_io_0003.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/mg_io_0003.pgc" + + +int mg_io_0003_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/mg_io_0003.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/mg_io_0003.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/mg_io_0003.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from mg_io_0003_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/mg_io_0003.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0003_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int mg_io_0003_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/mg_io_0003.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/mg_io_0003.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/mg_io_0003.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update mg_io_0003_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/mg_io_0003.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0003_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mg_io_0003_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/mg_io_0003.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/mg_io_0003.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/mg_io_0003.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from mg_io_0003_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/mg_io_0003.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0003_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/mg_io_0003.pgc b/app/dbio/mg_io_0003.pgc new file mode 100644 index 0000000..64fc090 --- /dev/null +++ b/app/dbio/mg_io_0003.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module mg @transform msg-gateway-dbio */ +/* + * mg_io_0003.pgc - 전문게이트웨이 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mg_io_0003.h" + +EXEC SQL INCLUDE sqlca; + +int mg_io_0003_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM mg_io_0003_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0003_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int mg_io_0003_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE mg_io_0003_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0003_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mg_io_0003_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM mg_io_0003_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0003_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/mg_io_0004.c b/app/dbio/mg_io_0004.c new file mode 100644 index 0000000..6dcf186 --- /dev/null +++ b/app/dbio/mg_io_0004.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/mg_io_0004.pgc" +/* @tier medium @module mg @transform msg-gateway-dbio */ +/* + * mg_io_0004.pgc - 전문게이트웨이 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mg_io_0004.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/mg_io_0004.pgc" + + +int mg_io_0004_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/mg_io_0004.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/mg_io_0004.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/mg_io_0004.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from mg_io_0004_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/mg_io_0004.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0004_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int mg_io_0004_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/mg_io_0004.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/mg_io_0004.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/mg_io_0004.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update mg_io_0004_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/mg_io_0004.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0004_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mg_io_0004_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/mg_io_0004.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/mg_io_0004.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/mg_io_0004.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from mg_io_0004_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/mg_io_0004.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0004_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/mg_io_0004.pgc b/app/dbio/mg_io_0004.pgc new file mode 100644 index 0000000..8d8131c --- /dev/null +++ b/app/dbio/mg_io_0004.pgc @@ -0,0 +1,92 @@ +/* @tier medium @module mg @transform msg-gateway-dbio */ +/* + * mg_io_0004.pgc - 전문게이트웨이 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mg_io_0004.h" + +EXEC SQL INCLUDE sqlca; + +int mg_io_0004_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM mg_io_0004_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0004_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int mg_io_0004_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE mg_io_0004_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0004_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mg_io_0004_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM mg_io_0004_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0004_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/mg_io_0005.c b/app/dbio/mg_io_0005.c new file mode 100644 index 0000000..60d1ef2 --- /dev/null +++ b/app/dbio/mg_io_0005.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/mg_io_0005.pgc" +/* @tier easy @module mg @transform msg-gateway-dbio */ +/* + * mg_io_0005.pgc - 전문게이트웨이 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mg_io_0005.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/mg_io_0005.pgc" + + +int mg_io_0005_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/mg_io_0005.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/mg_io_0005.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/mg_io_0005.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from mg_io_0005_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/mg_io_0005.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0005_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int mg_io_0005_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/mg_io_0005.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/mg_io_0005.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/mg_io_0005.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update mg_io_0005_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/mg_io_0005.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0005_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mg_io_0005_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/mg_io_0005.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/mg_io_0005.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/mg_io_0005.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from mg_io_0005_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/mg_io_0005.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0005_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/mg_io_0005.pgc b/app/dbio/mg_io_0005.pgc new file mode 100644 index 0000000..83a73d3 --- /dev/null +++ b/app/dbio/mg_io_0005.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module mg @transform msg-gateway-dbio */ +/* + * mg_io_0005.pgc - 전문게이트웨이 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mg_io_0005.h" + +EXEC SQL INCLUDE sqlca; + +int mg_io_0005_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM mg_io_0005_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0005_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int mg_io_0005_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE mg_io_0005_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0005_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mg_io_0005_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM mg_io_0005_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0005_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/mg_io_0006.c b/app/dbio/mg_io_0006.c new file mode 100644 index 0000000..fc61a3d --- /dev/null +++ b/app/dbio/mg_io_0006.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/mg_io_0006.pgc" +/* @tier medium @module mg @transform msg-gateway-dbio */ +/* + * mg_io_0006.pgc - 전문게이트웨이 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mg_io_0006.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/mg_io_0006.pgc" + + +int mg_io_0006_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/mg_io_0006.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/mg_io_0006.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/mg_io_0006.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from mg_io_0006_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/mg_io_0006.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0006_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int mg_io_0006_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/mg_io_0006.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/mg_io_0006.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/mg_io_0006.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update mg_io_0006_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/mg_io_0006.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0006_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mg_io_0006_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/mg_io_0006.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/mg_io_0006.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/mg_io_0006.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from mg_io_0006_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/mg_io_0006.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0006_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/mg_io_0006.pgc b/app/dbio/mg_io_0006.pgc new file mode 100644 index 0000000..7c2c84b --- /dev/null +++ b/app/dbio/mg_io_0006.pgc @@ -0,0 +1,92 @@ +/* @tier medium @module mg @transform msg-gateway-dbio */ +/* + * mg_io_0006.pgc - 전문게이트웨이 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mg_io_0006.h" + +EXEC SQL INCLUDE sqlca; + +int mg_io_0006_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM mg_io_0006_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0006_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int mg_io_0006_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE mg_io_0006_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0006_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mg_io_0006_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM mg_io_0006_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0006_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/mg_io_0007.c b/app/dbio/mg_io_0007.c new file mode 100644 index 0000000..71b8431 --- /dev/null +++ b/app/dbio/mg_io_0007.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/mg_io_0007.pgc" +/* @tier easy @module mg @transform msg-gateway-dbio */ +/* + * mg_io_0007.pgc - 전문게이트웨이 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mg_io_0007.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/mg_io_0007.pgc" + + +int mg_io_0007_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/mg_io_0007.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/mg_io_0007.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/mg_io_0007.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from mg_io_0007_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/mg_io_0007.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0007_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int mg_io_0007_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/mg_io_0007.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/mg_io_0007.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/mg_io_0007.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update mg_io_0007_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/mg_io_0007.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0007_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mg_io_0007_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/mg_io_0007.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/mg_io_0007.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/mg_io_0007.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from mg_io_0007_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/mg_io_0007.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0007_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/mg_io_0007.pgc b/app/dbio/mg_io_0007.pgc new file mode 100644 index 0000000..f1678b3 --- /dev/null +++ b/app/dbio/mg_io_0007.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module mg @transform msg-gateway-dbio */ +/* + * mg_io_0007.pgc - 전문게이트웨이 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mg_io_0007.h" + +EXEC SQL INCLUDE sqlca; + +int mg_io_0007_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM mg_io_0007_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0007_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int mg_io_0007_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE mg_io_0007_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0007_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mg_io_0007_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM mg_io_0007_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0007_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/mg_io_0008.c b/app/dbio/mg_io_0008.c new file mode 100644 index 0000000..e7ff1a4 --- /dev/null +++ b/app/dbio/mg_io_0008.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/mg_io_0008.pgc" +/* @tier hard @module mg @transform msg-gateway-dbio */ +/* + * mg_io_0008.pgc - 전문게이트웨이 보조 DBIO (ECPG) [tier=hard] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mg_io_0008.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/mg_io_0008.pgc" + + +int mg_io_0008_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/mg_io_0008.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/mg_io_0008.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/mg_io_0008.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from mg_io_0008_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/mg_io_0008.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0008_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int mg_io_0008_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/mg_io_0008.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/mg_io_0008.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/mg_io_0008.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update mg_io_0008_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/mg_io_0008.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0008_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mg_io_0008_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/mg_io_0008.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/mg_io_0008.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/mg_io_0008.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from mg_io_0008_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/mg_io_0008.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0008_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/mg_io_0008.pgc b/app/dbio/mg_io_0008.pgc new file mode 100644 index 0000000..e8d7a5f --- /dev/null +++ b/app/dbio/mg_io_0008.pgc @@ -0,0 +1,92 @@ +/* @tier hard @module mg @transform msg-gateway-dbio */ +/* + * mg_io_0008.pgc - 전문게이트웨이 보조 DBIO (ECPG) [tier=hard] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mg_io_0008.h" + +EXEC SQL INCLUDE sqlca; + +int mg_io_0008_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM mg_io_0008_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0008_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int mg_io_0008_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE mg_io_0008_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0008_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mg_io_0008_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM mg_io_0008_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0008_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/mg_io_0009.c b/app/dbio/mg_io_0009.c new file mode 100644 index 0000000..6bb98a3 --- /dev/null +++ b/app/dbio/mg_io_0009.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/mg_io_0009.pgc" +/* @tier easy @module mg @transform msg-gateway-dbio */ +/* + * mg_io_0009.pgc - 전문게이트웨이 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mg_io_0009.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/mg_io_0009.pgc" + + +int mg_io_0009_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/mg_io_0009.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/mg_io_0009.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/mg_io_0009.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from mg_io_0009_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/mg_io_0009.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0009_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int mg_io_0009_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/mg_io_0009.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/mg_io_0009.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/mg_io_0009.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update mg_io_0009_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/mg_io_0009.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0009_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mg_io_0009_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/mg_io_0009.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/mg_io_0009.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/mg_io_0009.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from mg_io_0009_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/mg_io_0009.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0009_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/mg_io_0009.pgc b/app/dbio/mg_io_0009.pgc new file mode 100644 index 0000000..736ec90 --- /dev/null +++ b/app/dbio/mg_io_0009.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module mg @transform msg-gateway-dbio */ +/* + * mg_io_0009.pgc - 전문게이트웨이 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mg_io_0009.h" + +EXEC SQL INCLUDE sqlca; + +int mg_io_0009_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM mg_io_0009_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0009_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int mg_io_0009_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE mg_io_0009_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0009_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mg_io_0009_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM mg_io_0009_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0009_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/mg_io_0010.c b/app/dbio/mg_io_0010.c new file mode 100644 index 0000000..e52ddcd --- /dev/null +++ b/app/dbio/mg_io_0010.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/mg_io_0010.pgc" +/* @tier hard @module mg @transform msg-gateway-dbio */ +/* + * mg_io_0010.pgc - 전문게이트웨이 보조 DBIO (ECPG) [tier=hard] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mg_io_0010.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/mg_io_0010.pgc" + + +int mg_io_0010_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/mg_io_0010.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/mg_io_0010.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/mg_io_0010.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from mg_io_0010_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/mg_io_0010.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0010_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int mg_io_0010_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/mg_io_0010.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/mg_io_0010.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/mg_io_0010.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update mg_io_0010_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/mg_io_0010.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0010_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mg_io_0010_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/mg_io_0010.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/mg_io_0010.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/mg_io_0010.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from mg_io_0010_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/mg_io_0010.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0010_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/mg_io_0010.pgc b/app/dbio/mg_io_0010.pgc new file mode 100644 index 0000000..7b7f435 --- /dev/null +++ b/app/dbio/mg_io_0010.pgc @@ -0,0 +1,92 @@ +/* @tier hard @module mg @transform msg-gateway-dbio */ +/* + * mg_io_0010.pgc - 전문게이트웨이 보조 DBIO (ECPG) [tier=hard] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mg_io_0010.h" + +EXEC SQL INCLUDE sqlca; + +int mg_io_0010_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM mg_io_0010_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0010_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int mg_io_0010_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE mg_io_0010_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0010_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mg_io_0010_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM mg_io_0010_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0010_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/mg_io_0011.c b/app/dbio/mg_io_0011.c new file mode 100644 index 0000000..3d1c834 --- /dev/null +++ b/app/dbio/mg_io_0011.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/mg_io_0011.pgc" +/* @tier easy @module mg @transform msg-gateway-dbio */ +/* + * mg_io_0011.pgc - 전문게이트웨이 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mg_io_0011.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/mg_io_0011.pgc" + + +int mg_io_0011_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/mg_io_0011.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/mg_io_0011.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/mg_io_0011.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from mg_io_0011_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/mg_io_0011.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0011_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int mg_io_0011_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/mg_io_0011.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/mg_io_0011.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/mg_io_0011.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update mg_io_0011_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/mg_io_0011.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0011_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mg_io_0011_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/mg_io_0011.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/mg_io_0011.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/mg_io_0011.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from mg_io_0011_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/mg_io_0011.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0011_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/mg_io_0011.pgc b/app/dbio/mg_io_0011.pgc new file mode 100644 index 0000000..2da756e --- /dev/null +++ b/app/dbio/mg_io_0011.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module mg @transform msg-gateway-dbio */ +/* + * mg_io_0011.pgc - 전문게이트웨이 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mg_io_0011.h" + +EXEC SQL INCLUDE sqlca; + +int mg_io_0011_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM mg_io_0011_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0011_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int mg_io_0011_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE mg_io_0011_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0011_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mg_io_0011_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM mg_io_0011_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0011_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/mg_io_0012.c b/app/dbio/mg_io_0012.c new file mode 100644 index 0000000..1b32ffc --- /dev/null +++ b/app/dbio/mg_io_0012.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/mg_io_0012.pgc" +/* @tier easy @module mg @transform msg-gateway-dbio */ +/* + * mg_io_0012.pgc - 전문게이트웨이 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mg_io_0012.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/mg_io_0012.pgc" + + +int mg_io_0012_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/mg_io_0012.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/mg_io_0012.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/mg_io_0012.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from mg_io_0012_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/mg_io_0012.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0012_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int mg_io_0012_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/mg_io_0012.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/mg_io_0012.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/mg_io_0012.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update mg_io_0012_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/mg_io_0012.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0012_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mg_io_0012_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/mg_io_0012.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/mg_io_0012.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/mg_io_0012.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from mg_io_0012_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/mg_io_0012.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0012_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/mg_io_0012.pgc b/app/dbio/mg_io_0012.pgc new file mode 100644 index 0000000..5c697d4 --- /dev/null +++ b/app/dbio/mg_io_0012.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module mg @transform msg-gateway-dbio */ +/* + * mg_io_0012.pgc - 전문게이트웨이 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mg_io_0012.h" + +EXEC SQL INCLUDE sqlca; + +int mg_io_0012_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM mg_io_0012_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0012_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int mg_io_0012_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE mg_io_0012_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0012_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mg_io_0012_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM mg_io_0012_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0012_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/mg_io_0013.c b/app/dbio/mg_io_0013.c new file mode 100644 index 0000000..489d1a0 --- /dev/null +++ b/app/dbio/mg_io_0013.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/mg_io_0013.pgc" +/* @tier medium @module mg @transform msg-gateway-dbio */ +/* + * mg_io_0013.pgc - 전문게이트웨이 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mg_io_0013.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/mg_io_0013.pgc" + + +int mg_io_0013_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/mg_io_0013.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/mg_io_0013.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/mg_io_0013.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from mg_io_0013_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/mg_io_0013.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0013_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int mg_io_0013_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/mg_io_0013.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/mg_io_0013.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/mg_io_0013.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update mg_io_0013_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/mg_io_0013.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0013_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mg_io_0013_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/mg_io_0013.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/mg_io_0013.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/mg_io_0013.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from mg_io_0013_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/mg_io_0013.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0013_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/mg_io_0013.pgc b/app/dbio/mg_io_0013.pgc new file mode 100644 index 0000000..e7ff88b --- /dev/null +++ b/app/dbio/mg_io_0013.pgc @@ -0,0 +1,92 @@ +/* @tier medium @module mg @transform msg-gateway-dbio */ +/* + * mg_io_0013.pgc - 전문게이트웨이 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mg_io_0013.h" + +EXEC SQL INCLUDE sqlca; + +int mg_io_0013_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM mg_io_0013_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0013_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int mg_io_0013_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE mg_io_0013_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0013_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mg_io_0013_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM mg_io_0013_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0013_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/mg_io_0014.c b/app/dbio/mg_io_0014.c new file mode 100644 index 0000000..76e8f8e --- /dev/null +++ b/app/dbio/mg_io_0014.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/mg_io_0014.pgc" +/* @tier easy @module mg @transform msg-gateway-dbio */ +/* + * mg_io_0014.pgc - 전문게이트웨이 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mg_io_0014.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/mg_io_0014.pgc" + + +int mg_io_0014_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/mg_io_0014.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/mg_io_0014.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/mg_io_0014.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from mg_io_0014_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/mg_io_0014.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0014_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int mg_io_0014_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/mg_io_0014.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/mg_io_0014.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/mg_io_0014.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update mg_io_0014_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/mg_io_0014.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0014_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mg_io_0014_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/mg_io_0014.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/mg_io_0014.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/mg_io_0014.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from mg_io_0014_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/mg_io_0014.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0014_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/mg_io_0014.pgc b/app/dbio/mg_io_0014.pgc new file mode 100644 index 0000000..990448b --- /dev/null +++ b/app/dbio/mg_io_0014.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module mg @transform msg-gateway-dbio */ +/* + * mg_io_0014.pgc - 전문게이트웨이 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mg_io_0014.h" + +EXEC SQL INCLUDE sqlca; + +int mg_io_0014_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM mg_io_0014_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0014_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int mg_io_0014_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE mg_io_0014_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0014_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mg_io_0014_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM mg_io_0014_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0014_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/mg_io_0015.c b/app/dbio/mg_io_0015.c new file mode 100644 index 0000000..34d604e --- /dev/null +++ b/app/dbio/mg_io_0015.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/mg_io_0015.pgc" +/* @tier medium @module mg @transform msg-gateway-dbio */ +/* + * mg_io_0015.pgc - 전문게이트웨이 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mg_io_0015.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/mg_io_0015.pgc" + + +int mg_io_0015_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/mg_io_0015.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/mg_io_0015.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/mg_io_0015.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from mg_io_0015_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/mg_io_0015.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0015_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int mg_io_0015_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/mg_io_0015.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/mg_io_0015.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/mg_io_0015.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update mg_io_0015_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/mg_io_0015.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0015_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mg_io_0015_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/mg_io_0015.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/mg_io_0015.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/mg_io_0015.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from mg_io_0015_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/mg_io_0015.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0015_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/mg_io_0015.pgc b/app/dbio/mg_io_0015.pgc new file mode 100644 index 0000000..0b35522 --- /dev/null +++ b/app/dbio/mg_io_0015.pgc @@ -0,0 +1,92 @@ +/* @tier medium @module mg @transform msg-gateway-dbio */ +/* + * mg_io_0015.pgc - 전문게이트웨이 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mg_io_0015.h" + +EXEC SQL INCLUDE sqlca; + +int mg_io_0015_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM mg_io_0015_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0015_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int mg_io_0015_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE mg_io_0015_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0015_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mg_io_0015_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM mg_io_0015_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0015_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/mg_io_0016.c b/app/dbio/mg_io_0016.c new file mode 100644 index 0000000..99b5a97 --- /dev/null +++ b/app/dbio/mg_io_0016.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/mg_io_0016.pgc" +/* @tier easy @module mg @transform msg-gateway-dbio */ +/* + * mg_io_0016.pgc - 전문게이트웨이 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mg_io_0016.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/mg_io_0016.pgc" + + +int mg_io_0016_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/mg_io_0016.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/mg_io_0016.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/mg_io_0016.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from mg_io_0016_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/mg_io_0016.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0016_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int mg_io_0016_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/mg_io_0016.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/mg_io_0016.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/mg_io_0016.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update mg_io_0016_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/mg_io_0016.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0016_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mg_io_0016_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/mg_io_0016.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/mg_io_0016.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/mg_io_0016.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from mg_io_0016_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/mg_io_0016.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0016_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/mg_io_0016.pgc b/app/dbio/mg_io_0016.pgc new file mode 100644 index 0000000..7ee0ccf --- /dev/null +++ b/app/dbio/mg_io_0016.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module mg @transform msg-gateway-dbio */ +/* + * mg_io_0016.pgc - 전문게이트웨이 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mg_io_0016.h" + +EXEC SQL INCLUDE sqlca; + +int mg_io_0016_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM mg_io_0016_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0016_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int mg_io_0016_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE mg_io_0016_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0016_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mg_io_0016_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM mg_io_0016_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0016_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/mg_io_0017.c b/app/dbio/mg_io_0017.c new file mode 100644 index 0000000..67378e2 --- /dev/null +++ b/app/dbio/mg_io_0017.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/mg_io_0017.pgc" +/* @tier medium @module mg @transform msg-gateway-dbio */ +/* + * mg_io_0017.pgc - 전문게이트웨이 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mg_io_0017.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/mg_io_0017.pgc" + + +int mg_io_0017_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/mg_io_0017.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/mg_io_0017.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/mg_io_0017.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from mg_io_0017_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/mg_io_0017.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0017_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int mg_io_0017_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/mg_io_0017.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/mg_io_0017.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/mg_io_0017.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update mg_io_0017_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/mg_io_0017.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0017_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mg_io_0017_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/mg_io_0017.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/mg_io_0017.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/mg_io_0017.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from mg_io_0017_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/mg_io_0017.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0017_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/mg_io_0017.pgc b/app/dbio/mg_io_0017.pgc new file mode 100644 index 0000000..7116aeb --- /dev/null +++ b/app/dbio/mg_io_0017.pgc @@ -0,0 +1,92 @@ +/* @tier medium @module mg @transform msg-gateway-dbio */ +/* + * mg_io_0017.pgc - 전문게이트웨이 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mg_io_0017.h" + +EXEC SQL INCLUDE sqlca; + +int mg_io_0017_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM mg_io_0017_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0017_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int mg_io_0017_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE mg_io_0017_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0017_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mg_io_0017_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM mg_io_0017_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0017_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/mg_io_0018.c b/app/dbio/mg_io_0018.c new file mode 100644 index 0000000..62e59a6 --- /dev/null +++ b/app/dbio/mg_io_0018.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/mg_io_0018.pgc" +/* @tier easy @module mg @transform msg-gateway-dbio */ +/* + * mg_io_0018.pgc - 전문게이트웨이 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mg_io_0018.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/mg_io_0018.pgc" + + +int mg_io_0018_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/mg_io_0018.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/mg_io_0018.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/mg_io_0018.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from mg_io_0018_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/mg_io_0018.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0018_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int mg_io_0018_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/mg_io_0018.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/mg_io_0018.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/mg_io_0018.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update mg_io_0018_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/mg_io_0018.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0018_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mg_io_0018_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/mg_io_0018.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/mg_io_0018.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/mg_io_0018.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from mg_io_0018_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/mg_io_0018.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0018_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/mg_io_0018.pgc b/app/dbio/mg_io_0018.pgc new file mode 100644 index 0000000..7909888 --- /dev/null +++ b/app/dbio/mg_io_0018.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module mg @transform msg-gateway-dbio */ +/* + * mg_io_0018.pgc - 전문게이트웨이 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mg_io_0018.h" + +EXEC SQL INCLUDE sqlca; + +int mg_io_0018_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM mg_io_0018_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0018_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int mg_io_0018_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE mg_io_0018_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0018_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mg_io_0018_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM mg_io_0018_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0018_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/mg_io_0019.c b/app/dbio/mg_io_0019.c new file mode 100644 index 0000000..bae3b53 --- /dev/null +++ b/app/dbio/mg_io_0019.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/mg_io_0019.pgc" +/* @tier hard @module mg @transform msg-gateway-dbio */ +/* + * mg_io_0019.pgc - 전문게이트웨이 보조 DBIO (ECPG) [tier=hard] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mg_io_0019.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/mg_io_0019.pgc" + + +int mg_io_0019_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/mg_io_0019.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/mg_io_0019.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/mg_io_0019.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from mg_io_0019_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/mg_io_0019.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0019_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int mg_io_0019_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/mg_io_0019.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/mg_io_0019.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/mg_io_0019.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update mg_io_0019_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/mg_io_0019.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0019_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mg_io_0019_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/mg_io_0019.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/mg_io_0019.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/mg_io_0019.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from mg_io_0019_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/mg_io_0019.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0019_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/mg_io_0019.pgc b/app/dbio/mg_io_0019.pgc new file mode 100644 index 0000000..896ffbc --- /dev/null +++ b/app/dbio/mg_io_0019.pgc @@ -0,0 +1,92 @@ +/* @tier hard @module mg @transform msg-gateway-dbio */ +/* + * mg_io_0019.pgc - 전문게이트웨이 보조 DBIO (ECPG) [tier=hard] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mg_io_0019.h" + +EXEC SQL INCLUDE sqlca; + +int mg_io_0019_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM mg_io_0019_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0019_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int mg_io_0019_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE mg_io_0019_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0019_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mg_io_0019_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM mg_io_0019_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0019_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/mg_io_0020.c b/app/dbio/mg_io_0020.c new file mode 100644 index 0000000..0922a24 --- /dev/null +++ b/app/dbio/mg_io_0020.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/mg_io_0020.pgc" +/* @tier easy @module mg @transform msg-gateway-dbio */ +/* + * mg_io_0020.pgc - 전문게이트웨이 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mg_io_0020.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/mg_io_0020.pgc" + + +int mg_io_0020_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/mg_io_0020.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/mg_io_0020.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/mg_io_0020.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from mg_io_0020_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/mg_io_0020.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0020_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int mg_io_0020_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/mg_io_0020.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/mg_io_0020.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/mg_io_0020.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update mg_io_0020_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/mg_io_0020.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0020_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mg_io_0020_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/mg_io_0020.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/mg_io_0020.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/mg_io_0020.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from mg_io_0020_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/mg_io_0020.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0020_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/mg_io_0020.pgc b/app/dbio/mg_io_0020.pgc new file mode 100644 index 0000000..1dc3df4 --- /dev/null +++ b/app/dbio/mg_io_0020.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module mg @transform msg-gateway-dbio */ +/* + * mg_io_0020.pgc - 전문게이트웨이 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mg_io_0020.h" + +EXEC SQL INCLUDE sqlca; + +int mg_io_0020_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM mg_io_0020_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0020_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int mg_io_0020_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE mg_io_0020_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0020_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mg_io_0020_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM mg_io_0020_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0020_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/mg_io_0021.c b/app/dbio/mg_io_0021.c new file mode 100644 index 0000000..f969865 --- /dev/null +++ b/app/dbio/mg_io_0021.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/mg_io_0021.pgc" +/* @tier easy @module mg @transform msg-gateway-dbio */ +/* + * mg_io_0021.pgc - 전문게이트웨이 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mg_io_0021.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/mg_io_0021.pgc" + + +int mg_io_0021_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/mg_io_0021.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/mg_io_0021.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/mg_io_0021.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from mg_io_0021_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/mg_io_0021.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0021_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int mg_io_0021_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/mg_io_0021.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/mg_io_0021.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/mg_io_0021.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update mg_io_0021_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/mg_io_0021.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0021_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mg_io_0021_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/mg_io_0021.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/mg_io_0021.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/mg_io_0021.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from mg_io_0021_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/mg_io_0021.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0021_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/mg_io_0021.pgc b/app/dbio/mg_io_0021.pgc new file mode 100644 index 0000000..5704897 --- /dev/null +++ b/app/dbio/mg_io_0021.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module mg @transform msg-gateway-dbio */ +/* + * mg_io_0021.pgc - 전문게이트웨이 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mg_io_0021.h" + +EXEC SQL INCLUDE sqlca; + +int mg_io_0021_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM mg_io_0021_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0021_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int mg_io_0021_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE mg_io_0021_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0021_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mg_io_0021_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM mg_io_0021_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0021_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/mg_io_0022.c b/app/dbio/mg_io_0022.c new file mode 100644 index 0000000..0243b41 --- /dev/null +++ b/app/dbio/mg_io_0022.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/mg_io_0022.pgc" +/* @tier medium @module mg @transform msg-gateway-dbio */ +/* + * mg_io_0022.pgc - 전문게이트웨이 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mg_io_0022.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/mg_io_0022.pgc" + + +int mg_io_0022_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/mg_io_0022.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/mg_io_0022.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/mg_io_0022.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from mg_io_0022_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/mg_io_0022.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0022_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int mg_io_0022_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/mg_io_0022.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/mg_io_0022.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/mg_io_0022.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update mg_io_0022_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/mg_io_0022.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0022_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mg_io_0022_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/mg_io_0022.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/mg_io_0022.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/mg_io_0022.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from mg_io_0022_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/mg_io_0022.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0022_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/mg_io_0022.pgc b/app/dbio/mg_io_0022.pgc new file mode 100644 index 0000000..b6ca3eb --- /dev/null +++ b/app/dbio/mg_io_0022.pgc @@ -0,0 +1,92 @@ +/* @tier medium @module mg @transform msg-gateway-dbio */ +/* + * mg_io_0022.pgc - 전문게이트웨이 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mg_io_0022.h" + +EXEC SQL INCLUDE sqlca; + +int mg_io_0022_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM mg_io_0022_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0022_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int mg_io_0022_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE mg_io_0022_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0022_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mg_io_0022_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM mg_io_0022_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0022_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/mg_io_0023.c b/app/dbio/mg_io_0023.c new file mode 100644 index 0000000..7b9f380 --- /dev/null +++ b/app/dbio/mg_io_0023.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/mg_io_0023.pgc" +/* @tier easy @module mg @transform msg-gateway-dbio */ +/* + * mg_io_0023.pgc - 전문게이트웨이 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mg_io_0023.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/mg_io_0023.pgc" + + +int mg_io_0023_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/mg_io_0023.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/mg_io_0023.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/mg_io_0023.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from mg_io_0023_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/mg_io_0023.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0023_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int mg_io_0023_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/mg_io_0023.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/mg_io_0023.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/mg_io_0023.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update mg_io_0023_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/mg_io_0023.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0023_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mg_io_0023_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/mg_io_0023.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/mg_io_0023.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/mg_io_0023.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from mg_io_0023_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/mg_io_0023.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0023_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/mg_io_0023.pgc b/app/dbio/mg_io_0023.pgc new file mode 100644 index 0000000..bcba494 --- /dev/null +++ b/app/dbio/mg_io_0023.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module mg @transform msg-gateway-dbio */ +/* + * mg_io_0023.pgc - 전문게이트웨이 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mg_io_0023.h" + +EXEC SQL INCLUDE sqlca; + +int mg_io_0023_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM mg_io_0023_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0023_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int mg_io_0023_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE mg_io_0023_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0023_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mg_io_0023_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM mg_io_0023_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0023_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/mg_io_0024.c b/app/dbio/mg_io_0024.c new file mode 100644 index 0000000..244b022 --- /dev/null +++ b/app/dbio/mg_io_0024.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/mg_io_0024.pgc" +/* @tier medium @module mg @transform msg-gateway-dbio */ +/* + * mg_io_0024.pgc - 전문게이트웨이 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mg_io_0024.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/mg_io_0024.pgc" + + +int mg_io_0024_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/mg_io_0024.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/mg_io_0024.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/mg_io_0024.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from mg_io_0024_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/mg_io_0024.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0024_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int mg_io_0024_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/mg_io_0024.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/mg_io_0024.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/mg_io_0024.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update mg_io_0024_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/mg_io_0024.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0024_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mg_io_0024_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/mg_io_0024.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/mg_io_0024.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/mg_io_0024.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from mg_io_0024_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/mg_io_0024.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0024_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/mg_io_0024.pgc b/app/dbio/mg_io_0024.pgc new file mode 100644 index 0000000..a4553d0 --- /dev/null +++ b/app/dbio/mg_io_0024.pgc @@ -0,0 +1,92 @@ +/* @tier medium @module mg @transform msg-gateway-dbio */ +/* + * mg_io_0024.pgc - 전문게이트웨이 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mg_io_0024.h" + +EXEC SQL INCLUDE sqlca; + +int mg_io_0024_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM mg_io_0024_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0024_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int mg_io_0024_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE mg_io_0024_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0024_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mg_io_0024_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM mg_io_0024_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0024_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/mg_io_0025.c b/app/dbio/mg_io_0025.c new file mode 100644 index 0000000..4481cfd --- /dev/null +++ b/app/dbio/mg_io_0025.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/mg_io_0025.pgc" +/* @tier easy @module mg @transform msg-gateway-dbio */ +/* + * mg_io_0025.pgc - 전문게이트웨이 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mg_io_0025.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/mg_io_0025.pgc" + + +int mg_io_0025_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/mg_io_0025.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/mg_io_0025.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/mg_io_0025.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from mg_io_0025_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/mg_io_0025.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0025_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int mg_io_0025_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/mg_io_0025.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/mg_io_0025.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/mg_io_0025.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update mg_io_0025_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/mg_io_0025.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0025_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mg_io_0025_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/mg_io_0025.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/mg_io_0025.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/mg_io_0025.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from mg_io_0025_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/mg_io_0025.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0025_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/mg_io_0025.pgc b/app/dbio/mg_io_0025.pgc new file mode 100644 index 0000000..907df41 --- /dev/null +++ b/app/dbio/mg_io_0025.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module mg @transform msg-gateway-dbio */ +/* + * mg_io_0025.pgc - 전문게이트웨이 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mg_io_0025.h" + +EXEC SQL INCLUDE sqlca; + +int mg_io_0025_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM mg_io_0025_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0025_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int mg_io_0025_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE mg_io_0025_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0025_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mg_io_0025_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM mg_io_0025_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0025_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/mg_io_0026.c b/app/dbio/mg_io_0026.c new file mode 100644 index 0000000..3c0a179 --- /dev/null +++ b/app/dbio/mg_io_0026.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/mg_io_0026.pgc" +/* @tier medium @module mg @transform msg-gateway-dbio */ +/* + * mg_io_0026.pgc - 전문게이트웨이 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mg_io_0026.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/mg_io_0026.pgc" + + +int mg_io_0026_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/mg_io_0026.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/mg_io_0026.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/mg_io_0026.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from mg_io_0026_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/mg_io_0026.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0026_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int mg_io_0026_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/mg_io_0026.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/mg_io_0026.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/mg_io_0026.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update mg_io_0026_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/mg_io_0026.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0026_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mg_io_0026_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/mg_io_0026.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/mg_io_0026.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/mg_io_0026.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from mg_io_0026_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/mg_io_0026.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0026_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/mg_io_0026.pgc b/app/dbio/mg_io_0026.pgc new file mode 100644 index 0000000..c09d201 --- /dev/null +++ b/app/dbio/mg_io_0026.pgc @@ -0,0 +1,92 @@ +/* @tier medium @module mg @transform msg-gateway-dbio */ +/* + * mg_io_0026.pgc - 전문게이트웨이 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mg_io_0026.h" + +EXEC SQL INCLUDE sqlca; + +int mg_io_0026_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM mg_io_0026_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0026_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int mg_io_0026_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE mg_io_0026_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0026_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mg_io_0026_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM mg_io_0026_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0026_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/mg_io_0027.c b/app/dbio/mg_io_0027.c new file mode 100644 index 0000000..dcdb6e8 --- /dev/null +++ b/app/dbio/mg_io_0027.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/mg_io_0027.pgc" +/* @tier easy @module mg @transform msg-gateway-dbio */ +/* + * mg_io_0027.pgc - 전문게이트웨이 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mg_io_0027.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/mg_io_0027.pgc" + + +int mg_io_0027_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/mg_io_0027.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/mg_io_0027.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/mg_io_0027.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from mg_io_0027_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/mg_io_0027.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0027_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int mg_io_0027_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/mg_io_0027.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/mg_io_0027.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/mg_io_0027.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update mg_io_0027_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/mg_io_0027.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0027_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mg_io_0027_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/mg_io_0027.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/mg_io_0027.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/mg_io_0027.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from mg_io_0027_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/mg_io_0027.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0027_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/mg_io_0027.pgc b/app/dbio/mg_io_0027.pgc new file mode 100644 index 0000000..c5dda95 --- /dev/null +++ b/app/dbio/mg_io_0027.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module mg @transform msg-gateway-dbio */ +/* + * mg_io_0027.pgc - 전문게이트웨이 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mg_io_0027.h" + +EXEC SQL INCLUDE sqlca; + +int mg_io_0027_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM mg_io_0027_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0027_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int mg_io_0027_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE mg_io_0027_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0027_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mg_io_0027_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM mg_io_0027_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mg_io_0027_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/mm_dbio_main.c b/app/dbio/mm_dbio_main.c new file mode 100644 index 0000000..d6f8352 --- /dev/null +++ b/app/dbio/mm_dbio_main.c @@ -0,0 +1,399 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/mm_dbio_main.pgc" +/* @tier medium @module mm @transform master-dbio */ +/* + * mm_dbio_main.pgc - 마스터 표준 DBIO (ECPG 임베디드 SQL) + * + * mm_core.h 의 표준 API 를 mm_ledger 테이블에 대해 구현한다. + * 온라인/배치 프로그램은 이 함수들만 호출한다 (self-contained). + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mm_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/dbio/mm_dbio_main.pgc" + + +int mm_dbio_connect(const char *target) +{ + /* exec sql begin declare section */ + + +#line 20 "app/dbio/mm_dbio_main.pgc" + const char * h_target ; +/* exec sql end declare section */ +#line 21 "app/dbio/mm_dbio_main.pgc" + + + h_target = (target && target[0]) ? target : "acquire@localhost"; + + { ECPGconnect(__LINE__, 0, h_target , NULL, NULL , NULL, 0); } +#line 25 "app/dbio/mm_dbio_main.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm CONNECT"); + return TX_EDB; + } + tx_log(TX_LOG_INFO, "[mm] DB 접속 완료 target=%s", h_target); + return TX_OK; +} + +int mm_dbio_disconnect(void) +{ + { ECPGdisconnect(__LINE__, "CURRENT");} +#line 36 "app/dbio/mm_dbio_main.pgc" + + return TX_OK; +} + +int mm_rec_insert(const mm_rec_t *rec) +{ + /* exec sql begin declare section */ + + + + + + + + +#line 43 "app/dbio/mm_dbio_main.pgc" + char h_key [ 16 ] ; + +#line 44 "app/dbio/mm_dbio_main.pgc" + char h_merch_id [ 16 ] ; + +#line 45 "app/dbio/mm_dbio_main.pgc" + char h_card_no [ 20 ] ; + +#line 46 "app/dbio/mm_dbio_main.pgc" + long h_amount ; + +#line 47 "app/dbio/mm_dbio_main.pgc" + char h_biz_date [ 9 ] ; + +#line 48 "app/dbio/mm_dbio_main.pgc" + char h_status [ 2 ] ; + +#line 49 "app/dbio/mm_dbio_main.pgc" + long h_fee ; +/* exec sql end declare section */ +#line 50 "app/dbio/mm_dbio_main.pgc" + + + if (!rec) + return TX_EINVAL; + + strncpy(h_key, rec->key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + strncpy(h_merch_id, rec->merch_id, sizeof(h_merch_id) - 1); + h_merch_id[sizeof(h_merch_id) - 1] = '\0'; + strncpy(h_card_no, rec->card_no, sizeof(h_card_no) - 1); + h_card_no[sizeof(h_card_no) - 1] = '\0'; + strncpy(h_biz_date, rec->biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + strncpy(h_status, rec->status, sizeof(h_status) - 1); + h_status[sizeof(h_status) - 1] = '\0'; + h_amount = rec->amount; + h_fee = rec->fee; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into mm_ledger ( key , merch_id , card_no , amount , biz_date , status , fee ) values ( $1 , $2 , $3 , $4 , $5 , $6 , $7 )", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_card_no),(long)20,(long)1,(20)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_status),(long)2,(long)1,(2)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_fee),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 71 "app/dbio/mm_dbio_main.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_rec_insert"); + return TX_EDB; + } + return TX_OK; +} + +int mm_rec_select(const char *key, mm_rec_t *out) +{ + /* exec sql begin declare section */ + + + + + + + + +#line 83 "app/dbio/mm_dbio_main.pgc" + char h_key [ 16 ] ; + +#line 84 "app/dbio/mm_dbio_main.pgc" + char h_merch_id [ 16 ] ; + +#line 85 "app/dbio/mm_dbio_main.pgc" + char h_card_no [ 20 ] ; + +#line 86 "app/dbio/mm_dbio_main.pgc" + long h_amount ; + +#line 87 "app/dbio/mm_dbio_main.pgc" + char h_biz_date [ 9 ] ; + +#line 88 "app/dbio/mm_dbio_main.pgc" + char h_status [ 2 ] ; + +#line 89 "app/dbio/mm_dbio_main.pgc" + long h_fee ; +/* exec sql end declare section */ +#line 90 "app/dbio/mm_dbio_main.pgc" + + + if (!key || !out) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select merch_id , card_no , amount , biz_date , status , fee from mm_ledger where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_card_no),(long)20,(long)1,(20)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_status),(long)2,(long)1,(2)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_fee),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 101 "app/dbio/mm_dbio_main.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_rec_select"); + return TX_EDB; + } + + memset(out, 0, sizeof(*out)); + strncpy(out->key, h_key, sizeof(out->key) - 1); + strncpy(out->merch_id, h_merch_id, sizeof(out->merch_id) - 1); + strncpy(out->card_no, h_card_no, sizeof(out->card_no) - 1); + strncpy(out->biz_date, h_biz_date, sizeof(out->biz_date) - 1); + strncpy(out->status, h_status, sizeof(out->status) - 1); + out->amount = h_amount; + out->fee = h_fee; + return TX_OK; +} + +int mm_rec_update_status(const char *key, const char *status) +{ + /* exec sql begin declare section */ + + + +#line 124 "app/dbio/mm_dbio_main.pgc" + char h_key [ 16 ] ; + +#line 125 "app/dbio/mm_dbio_main.pgc" + char h_status [ 2 ] ; +/* exec sql end declare section */ +#line 126 "app/dbio/mm_dbio_main.pgc" + + + if (!key || !status) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + strncpy(h_status, status, sizeof(h_status) - 1); + h_status[sizeof(h_status) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update mm_ledger set status = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_char,(h_status),(long)2,(long)1,(2)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 138 "app/dbio/mm_dbio_main.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_rec_update_status"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mm_rec_count(const char *biz_date, const char *status) +{ + /* exec sql begin declare section */ + + + + +#line 152 "app/dbio/mm_dbio_main.pgc" + char h_biz_date [ 9 ] ; + +#line 153 "app/dbio/mm_dbio_main.pgc" + char h_status [ 2 ] ; + +#line 154 "app/dbio/mm_dbio_main.pgc" + int h_cnt ; +/* exec sql end declare section */ +#line 155 "app/dbio/mm_dbio_main.pgc" + + + if (!biz_date || !status) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + strncpy(h_status, status, sizeof(h_status) - 1); + h_status[sizeof(h_status) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select count ( * ) from mm_ledger where biz_date = $1 and status = $2 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_status),(long)2,(long)1,(2)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_int,&(h_cnt),(long)1,(long)1,sizeof(int), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 169 "app/dbio/mm_dbio_main.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_rec_count"); + return -1; + } + return (long)h_cnt; +} + +int mm_rec_sum(const char *biz_date, long *out_sum) +{ + /* exec sql begin declare section */ + + + +#line 181 "app/dbio/mm_dbio_main.pgc" + char h_biz_date [ 9 ] ; + +#line 182 "app/dbio/mm_dbio_main.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 183 "app/dbio/mm_dbio_main.pgc" + + + if (!biz_date || !out_sum) + return TX_EINVAL; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from mm_ledger where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 194 "app/dbio/mm_dbio_main.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_rec_sum"); + return TX_EDB; + } + *out_sum = h_sum; + return TX_OK; +} diff --git a/app/dbio/mm_dbio_main.pgc b/app/dbio/mm_dbio_main.pgc new file mode 100644 index 0000000..7ea598c --- /dev/null +++ b/app/dbio/mm_dbio_main.pgc @@ -0,0 +1,202 @@ +/* @tier medium @module mm @transform master-dbio */ +/* + * mm_dbio_main.pgc - 마스터 표준 DBIO (ECPG 임베디드 SQL) + * + * mm_core.h 의 표준 API 를 mm_ledger 테이블에 대해 구현한다. + * 온라인/배치 프로그램은 이 함수들만 호출한다 (self-contained). + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mm_core.h" + +EXEC SQL INCLUDE sqlca; + +int mm_dbio_connect(const char *target) +{ + EXEC SQL BEGIN DECLARE SECTION; + const char *h_target; + EXEC SQL END DECLARE SECTION; + + h_target = (target && target[0]) ? target : "acquire@localhost"; + + EXEC SQL CONNECT TO :h_target; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm CONNECT"); + return TX_EDB; + } + tx_log(TX_LOG_INFO, "[mm] DB 접속 완료 target=%s", h_target); + return TX_OK; +} + +int mm_dbio_disconnect(void) +{ + EXEC SQL DISCONNECT CURRENT; + return TX_OK; +} + +int mm_rec_insert(const mm_rec_t *rec) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + char h_merch_id[16]; + char h_card_no[20]; + long h_amount; + char h_biz_date[9]; + char h_status[2]; + long h_fee; + EXEC SQL END DECLARE SECTION; + + if (!rec) + return TX_EINVAL; + + strncpy(h_key, rec->key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + strncpy(h_merch_id, rec->merch_id, sizeof(h_merch_id) - 1); + h_merch_id[sizeof(h_merch_id) - 1] = '\0'; + strncpy(h_card_no, rec->card_no, sizeof(h_card_no) - 1); + h_card_no[sizeof(h_card_no) - 1] = '\0'; + strncpy(h_biz_date, rec->biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + strncpy(h_status, rec->status, sizeof(h_status) - 1); + h_status[sizeof(h_status) - 1] = '\0'; + h_amount = rec->amount; + h_fee = rec->fee; + + EXEC SQL INSERT INTO mm_ledger + (key, merch_id, card_no, amount, biz_date, status, fee) + VALUES + (:h_key, :h_merch_id, :h_card_no, :h_amount, :h_biz_date, :h_status, :h_fee); + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_rec_insert"); + return TX_EDB; + } + return TX_OK; +} + +int mm_rec_select(const char *key, mm_rec_t *out) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + char h_merch_id[16]; + char h_card_no[20]; + long h_amount; + char h_biz_date[9]; + char h_status[2]; + long h_fee; + EXEC SQL END DECLARE SECTION; + + if (!key || !out) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT merch_id, card_no, amount, biz_date, status, fee + INTO :h_merch_id, :h_card_no, :h_amount, :h_biz_date, :h_status, :h_fee + FROM mm_ledger + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_rec_select"); + return TX_EDB; + } + + memset(out, 0, sizeof(*out)); + strncpy(out->key, h_key, sizeof(out->key) - 1); + strncpy(out->merch_id, h_merch_id, sizeof(out->merch_id) - 1); + strncpy(out->card_no, h_card_no, sizeof(out->card_no) - 1); + strncpy(out->biz_date, h_biz_date, sizeof(out->biz_date) - 1); + strncpy(out->status, h_status, sizeof(out->status) - 1); + out->amount = h_amount; + out->fee = h_fee; + return TX_OK; +} + +int mm_rec_update_status(const char *key, const char *status) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + char h_status[2]; + EXEC SQL END DECLARE SECTION; + + if (!key || !status) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + strncpy(h_status, status, sizeof(h_status) - 1); + h_status[sizeof(h_status) - 1] = '\0'; + + EXEC SQL UPDATE mm_ledger + SET status = :h_status, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_rec_update_status"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mm_rec_count(const char *biz_date, const char *status) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_status[2]; + int h_cnt; + EXEC SQL END DECLARE SECTION; + + if (!biz_date || !status) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + strncpy(h_status, status, sizeof(h_status) - 1); + h_status[sizeof(h_status) - 1] = '\0'; + + EXEC SQL SELECT count(*) + INTO :h_cnt + FROM mm_ledger + WHERE biz_date = :h_biz_date + AND status = :h_status; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_rec_count"); + return -1; + } + return (long)h_cnt; +} + +int mm_rec_sum(const char *biz_date, long *out_sum) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date || !out_sum) + return TX_EINVAL; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM mm_ledger + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_rec_sum"); + return TX_EDB; + } + *out_sum = h_sum; + return TX_OK; +} diff --git a/app/dbio/mm_io_0001.c b/app/dbio/mm_io_0001.c new file mode 100644 index 0000000..82de62a --- /dev/null +++ b/app/dbio/mm_io_0001.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/mm_io_0001.pgc" +/* @tier easy @module mm @transform master-dbio */ +/* + * mm_io_0001.pgc - 마스터 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mm_io_0001.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/mm_io_0001.pgc" + + +int mm_io_0001_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/mm_io_0001.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/mm_io_0001.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/mm_io_0001.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from mm_io_0001_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/mm_io_0001.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0001_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int mm_io_0001_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/mm_io_0001.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/mm_io_0001.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/mm_io_0001.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update mm_io_0001_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/mm_io_0001.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0001_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mm_io_0001_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/mm_io_0001.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/mm_io_0001.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/mm_io_0001.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from mm_io_0001_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/mm_io_0001.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0001_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/mm_io_0001.pgc b/app/dbio/mm_io_0001.pgc new file mode 100644 index 0000000..4a3a7bf --- /dev/null +++ b/app/dbio/mm_io_0001.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module mm @transform master-dbio */ +/* + * mm_io_0001.pgc - 마스터 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mm_io_0001.h" + +EXEC SQL INCLUDE sqlca; + +int mm_io_0001_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM mm_io_0001_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0001_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int mm_io_0001_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE mm_io_0001_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0001_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mm_io_0001_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM mm_io_0001_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0001_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/mm_io_0002.c b/app/dbio/mm_io_0002.c new file mode 100644 index 0000000..98cb41d --- /dev/null +++ b/app/dbio/mm_io_0002.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/mm_io_0002.pgc" +/* @tier hard @module mm @transform master-dbio */ +/* + * mm_io_0002.pgc - 마스터 보조 DBIO (ECPG) [tier=hard] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mm_io_0002.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/mm_io_0002.pgc" + + +int mm_io_0002_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/mm_io_0002.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/mm_io_0002.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/mm_io_0002.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from mm_io_0002_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/mm_io_0002.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0002_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int mm_io_0002_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/mm_io_0002.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/mm_io_0002.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/mm_io_0002.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update mm_io_0002_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/mm_io_0002.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0002_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mm_io_0002_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/mm_io_0002.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/mm_io_0002.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/mm_io_0002.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from mm_io_0002_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/mm_io_0002.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0002_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/mm_io_0002.pgc b/app/dbio/mm_io_0002.pgc new file mode 100644 index 0000000..04ecd33 --- /dev/null +++ b/app/dbio/mm_io_0002.pgc @@ -0,0 +1,92 @@ +/* @tier hard @module mm @transform master-dbio */ +/* + * mm_io_0002.pgc - 마스터 보조 DBIO (ECPG) [tier=hard] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mm_io_0002.h" + +EXEC SQL INCLUDE sqlca; + +int mm_io_0002_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM mm_io_0002_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0002_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int mm_io_0002_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE mm_io_0002_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0002_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mm_io_0002_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM mm_io_0002_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0002_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/mm_io_0003.c b/app/dbio/mm_io_0003.c new file mode 100644 index 0000000..c721fb4 --- /dev/null +++ b/app/dbio/mm_io_0003.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/mm_io_0003.pgc" +/* @tier easy @module mm @transform master-dbio */ +/* + * mm_io_0003.pgc - 마스터 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mm_io_0003.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/mm_io_0003.pgc" + + +int mm_io_0003_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/mm_io_0003.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/mm_io_0003.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/mm_io_0003.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from mm_io_0003_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/mm_io_0003.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0003_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int mm_io_0003_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/mm_io_0003.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/mm_io_0003.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/mm_io_0003.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update mm_io_0003_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/mm_io_0003.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0003_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mm_io_0003_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/mm_io_0003.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/mm_io_0003.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/mm_io_0003.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from mm_io_0003_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/mm_io_0003.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0003_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/mm_io_0003.pgc b/app/dbio/mm_io_0003.pgc new file mode 100644 index 0000000..b16f9cf --- /dev/null +++ b/app/dbio/mm_io_0003.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module mm @transform master-dbio */ +/* + * mm_io_0003.pgc - 마스터 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mm_io_0003.h" + +EXEC SQL INCLUDE sqlca; + +int mm_io_0003_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM mm_io_0003_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0003_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int mm_io_0003_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE mm_io_0003_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0003_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mm_io_0003_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM mm_io_0003_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0003_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/mm_io_0004.c b/app/dbio/mm_io_0004.c new file mode 100644 index 0000000..b36fa1a --- /dev/null +++ b/app/dbio/mm_io_0004.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/mm_io_0004.pgc" +/* @tier easy @module mm @transform master-dbio */ +/* + * mm_io_0004.pgc - 마스터 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mm_io_0004.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/mm_io_0004.pgc" + + +int mm_io_0004_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/mm_io_0004.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/mm_io_0004.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/mm_io_0004.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from mm_io_0004_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/mm_io_0004.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0004_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int mm_io_0004_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/mm_io_0004.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/mm_io_0004.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/mm_io_0004.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update mm_io_0004_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/mm_io_0004.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0004_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mm_io_0004_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/mm_io_0004.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/mm_io_0004.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/mm_io_0004.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from mm_io_0004_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/mm_io_0004.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0004_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/mm_io_0004.pgc b/app/dbio/mm_io_0004.pgc new file mode 100644 index 0000000..8d122a8 --- /dev/null +++ b/app/dbio/mm_io_0004.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module mm @transform master-dbio */ +/* + * mm_io_0004.pgc - 마스터 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mm_io_0004.h" + +EXEC SQL INCLUDE sqlca; + +int mm_io_0004_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM mm_io_0004_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0004_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int mm_io_0004_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE mm_io_0004_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0004_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mm_io_0004_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM mm_io_0004_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0004_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/mm_io_0005.c b/app/dbio/mm_io_0005.c new file mode 100644 index 0000000..effc998 --- /dev/null +++ b/app/dbio/mm_io_0005.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/mm_io_0005.pgc" +/* @tier medium @module mm @transform master-dbio */ +/* + * mm_io_0005.pgc - 마스터 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mm_io_0005.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/mm_io_0005.pgc" + + +int mm_io_0005_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/mm_io_0005.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/mm_io_0005.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/mm_io_0005.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from mm_io_0005_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/mm_io_0005.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0005_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int mm_io_0005_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/mm_io_0005.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/mm_io_0005.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/mm_io_0005.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update mm_io_0005_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/mm_io_0005.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0005_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mm_io_0005_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/mm_io_0005.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/mm_io_0005.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/mm_io_0005.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from mm_io_0005_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/mm_io_0005.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0005_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/mm_io_0005.pgc b/app/dbio/mm_io_0005.pgc new file mode 100644 index 0000000..933759e --- /dev/null +++ b/app/dbio/mm_io_0005.pgc @@ -0,0 +1,92 @@ +/* @tier medium @module mm @transform master-dbio */ +/* + * mm_io_0005.pgc - 마스터 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mm_io_0005.h" + +EXEC SQL INCLUDE sqlca; + +int mm_io_0005_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM mm_io_0005_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0005_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int mm_io_0005_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE mm_io_0005_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0005_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mm_io_0005_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM mm_io_0005_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0005_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/mm_io_0006.c b/app/dbio/mm_io_0006.c new file mode 100644 index 0000000..7d65f72 --- /dev/null +++ b/app/dbio/mm_io_0006.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/mm_io_0006.pgc" +/* @tier easy @module mm @transform master-dbio */ +/* + * mm_io_0006.pgc - 마스터 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mm_io_0006.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/mm_io_0006.pgc" + + +int mm_io_0006_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/mm_io_0006.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/mm_io_0006.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/mm_io_0006.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from mm_io_0006_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/mm_io_0006.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0006_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int mm_io_0006_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/mm_io_0006.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/mm_io_0006.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/mm_io_0006.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update mm_io_0006_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/mm_io_0006.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0006_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mm_io_0006_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/mm_io_0006.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/mm_io_0006.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/mm_io_0006.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from mm_io_0006_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/mm_io_0006.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0006_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/mm_io_0006.pgc b/app/dbio/mm_io_0006.pgc new file mode 100644 index 0000000..66d8905 --- /dev/null +++ b/app/dbio/mm_io_0006.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module mm @transform master-dbio */ +/* + * mm_io_0006.pgc - 마스터 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mm_io_0006.h" + +EXEC SQL INCLUDE sqlca; + +int mm_io_0006_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM mm_io_0006_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0006_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int mm_io_0006_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE mm_io_0006_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0006_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mm_io_0006_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM mm_io_0006_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0006_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/mm_io_0007.c b/app/dbio/mm_io_0007.c new file mode 100644 index 0000000..1f0a7cb --- /dev/null +++ b/app/dbio/mm_io_0007.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/mm_io_0007.pgc" +/* @tier medium @module mm @transform master-dbio */ +/* + * mm_io_0007.pgc - 마스터 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mm_io_0007.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/mm_io_0007.pgc" + + +int mm_io_0007_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/mm_io_0007.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/mm_io_0007.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/mm_io_0007.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from mm_io_0007_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/mm_io_0007.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0007_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int mm_io_0007_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/mm_io_0007.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/mm_io_0007.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/mm_io_0007.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update mm_io_0007_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/mm_io_0007.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0007_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mm_io_0007_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/mm_io_0007.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/mm_io_0007.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/mm_io_0007.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from mm_io_0007_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/mm_io_0007.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0007_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/mm_io_0007.pgc b/app/dbio/mm_io_0007.pgc new file mode 100644 index 0000000..ad2c778 --- /dev/null +++ b/app/dbio/mm_io_0007.pgc @@ -0,0 +1,92 @@ +/* @tier medium @module mm @transform master-dbio */ +/* + * mm_io_0007.pgc - 마스터 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mm_io_0007.h" + +EXEC SQL INCLUDE sqlca; + +int mm_io_0007_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM mm_io_0007_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0007_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int mm_io_0007_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE mm_io_0007_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0007_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mm_io_0007_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM mm_io_0007_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0007_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/mm_io_0008.c b/app/dbio/mm_io_0008.c new file mode 100644 index 0000000..0c2c830 --- /dev/null +++ b/app/dbio/mm_io_0008.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/mm_io_0008.pgc" +/* @tier easy @module mm @transform master-dbio */ +/* + * mm_io_0008.pgc - 마스터 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mm_io_0008.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/mm_io_0008.pgc" + + +int mm_io_0008_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/mm_io_0008.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/mm_io_0008.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/mm_io_0008.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from mm_io_0008_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/mm_io_0008.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0008_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int mm_io_0008_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/mm_io_0008.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/mm_io_0008.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/mm_io_0008.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update mm_io_0008_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/mm_io_0008.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0008_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mm_io_0008_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/mm_io_0008.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/mm_io_0008.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/mm_io_0008.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from mm_io_0008_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/mm_io_0008.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0008_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/mm_io_0008.pgc b/app/dbio/mm_io_0008.pgc new file mode 100644 index 0000000..0fba807 --- /dev/null +++ b/app/dbio/mm_io_0008.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module mm @transform master-dbio */ +/* + * mm_io_0008.pgc - 마스터 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mm_io_0008.h" + +EXEC SQL INCLUDE sqlca; + +int mm_io_0008_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM mm_io_0008_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0008_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int mm_io_0008_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE mm_io_0008_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0008_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mm_io_0008_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM mm_io_0008_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0008_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/mm_io_0009.c b/app/dbio/mm_io_0009.c new file mode 100644 index 0000000..c26f64e --- /dev/null +++ b/app/dbio/mm_io_0009.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/mm_io_0009.pgc" +/* @tier medium @module mm @transform master-dbio */ +/* + * mm_io_0009.pgc - 마스터 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mm_io_0009.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/mm_io_0009.pgc" + + +int mm_io_0009_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/mm_io_0009.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/mm_io_0009.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/mm_io_0009.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from mm_io_0009_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/mm_io_0009.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0009_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int mm_io_0009_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/mm_io_0009.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/mm_io_0009.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/mm_io_0009.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update mm_io_0009_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/mm_io_0009.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0009_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mm_io_0009_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/mm_io_0009.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/mm_io_0009.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/mm_io_0009.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from mm_io_0009_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/mm_io_0009.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0009_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/mm_io_0009.pgc b/app/dbio/mm_io_0009.pgc new file mode 100644 index 0000000..7dba69b --- /dev/null +++ b/app/dbio/mm_io_0009.pgc @@ -0,0 +1,92 @@ +/* @tier medium @module mm @transform master-dbio */ +/* + * mm_io_0009.pgc - 마스터 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mm_io_0009.h" + +EXEC SQL INCLUDE sqlca; + +int mm_io_0009_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM mm_io_0009_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0009_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int mm_io_0009_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE mm_io_0009_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0009_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mm_io_0009_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM mm_io_0009_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0009_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/mm_io_0010.c b/app/dbio/mm_io_0010.c new file mode 100644 index 0000000..f959177 --- /dev/null +++ b/app/dbio/mm_io_0010.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/mm_io_0010.pgc" +/* @tier easy @module mm @transform master-dbio */ +/* + * mm_io_0010.pgc - 마스터 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mm_io_0010.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/mm_io_0010.pgc" + + +int mm_io_0010_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/mm_io_0010.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/mm_io_0010.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/mm_io_0010.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from mm_io_0010_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/mm_io_0010.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0010_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int mm_io_0010_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/mm_io_0010.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/mm_io_0010.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/mm_io_0010.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update mm_io_0010_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/mm_io_0010.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0010_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mm_io_0010_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/mm_io_0010.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/mm_io_0010.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/mm_io_0010.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from mm_io_0010_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/mm_io_0010.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0010_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/mm_io_0010.pgc b/app/dbio/mm_io_0010.pgc new file mode 100644 index 0000000..df75183 --- /dev/null +++ b/app/dbio/mm_io_0010.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module mm @transform master-dbio */ +/* + * mm_io_0010.pgc - 마스터 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mm_io_0010.h" + +EXEC SQL INCLUDE sqlca; + +int mm_io_0010_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM mm_io_0010_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0010_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int mm_io_0010_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE mm_io_0010_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0010_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mm_io_0010_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM mm_io_0010_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0010_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/mm_io_0011.c b/app/dbio/mm_io_0011.c new file mode 100644 index 0000000..59b5d36 --- /dev/null +++ b/app/dbio/mm_io_0011.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/mm_io_0011.pgc" +/* @tier hard @module mm @transform master-dbio */ +/* + * mm_io_0011.pgc - 마스터 보조 DBIO (ECPG) [tier=hard] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mm_io_0011.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/mm_io_0011.pgc" + + +int mm_io_0011_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/mm_io_0011.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/mm_io_0011.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/mm_io_0011.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from mm_io_0011_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/mm_io_0011.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0011_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int mm_io_0011_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/mm_io_0011.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/mm_io_0011.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/mm_io_0011.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update mm_io_0011_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/mm_io_0011.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0011_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mm_io_0011_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/mm_io_0011.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/mm_io_0011.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/mm_io_0011.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from mm_io_0011_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/mm_io_0011.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0011_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/mm_io_0011.pgc b/app/dbio/mm_io_0011.pgc new file mode 100644 index 0000000..d5439b5 --- /dev/null +++ b/app/dbio/mm_io_0011.pgc @@ -0,0 +1,92 @@ +/* @tier hard @module mm @transform master-dbio */ +/* + * mm_io_0011.pgc - 마스터 보조 DBIO (ECPG) [tier=hard] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mm_io_0011.h" + +EXEC SQL INCLUDE sqlca; + +int mm_io_0011_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM mm_io_0011_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0011_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int mm_io_0011_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE mm_io_0011_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0011_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mm_io_0011_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM mm_io_0011_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0011_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/mm_io_0012.c b/app/dbio/mm_io_0012.c new file mode 100644 index 0000000..1fc3bbf --- /dev/null +++ b/app/dbio/mm_io_0012.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/mm_io_0012.pgc" +/* @tier easy @module mm @transform master-dbio */ +/* + * mm_io_0012.pgc - 마스터 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mm_io_0012.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/mm_io_0012.pgc" + + +int mm_io_0012_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/mm_io_0012.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/mm_io_0012.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/mm_io_0012.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from mm_io_0012_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/mm_io_0012.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0012_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int mm_io_0012_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/mm_io_0012.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/mm_io_0012.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/mm_io_0012.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update mm_io_0012_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/mm_io_0012.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0012_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mm_io_0012_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/mm_io_0012.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/mm_io_0012.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/mm_io_0012.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from mm_io_0012_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/mm_io_0012.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0012_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/mm_io_0012.pgc b/app/dbio/mm_io_0012.pgc new file mode 100644 index 0000000..5bd8ae1 --- /dev/null +++ b/app/dbio/mm_io_0012.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module mm @transform master-dbio */ +/* + * mm_io_0012.pgc - 마스터 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mm_io_0012.h" + +EXEC SQL INCLUDE sqlca; + +int mm_io_0012_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM mm_io_0012_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0012_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int mm_io_0012_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE mm_io_0012_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0012_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mm_io_0012_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM mm_io_0012_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0012_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/mm_io_0013.c b/app/dbio/mm_io_0013.c new file mode 100644 index 0000000..2b066de --- /dev/null +++ b/app/dbio/mm_io_0013.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/mm_io_0013.pgc" +/* @tier easy @module mm @transform master-dbio */ +/* + * mm_io_0013.pgc - 마스터 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mm_io_0013.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/mm_io_0013.pgc" + + +int mm_io_0013_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/mm_io_0013.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/mm_io_0013.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/mm_io_0013.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from mm_io_0013_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/mm_io_0013.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0013_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int mm_io_0013_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/mm_io_0013.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/mm_io_0013.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/mm_io_0013.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update mm_io_0013_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/mm_io_0013.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0013_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mm_io_0013_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/mm_io_0013.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/mm_io_0013.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/mm_io_0013.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from mm_io_0013_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/mm_io_0013.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0013_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/mm_io_0013.pgc b/app/dbio/mm_io_0013.pgc new file mode 100644 index 0000000..0b83ce2 --- /dev/null +++ b/app/dbio/mm_io_0013.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module mm @transform master-dbio */ +/* + * mm_io_0013.pgc - 마스터 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mm_io_0013.h" + +EXEC SQL INCLUDE sqlca; + +int mm_io_0013_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM mm_io_0013_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0013_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int mm_io_0013_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE mm_io_0013_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0013_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mm_io_0013_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM mm_io_0013_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0013_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/mm_io_0014.c b/app/dbio/mm_io_0014.c new file mode 100644 index 0000000..d3538e3 --- /dev/null +++ b/app/dbio/mm_io_0014.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/mm_io_0014.pgc" +/* @tier medium @module mm @transform master-dbio */ +/* + * mm_io_0014.pgc - 마스터 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mm_io_0014.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/mm_io_0014.pgc" + + +int mm_io_0014_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/mm_io_0014.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/mm_io_0014.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/mm_io_0014.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from mm_io_0014_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/mm_io_0014.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0014_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int mm_io_0014_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/mm_io_0014.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/mm_io_0014.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/mm_io_0014.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update mm_io_0014_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/mm_io_0014.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0014_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mm_io_0014_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/mm_io_0014.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/mm_io_0014.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/mm_io_0014.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from mm_io_0014_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/mm_io_0014.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0014_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/mm_io_0014.pgc b/app/dbio/mm_io_0014.pgc new file mode 100644 index 0000000..668ddb2 --- /dev/null +++ b/app/dbio/mm_io_0014.pgc @@ -0,0 +1,92 @@ +/* @tier medium @module mm @transform master-dbio */ +/* + * mm_io_0014.pgc - 마스터 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mm_io_0014.h" + +EXEC SQL INCLUDE sqlca; + +int mm_io_0014_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM mm_io_0014_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0014_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int mm_io_0014_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE mm_io_0014_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0014_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mm_io_0014_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM mm_io_0014_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0014_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/mm_io_0015.c b/app/dbio/mm_io_0015.c new file mode 100644 index 0000000..e84f8fe --- /dev/null +++ b/app/dbio/mm_io_0015.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/mm_io_0015.pgc" +/* @tier easy @module mm @transform master-dbio */ +/* + * mm_io_0015.pgc - 마스터 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mm_io_0015.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/mm_io_0015.pgc" + + +int mm_io_0015_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/mm_io_0015.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/mm_io_0015.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/mm_io_0015.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from mm_io_0015_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/mm_io_0015.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0015_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int mm_io_0015_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/mm_io_0015.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/mm_io_0015.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/mm_io_0015.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update mm_io_0015_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/mm_io_0015.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0015_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mm_io_0015_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/mm_io_0015.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/mm_io_0015.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/mm_io_0015.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from mm_io_0015_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/mm_io_0015.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0015_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/mm_io_0015.pgc b/app/dbio/mm_io_0015.pgc new file mode 100644 index 0000000..e4291fc --- /dev/null +++ b/app/dbio/mm_io_0015.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module mm @transform master-dbio */ +/* + * mm_io_0015.pgc - 마스터 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mm_io_0015.h" + +EXEC SQL INCLUDE sqlca; + +int mm_io_0015_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM mm_io_0015_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0015_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int mm_io_0015_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE mm_io_0015_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0015_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mm_io_0015_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM mm_io_0015_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0015_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/mm_io_0016.c b/app/dbio/mm_io_0016.c new file mode 100644 index 0000000..e4861a9 --- /dev/null +++ b/app/dbio/mm_io_0016.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/mm_io_0016.pgc" +/* @tier medium @module mm @transform master-dbio */ +/* + * mm_io_0016.pgc - 마스터 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mm_io_0016.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/mm_io_0016.pgc" + + +int mm_io_0016_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/mm_io_0016.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/mm_io_0016.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/mm_io_0016.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from mm_io_0016_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/mm_io_0016.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0016_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int mm_io_0016_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/mm_io_0016.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/mm_io_0016.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/mm_io_0016.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update mm_io_0016_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/mm_io_0016.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0016_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mm_io_0016_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/mm_io_0016.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/mm_io_0016.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/mm_io_0016.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from mm_io_0016_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/mm_io_0016.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0016_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/mm_io_0016.pgc b/app/dbio/mm_io_0016.pgc new file mode 100644 index 0000000..269e302 --- /dev/null +++ b/app/dbio/mm_io_0016.pgc @@ -0,0 +1,92 @@ +/* @tier medium @module mm @transform master-dbio */ +/* + * mm_io_0016.pgc - 마스터 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mm_io_0016.h" + +EXEC SQL INCLUDE sqlca; + +int mm_io_0016_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM mm_io_0016_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0016_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int mm_io_0016_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE mm_io_0016_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0016_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mm_io_0016_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM mm_io_0016_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0016_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/mm_io_0017.c b/app/dbio/mm_io_0017.c new file mode 100644 index 0000000..53cea74 --- /dev/null +++ b/app/dbio/mm_io_0017.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/mm_io_0017.pgc" +/* @tier easy @module mm @transform master-dbio */ +/* + * mm_io_0017.pgc - 마스터 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mm_io_0017.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/mm_io_0017.pgc" + + +int mm_io_0017_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/mm_io_0017.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/mm_io_0017.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/mm_io_0017.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from mm_io_0017_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/mm_io_0017.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0017_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int mm_io_0017_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/mm_io_0017.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/mm_io_0017.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/mm_io_0017.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update mm_io_0017_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/mm_io_0017.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0017_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mm_io_0017_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/mm_io_0017.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/mm_io_0017.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/mm_io_0017.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from mm_io_0017_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/mm_io_0017.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0017_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/mm_io_0017.pgc b/app/dbio/mm_io_0017.pgc new file mode 100644 index 0000000..79a3989 --- /dev/null +++ b/app/dbio/mm_io_0017.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module mm @transform master-dbio */ +/* + * mm_io_0017.pgc - 마스터 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mm_io_0017.h" + +EXEC SQL INCLUDE sqlca; + +int mm_io_0017_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM mm_io_0017_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0017_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int mm_io_0017_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE mm_io_0017_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0017_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mm_io_0017_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM mm_io_0017_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0017_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/mm_io_0018.c b/app/dbio/mm_io_0018.c new file mode 100644 index 0000000..26efa2b --- /dev/null +++ b/app/dbio/mm_io_0018.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/mm_io_0018.pgc" +/* @tier medium @module mm @transform master-dbio */ +/* + * mm_io_0018.pgc - 마스터 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mm_io_0018.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/mm_io_0018.pgc" + + +int mm_io_0018_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/mm_io_0018.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/mm_io_0018.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/mm_io_0018.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from mm_io_0018_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/mm_io_0018.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0018_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int mm_io_0018_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/mm_io_0018.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/mm_io_0018.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/mm_io_0018.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update mm_io_0018_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/mm_io_0018.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0018_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mm_io_0018_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/mm_io_0018.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/mm_io_0018.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/mm_io_0018.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from mm_io_0018_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/mm_io_0018.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0018_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/mm_io_0018.pgc b/app/dbio/mm_io_0018.pgc new file mode 100644 index 0000000..4546df9 --- /dev/null +++ b/app/dbio/mm_io_0018.pgc @@ -0,0 +1,92 @@ +/* @tier medium @module mm @transform master-dbio */ +/* + * mm_io_0018.pgc - 마스터 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mm_io_0018.h" + +EXEC SQL INCLUDE sqlca; + +int mm_io_0018_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM mm_io_0018_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0018_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int mm_io_0018_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE mm_io_0018_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0018_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mm_io_0018_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM mm_io_0018_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0018_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/mm_io_0019.c b/app/dbio/mm_io_0019.c new file mode 100644 index 0000000..a02836a --- /dev/null +++ b/app/dbio/mm_io_0019.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/mm_io_0019.pgc" +/* @tier easy @module mm @transform master-dbio */ +/* + * mm_io_0019.pgc - 마스터 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mm_io_0019.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/mm_io_0019.pgc" + + +int mm_io_0019_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/mm_io_0019.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/mm_io_0019.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/mm_io_0019.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from mm_io_0019_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/mm_io_0019.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0019_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int mm_io_0019_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/mm_io_0019.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/mm_io_0019.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/mm_io_0019.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update mm_io_0019_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/mm_io_0019.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0019_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mm_io_0019_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/mm_io_0019.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/mm_io_0019.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/mm_io_0019.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from mm_io_0019_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/mm_io_0019.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0019_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/mm_io_0019.pgc b/app/dbio/mm_io_0019.pgc new file mode 100644 index 0000000..bc496f8 --- /dev/null +++ b/app/dbio/mm_io_0019.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module mm @transform master-dbio */ +/* + * mm_io_0019.pgc - 마스터 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mm_io_0019.h" + +EXEC SQL INCLUDE sqlca; + +int mm_io_0019_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM mm_io_0019_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0019_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int mm_io_0019_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE mm_io_0019_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0019_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mm_io_0019_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM mm_io_0019_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0019_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/mm_io_0020.c b/app/dbio/mm_io_0020.c new file mode 100644 index 0000000..f981e06 --- /dev/null +++ b/app/dbio/mm_io_0020.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/mm_io_0020.pgc" +/* @tier hard @module mm @transform master-dbio */ +/* + * mm_io_0020.pgc - 마스터 보조 DBIO (ECPG) [tier=hard] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mm_io_0020.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/mm_io_0020.pgc" + + +int mm_io_0020_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/mm_io_0020.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/mm_io_0020.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/mm_io_0020.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from mm_io_0020_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/mm_io_0020.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0020_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int mm_io_0020_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/mm_io_0020.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/mm_io_0020.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/mm_io_0020.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update mm_io_0020_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/mm_io_0020.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0020_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mm_io_0020_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/mm_io_0020.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/mm_io_0020.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/mm_io_0020.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from mm_io_0020_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/mm_io_0020.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0020_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/mm_io_0020.pgc b/app/dbio/mm_io_0020.pgc new file mode 100644 index 0000000..5bd5224 --- /dev/null +++ b/app/dbio/mm_io_0020.pgc @@ -0,0 +1,92 @@ +/* @tier hard @module mm @transform master-dbio */ +/* + * mm_io_0020.pgc - 마스터 보조 DBIO (ECPG) [tier=hard] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mm_io_0020.h" + +EXEC SQL INCLUDE sqlca; + +int mm_io_0020_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM mm_io_0020_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0020_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int mm_io_0020_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE mm_io_0020_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0020_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mm_io_0020_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM mm_io_0020_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0020_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/mm_io_0021.c b/app/dbio/mm_io_0021.c new file mode 100644 index 0000000..253ca9d --- /dev/null +++ b/app/dbio/mm_io_0021.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/mm_io_0021.pgc" +/* @tier easy @module mm @transform master-dbio */ +/* + * mm_io_0021.pgc - 마스터 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mm_io_0021.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/mm_io_0021.pgc" + + +int mm_io_0021_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/mm_io_0021.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/mm_io_0021.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/mm_io_0021.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from mm_io_0021_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/mm_io_0021.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0021_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int mm_io_0021_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/mm_io_0021.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/mm_io_0021.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/mm_io_0021.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update mm_io_0021_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/mm_io_0021.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0021_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mm_io_0021_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/mm_io_0021.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/mm_io_0021.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/mm_io_0021.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from mm_io_0021_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/mm_io_0021.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0021_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/mm_io_0021.pgc b/app/dbio/mm_io_0021.pgc new file mode 100644 index 0000000..5b67001 --- /dev/null +++ b/app/dbio/mm_io_0021.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module mm @transform master-dbio */ +/* + * mm_io_0021.pgc - 마스터 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mm_io_0021.h" + +EXEC SQL INCLUDE sqlca; + +int mm_io_0021_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM mm_io_0021_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0021_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int mm_io_0021_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE mm_io_0021_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0021_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mm_io_0021_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM mm_io_0021_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0021_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/mm_io_0022.c b/app/dbio/mm_io_0022.c new file mode 100644 index 0000000..5929e3c --- /dev/null +++ b/app/dbio/mm_io_0022.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/mm_io_0022.pgc" +/* @tier hard @module mm @transform master-dbio */ +/* + * mm_io_0022.pgc - 마스터 보조 DBIO (ECPG) [tier=hard] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mm_io_0022.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/mm_io_0022.pgc" + + +int mm_io_0022_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/mm_io_0022.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/mm_io_0022.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/mm_io_0022.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from mm_io_0022_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/mm_io_0022.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0022_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int mm_io_0022_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/mm_io_0022.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/mm_io_0022.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/mm_io_0022.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update mm_io_0022_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/mm_io_0022.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0022_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mm_io_0022_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/mm_io_0022.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/mm_io_0022.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/mm_io_0022.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from mm_io_0022_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/mm_io_0022.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0022_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/mm_io_0022.pgc b/app/dbio/mm_io_0022.pgc new file mode 100644 index 0000000..f691aa9 --- /dev/null +++ b/app/dbio/mm_io_0022.pgc @@ -0,0 +1,92 @@ +/* @tier hard @module mm @transform master-dbio */ +/* + * mm_io_0022.pgc - 마스터 보조 DBIO (ECPG) [tier=hard] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mm_io_0022.h" + +EXEC SQL INCLUDE sqlca; + +int mm_io_0022_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM mm_io_0022_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0022_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int mm_io_0022_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE mm_io_0022_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0022_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mm_io_0022_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM mm_io_0022_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0022_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/mm_io_0023.c b/app/dbio/mm_io_0023.c new file mode 100644 index 0000000..bbe9ff2 --- /dev/null +++ b/app/dbio/mm_io_0023.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/mm_io_0023.pgc" +/* @tier easy @module mm @transform master-dbio */ +/* + * mm_io_0023.pgc - 마스터 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mm_io_0023.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/mm_io_0023.pgc" + + +int mm_io_0023_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/mm_io_0023.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/mm_io_0023.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/mm_io_0023.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from mm_io_0023_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/mm_io_0023.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0023_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int mm_io_0023_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/mm_io_0023.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/mm_io_0023.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/mm_io_0023.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update mm_io_0023_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/mm_io_0023.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0023_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mm_io_0023_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/mm_io_0023.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/mm_io_0023.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/mm_io_0023.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from mm_io_0023_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/mm_io_0023.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0023_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/mm_io_0023.pgc b/app/dbio/mm_io_0023.pgc new file mode 100644 index 0000000..687b35c --- /dev/null +++ b/app/dbio/mm_io_0023.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module mm @transform master-dbio */ +/* + * mm_io_0023.pgc - 마스터 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mm_io_0023.h" + +EXEC SQL INCLUDE sqlca; + +int mm_io_0023_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM mm_io_0023_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0023_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int mm_io_0023_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE mm_io_0023_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0023_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mm_io_0023_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM mm_io_0023_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0023_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/mm_io_0024.c b/app/dbio/mm_io_0024.c new file mode 100644 index 0000000..94be67c --- /dev/null +++ b/app/dbio/mm_io_0024.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/mm_io_0024.pgc" +/* @tier easy @module mm @transform master-dbio */ +/* + * mm_io_0024.pgc - 마스터 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mm_io_0024.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/mm_io_0024.pgc" + + +int mm_io_0024_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/mm_io_0024.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/mm_io_0024.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/mm_io_0024.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from mm_io_0024_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/mm_io_0024.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0024_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int mm_io_0024_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/mm_io_0024.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/mm_io_0024.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/mm_io_0024.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update mm_io_0024_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/mm_io_0024.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0024_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mm_io_0024_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/mm_io_0024.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/mm_io_0024.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/mm_io_0024.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from mm_io_0024_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/mm_io_0024.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0024_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/mm_io_0024.pgc b/app/dbio/mm_io_0024.pgc new file mode 100644 index 0000000..38d8ea9 --- /dev/null +++ b/app/dbio/mm_io_0024.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module mm @transform master-dbio */ +/* + * mm_io_0024.pgc - 마스터 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mm_io_0024.h" + +EXEC SQL INCLUDE sqlca; + +int mm_io_0024_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM mm_io_0024_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0024_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int mm_io_0024_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE mm_io_0024_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0024_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mm_io_0024_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM mm_io_0024_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0024_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/mm_io_0025.c b/app/dbio/mm_io_0025.c new file mode 100644 index 0000000..a97174e --- /dev/null +++ b/app/dbio/mm_io_0025.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/mm_io_0025.pgc" +/* @tier medium @module mm @transform master-dbio */ +/* + * mm_io_0025.pgc - 마스터 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mm_io_0025.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/mm_io_0025.pgc" + + +int mm_io_0025_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/mm_io_0025.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/mm_io_0025.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/mm_io_0025.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from mm_io_0025_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/mm_io_0025.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0025_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int mm_io_0025_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/mm_io_0025.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/mm_io_0025.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/mm_io_0025.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update mm_io_0025_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/mm_io_0025.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0025_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mm_io_0025_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/mm_io_0025.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/mm_io_0025.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/mm_io_0025.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from mm_io_0025_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/mm_io_0025.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0025_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/mm_io_0025.pgc b/app/dbio/mm_io_0025.pgc new file mode 100644 index 0000000..c689a58 --- /dev/null +++ b/app/dbio/mm_io_0025.pgc @@ -0,0 +1,92 @@ +/* @tier medium @module mm @transform master-dbio */ +/* + * mm_io_0025.pgc - 마스터 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mm_io_0025.h" + +EXEC SQL INCLUDE sqlca; + +int mm_io_0025_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM mm_io_0025_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0025_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int mm_io_0025_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE mm_io_0025_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0025_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mm_io_0025_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM mm_io_0025_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0025_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/mm_io_0026.c b/app/dbio/mm_io_0026.c new file mode 100644 index 0000000..da3ef18 --- /dev/null +++ b/app/dbio/mm_io_0026.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/mm_io_0026.pgc" +/* @tier easy @module mm @transform master-dbio */ +/* + * mm_io_0026.pgc - 마스터 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mm_io_0026.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/mm_io_0026.pgc" + + +int mm_io_0026_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/mm_io_0026.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/mm_io_0026.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/mm_io_0026.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from mm_io_0026_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/mm_io_0026.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0026_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int mm_io_0026_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/mm_io_0026.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/mm_io_0026.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/mm_io_0026.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update mm_io_0026_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/mm_io_0026.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0026_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mm_io_0026_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/mm_io_0026.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/mm_io_0026.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/mm_io_0026.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from mm_io_0026_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/mm_io_0026.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0026_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/mm_io_0026.pgc b/app/dbio/mm_io_0026.pgc new file mode 100644 index 0000000..5a49f7d --- /dev/null +++ b/app/dbio/mm_io_0026.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module mm @transform master-dbio */ +/* + * mm_io_0026.pgc - 마스터 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "mm_io_0026.h" + +EXEC SQL INCLUDE sqlca; + +int mm_io_0026_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM mm_io_0026_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0026_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int mm_io_0026_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE mm_io_0026_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0026_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long mm_io_0026_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM mm_io_0026_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("mm_io_0026_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/py_dbio_main.c b/app/dbio/py_dbio_main.c new file mode 100644 index 0000000..7cf7e5b --- /dev/null +++ b/app/dbio/py_dbio_main.c @@ -0,0 +1,399 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/py_dbio_main.pgc" +/* @tier medium @module py @transform payment-dbio */ +/* + * py_dbio_main.pgc - 지급 표준 DBIO (ECPG 임베디드 SQL) + * + * py_core.h 의 표준 API 를 py_ledger 테이블에 대해 구현한다. + * 온라인/배치 프로그램은 이 함수들만 호출한다 (self-contained). + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "py_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/dbio/py_dbio_main.pgc" + + +int py_dbio_connect(const char *target) +{ + /* exec sql begin declare section */ + + +#line 20 "app/dbio/py_dbio_main.pgc" + const char * h_target ; +/* exec sql end declare section */ +#line 21 "app/dbio/py_dbio_main.pgc" + + + h_target = (target && target[0]) ? target : "acquire@localhost"; + + { ECPGconnect(__LINE__, 0, h_target , NULL, NULL , NULL, 0); } +#line 25 "app/dbio/py_dbio_main.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py CONNECT"); + return TX_EDB; + } + tx_log(TX_LOG_INFO, "[py] DB 접속 완료 target=%s", h_target); + return TX_OK; +} + +int py_dbio_disconnect(void) +{ + { ECPGdisconnect(__LINE__, "CURRENT");} +#line 36 "app/dbio/py_dbio_main.pgc" + + return TX_OK; +} + +int py_rec_insert(const py_rec_t *rec) +{ + /* exec sql begin declare section */ + + + + + + + + +#line 43 "app/dbio/py_dbio_main.pgc" + char h_key [ 16 ] ; + +#line 44 "app/dbio/py_dbio_main.pgc" + char h_merch_id [ 16 ] ; + +#line 45 "app/dbio/py_dbio_main.pgc" + char h_card_no [ 20 ] ; + +#line 46 "app/dbio/py_dbio_main.pgc" + long h_amount ; + +#line 47 "app/dbio/py_dbio_main.pgc" + char h_biz_date [ 9 ] ; + +#line 48 "app/dbio/py_dbio_main.pgc" + char h_status [ 2 ] ; + +#line 49 "app/dbio/py_dbio_main.pgc" + long h_fee ; +/* exec sql end declare section */ +#line 50 "app/dbio/py_dbio_main.pgc" + + + if (!rec) + return TX_EINVAL; + + strncpy(h_key, rec->key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + strncpy(h_merch_id, rec->merch_id, sizeof(h_merch_id) - 1); + h_merch_id[sizeof(h_merch_id) - 1] = '\0'; + strncpy(h_card_no, rec->card_no, sizeof(h_card_no) - 1); + h_card_no[sizeof(h_card_no) - 1] = '\0'; + strncpy(h_biz_date, rec->biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + strncpy(h_status, rec->status, sizeof(h_status) - 1); + h_status[sizeof(h_status) - 1] = '\0'; + h_amount = rec->amount; + h_fee = rec->fee; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into py_ledger ( key , merch_id , card_no , amount , biz_date , status , fee ) values ( $1 , $2 , $3 , $4 , $5 , $6 , $7 )", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_card_no),(long)20,(long)1,(20)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_status),(long)2,(long)1,(2)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_fee),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 71 "app/dbio/py_dbio_main.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_rec_insert"); + return TX_EDB; + } + return TX_OK; +} + +int py_rec_select(const char *key, py_rec_t *out) +{ + /* exec sql begin declare section */ + + + + + + + + +#line 83 "app/dbio/py_dbio_main.pgc" + char h_key [ 16 ] ; + +#line 84 "app/dbio/py_dbio_main.pgc" + char h_merch_id [ 16 ] ; + +#line 85 "app/dbio/py_dbio_main.pgc" + char h_card_no [ 20 ] ; + +#line 86 "app/dbio/py_dbio_main.pgc" + long h_amount ; + +#line 87 "app/dbio/py_dbio_main.pgc" + char h_biz_date [ 9 ] ; + +#line 88 "app/dbio/py_dbio_main.pgc" + char h_status [ 2 ] ; + +#line 89 "app/dbio/py_dbio_main.pgc" + long h_fee ; +/* exec sql end declare section */ +#line 90 "app/dbio/py_dbio_main.pgc" + + + if (!key || !out) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select merch_id , card_no , amount , biz_date , status , fee from py_ledger where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_card_no),(long)20,(long)1,(20)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_status),(long)2,(long)1,(2)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_fee),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 101 "app/dbio/py_dbio_main.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_rec_select"); + return TX_EDB; + } + + memset(out, 0, sizeof(*out)); + strncpy(out->key, h_key, sizeof(out->key) - 1); + strncpy(out->merch_id, h_merch_id, sizeof(out->merch_id) - 1); + strncpy(out->card_no, h_card_no, sizeof(out->card_no) - 1); + strncpy(out->biz_date, h_biz_date, sizeof(out->biz_date) - 1); + strncpy(out->status, h_status, sizeof(out->status) - 1); + out->amount = h_amount; + out->fee = h_fee; + return TX_OK; +} + +int py_rec_update_status(const char *key, const char *status) +{ + /* exec sql begin declare section */ + + + +#line 124 "app/dbio/py_dbio_main.pgc" + char h_key [ 16 ] ; + +#line 125 "app/dbio/py_dbio_main.pgc" + char h_status [ 2 ] ; +/* exec sql end declare section */ +#line 126 "app/dbio/py_dbio_main.pgc" + + + if (!key || !status) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + strncpy(h_status, status, sizeof(h_status) - 1); + h_status[sizeof(h_status) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update py_ledger set status = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_char,(h_status),(long)2,(long)1,(2)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 138 "app/dbio/py_dbio_main.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_rec_update_status"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long py_rec_count(const char *biz_date, const char *status) +{ + /* exec sql begin declare section */ + + + + +#line 152 "app/dbio/py_dbio_main.pgc" + char h_biz_date [ 9 ] ; + +#line 153 "app/dbio/py_dbio_main.pgc" + char h_status [ 2 ] ; + +#line 154 "app/dbio/py_dbio_main.pgc" + int h_cnt ; +/* exec sql end declare section */ +#line 155 "app/dbio/py_dbio_main.pgc" + + + if (!biz_date || !status) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + strncpy(h_status, status, sizeof(h_status) - 1); + h_status[sizeof(h_status) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select count ( * ) from py_ledger where biz_date = $1 and status = $2 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_status),(long)2,(long)1,(2)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_int,&(h_cnt),(long)1,(long)1,sizeof(int), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 169 "app/dbio/py_dbio_main.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_rec_count"); + return -1; + } + return (long)h_cnt; +} + +int py_rec_sum(const char *biz_date, long *out_sum) +{ + /* exec sql begin declare section */ + + + +#line 181 "app/dbio/py_dbio_main.pgc" + char h_biz_date [ 9 ] ; + +#line 182 "app/dbio/py_dbio_main.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 183 "app/dbio/py_dbio_main.pgc" + + + if (!biz_date || !out_sum) + return TX_EINVAL; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from py_ledger where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 194 "app/dbio/py_dbio_main.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_rec_sum"); + return TX_EDB; + } + *out_sum = h_sum; + return TX_OK; +} diff --git a/app/dbio/py_dbio_main.pgc b/app/dbio/py_dbio_main.pgc new file mode 100644 index 0000000..df8ca66 --- /dev/null +++ b/app/dbio/py_dbio_main.pgc @@ -0,0 +1,202 @@ +/* @tier medium @module py @transform payment-dbio */ +/* + * py_dbio_main.pgc - 지급 표준 DBIO (ECPG 임베디드 SQL) + * + * py_core.h 의 표준 API 를 py_ledger 테이블에 대해 구현한다. + * 온라인/배치 프로그램은 이 함수들만 호출한다 (self-contained). + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "py_core.h" + +EXEC SQL INCLUDE sqlca; + +int py_dbio_connect(const char *target) +{ + EXEC SQL BEGIN DECLARE SECTION; + const char *h_target; + EXEC SQL END DECLARE SECTION; + + h_target = (target && target[0]) ? target : "acquire@localhost"; + + EXEC SQL CONNECT TO :h_target; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py CONNECT"); + return TX_EDB; + } + tx_log(TX_LOG_INFO, "[py] DB 접속 완료 target=%s", h_target); + return TX_OK; +} + +int py_dbio_disconnect(void) +{ + EXEC SQL DISCONNECT CURRENT; + return TX_OK; +} + +int py_rec_insert(const py_rec_t *rec) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + char h_merch_id[16]; + char h_card_no[20]; + long h_amount; + char h_biz_date[9]; + char h_status[2]; + long h_fee; + EXEC SQL END DECLARE SECTION; + + if (!rec) + return TX_EINVAL; + + strncpy(h_key, rec->key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + strncpy(h_merch_id, rec->merch_id, sizeof(h_merch_id) - 1); + h_merch_id[sizeof(h_merch_id) - 1] = '\0'; + strncpy(h_card_no, rec->card_no, sizeof(h_card_no) - 1); + h_card_no[sizeof(h_card_no) - 1] = '\0'; + strncpy(h_biz_date, rec->biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + strncpy(h_status, rec->status, sizeof(h_status) - 1); + h_status[sizeof(h_status) - 1] = '\0'; + h_amount = rec->amount; + h_fee = rec->fee; + + EXEC SQL INSERT INTO py_ledger + (key, merch_id, card_no, amount, biz_date, status, fee) + VALUES + (:h_key, :h_merch_id, :h_card_no, :h_amount, :h_biz_date, :h_status, :h_fee); + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_rec_insert"); + return TX_EDB; + } + return TX_OK; +} + +int py_rec_select(const char *key, py_rec_t *out) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + char h_merch_id[16]; + char h_card_no[20]; + long h_amount; + char h_biz_date[9]; + char h_status[2]; + long h_fee; + EXEC SQL END DECLARE SECTION; + + if (!key || !out) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT merch_id, card_no, amount, biz_date, status, fee + INTO :h_merch_id, :h_card_no, :h_amount, :h_biz_date, :h_status, :h_fee + FROM py_ledger + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_rec_select"); + return TX_EDB; + } + + memset(out, 0, sizeof(*out)); + strncpy(out->key, h_key, sizeof(out->key) - 1); + strncpy(out->merch_id, h_merch_id, sizeof(out->merch_id) - 1); + strncpy(out->card_no, h_card_no, sizeof(out->card_no) - 1); + strncpy(out->biz_date, h_biz_date, sizeof(out->biz_date) - 1); + strncpy(out->status, h_status, sizeof(out->status) - 1); + out->amount = h_amount; + out->fee = h_fee; + return TX_OK; +} + +int py_rec_update_status(const char *key, const char *status) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + char h_status[2]; + EXEC SQL END DECLARE SECTION; + + if (!key || !status) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + strncpy(h_status, status, sizeof(h_status) - 1); + h_status[sizeof(h_status) - 1] = '\0'; + + EXEC SQL UPDATE py_ledger + SET status = :h_status, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_rec_update_status"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long py_rec_count(const char *biz_date, const char *status) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_status[2]; + int h_cnt; + EXEC SQL END DECLARE SECTION; + + if (!biz_date || !status) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + strncpy(h_status, status, sizeof(h_status) - 1); + h_status[sizeof(h_status) - 1] = '\0'; + + EXEC SQL SELECT count(*) + INTO :h_cnt + FROM py_ledger + WHERE biz_date = :h_biz_date + AND status = :h_status; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_rec_count"); + return -1; + } + return (long)h_cnt; +} + +int py_rec_sum(const char *biz_date, long *out_sum) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date || !out_sum) + return TX_EINVAL; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM py_ledger + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_rec_sum"); + return TX_EDB; + } + *out_sum = h_sum; + return TX_OK; +} diff --git a/app/dbio/py_io_0001.c b/app/dbio/py_io_0001.c new file mode 100644 index 0000000..2e00166 --- /dev/null +++ b/app/dbio/py_io_0001.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/py_io_0001.pgc" +/* @tier easy @module py @transform payment-dbio */ +/* + * py_io_0001.pgc - 지급 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "py_io_0001.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/py_io_0001.pgc" + + +int py_io_0001_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/py_io_0001.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/py_io_0001.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/py_io_0001.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from py_io_0001_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/py_io_0001.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0001_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int py_io_0001_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/py_io_0001.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/py_io_0001.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/py_io_0001.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update py_io_0001_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/py_io_0001.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0001_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long py_io_0001_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/py_io_0001.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/py_io_0001.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/py_io_0001.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from py_io_0001_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/py_io_0001.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0001_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/py_io_0001.pgc b/app/dbio/py_io_0001.pgc new file mode 100644 index 0000000..a47c3b3 --- /dev/null +++ b/app/dbio/py_io_0001.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module py @transform payment-dbio */ +/* + * py_io_0001.pgc - 지급 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "py_io_0001.h" + +EXEC SQL INCLUDE sqlca; + +int py_io_0001_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM py_io_0001_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0001_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int py_io_0001_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE py_io_0001_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0001_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long py_io_0001_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM py_io_0001_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0001_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/py_io_0002.c b/app/dbio/py_io_0002.c new file mode 100644 index 0000000..fcd1cf1 --- /dev/null +++ b/app/dbio/py_io_0002.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/py_io_0002.pgc" +/* @tier hard @module py @transform payment-dbio */ +/* + * py_io_0002.pgc - 지급 보조 DBIO (ECPG) [tier=hard] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "py_io_0002.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/py_io_0002.pgc" + + +int py_io_0002_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/py_io_0002.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/py_io_0002.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/py_io_0002.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from py_io_0002_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/py_io_0002.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0002_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int py_io_0002_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/py_io_0002.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/py_io_0002.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/py_io_0002.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update py_io_0002_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/py_io_0002.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0002_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long py_io_0002_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/py_io_0002.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/py_io_0002.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/py_io_0002.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from py_io_0002_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/py_io_0002.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0002_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/py_io_0002.pgc b/app/dbio/py_io_0002.pgc new file mode 100644 index 0000000..6ae96a7 --- /dev/null +++ b/app/dbio/py_io_0002.pgc @@ -0,0 +1,92 @@ +/* @tier hard @module py @transform payment-dbio */ +/* + * py_io_0002.pgc - 지급 보조 DBIO (ECPG) [tier=hard] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "py_io_0002.h" + +EXEC SQL INCLUDE sqlca; + +int py_io_0002_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM py_io_0002_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0002_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int py_io_0002_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE py_io_0002_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0002_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long py_io_0002_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM py_io_0002_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0002_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/py_io_0003.c b/app/dbio/py_io_0003.c new file mode 100644 index 0000000..8f0431c --- /dev/null +++ b/app/dbio/py_io_0003.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/py_io_0003.pgc" +/* @tier easy @module py @transform payment-dbio */ +/* + * py_io_0003.pgc - 지급 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "py_io_0003.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/py_io_0003.pgc" + + +int py_io_0003_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/py_io_0003.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/py_io_0003.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/py_io_0003.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from py_io_0003_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/py_io_0003.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0003_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int py_io_0003_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/py_io_0003.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/py_io_0003.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/py_io_0003.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update py_io_0003_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/py_io_0003.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0003_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long py_io_0003_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/py_io_0003.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/py_io_0003.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/py_io_0003.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from py_io_0003_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/py_io_0003.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0003_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/py_io_0003.pgc b/app/dbio/py_io_0003.pgc new file mode 100644 index 0000000..9b31202 --- /dev/null +++ b/app/dbio/py_io_0003.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module py @transform payment-dbio */ +/* + * py_io_0003.pgc - 지급 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "py_io_0003.h" + +EXEC SQL INCLUDE sqlca; + +int py_io_0003_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM py_io_0003_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0003_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int py_io_0003_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE py_io_0003_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0003_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long py_io_0003_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM py_io_0003_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0003_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/py_io_0004.c b/app/dbio/py_io_0004.c new file mode 100644 index 0000000..733ef2f --- /dev/null +++ b/app/dbio/py_io_0004.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/py_io_0004.pgc" +/* @tier hard @module py @transform payment-dbio */ +/* + * py_io_0004.pgc - 지급 보조 DBIO (ECPG) [tier=hard] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "py_io_0004.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/py_io_0004.pgc" + + +int py_io_0004_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/py_io_0004.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/py_io_0004.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/py_io_0004.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from py_io_0004_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/py_io_0004.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0004_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int py_io_0004_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/py_io_0004.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/py_io_0004.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/py_io_0004.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update py_io_0004_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/py_io_0004.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0004_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long py_io_0004_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/py_io_0004.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/py_io_0004.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/py_io_0004.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from py_io_0004_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/py_io_0004.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0004_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/py_io_0004.pgc b/app/dbio/py_io_0004.pgc new file mode 100644 index 0000000..36785f1 --- /dev/null +++ b/app/dbio/py_io_0004.pgc @@ -0,0 +1,92 @@ +/* @tier hard @module py @transform payment-dbio */ +/* + * py_io_0004.pgc - 지급 보조 DBIO (ECPG) [tier=hard] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "py_io_0004.h" + +EXEC SQL INCLUDE sqlca; + +int py_io_0004_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM py_io_0004_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0004_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int py_io_0004_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE py_io_0004_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0004_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long py_io_0004_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM py_io_0004_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0004_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/py_io_0005.c b/app/dbio/py_io_0005.c new file mode 100644 index 0000000..2ff658d --- /dev/null +++ b/app/dbio/py_io_0005.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/py_io_0005.pgc" +/* @tier easy @module py @transform payment-dbio */ +/* + * py_io_0005.pgc - 지급 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "py_io_0005.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/py_io_0005.pgc" + + +int py_io_0005_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/py_io_0005.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/py_io_0005.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/py_io_0005.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from py_io_0005_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/py_io_0005.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0005_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int py_io_0005_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/py_io_0005.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/py_io_0005.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/py_io_0005.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update py_io_0005_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/py_io_0005.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0005_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long py_io_0005_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/py_io_0005.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/py_io_0005.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/py_io_0005.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from py_io_0005_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/py_io_0005.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0005_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/py_io_0005.pgc b/app/dbio/py_io_0005.pgc new file mode 100644 index 0000000..51a77ad --- /dev/null +++ b/app/dbio/py_io_0005.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module py @transform payment-dbio */ +/* + * py_io_0005.pgc - 지급 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "py_io_0005.h" + +EXEC SQL INCLUDE sqlca; + +int py_io_0005_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM py_io_0005_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0005_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int py_io_0005_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE py_io_0005_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0005_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long py_io_0005_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM py_io_0005_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0005_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/py_io_0006.c b/app/dbio/py_io_0006.c new file mode 100644 index 0000000..c74d5c2 --- /dev/null +++ b/app/dbio/py_io_0006.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/py_io_0006.pgc" +/* @tier easy @module py @transform payment-dbio */ +/* + * py_io_0006.pgc - 지급 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "py_io_0006.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/py_io_0006.pgc" + + +int py_io_0006_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/py_io_0006.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/py_io_0006.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/py_io_0006.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from py_io_0006_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/py_io_0006.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0006_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int py_io_0006_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/py_io_0006.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/py_io_0006.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/py_io_0006.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update py_io_0006_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/py_io_0006.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0006_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long py_io_0006_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/py_io_0006.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/py_io_0006.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/py_io_0006.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from py_io_0006_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/py_io_0006.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0006_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/py_io_0006.pgc b/app/dbio/py_io_0006.pgc new file mode 100644 index 0000000..caf96a3 --- /dev/null +++ b/app/dbio/py_io_0006.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module py @transform payment-dbio */ +/* + * py_io_0006.pgc - 지급 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "py_io_0006.h" + +EXEC SQL INCLUDE sqlca; + +int py_io_0006_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM py_io_0006_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0006_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int py_io_0006_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE py_io_0006_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0006_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long py_io_0006_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM py_io_0006_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0006_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/py_io_0007.c b/app/dbio/py_io_0007.c new file mode 100644 index 0000000..a3447b3 --- /dev/null +++ b/app/dbio/py_io_0007.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/py_io_0007.pgc" +/* @tier medium @module py @transform payment-dbio */ +/* + * py_io_0007.pgc - 지급 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "py_io_0007.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/py_io_0007.pgc" + + +int py_io_0007_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/py_io_0007.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/py_io_0007.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/py_io_0007.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from py_io_0007_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/py_io_0007.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0007_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int py_io_0007_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/py_io_0007.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/py_io_0007.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/py_io_0007.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update py_io_0007_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/py_io_0007.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0007_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long py_io_0007_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/py_io_0007.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/py_io_0007.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/py_io_0007.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from py_io_0007_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/py_io_0007.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0007_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/py_io_0007.pgc b/app/dbio/py_io_0007.pgc new file mode 100644 index 0000000..6079505 --- /dev/null +++ b/app/dbio/py_io_0007.pgc @@ -0,0 +1,92 @@ +/* @tier medium @module py @transform payment-dbio */ +/* + * py_io_0007.pgc - 지급 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "py_io_0007.h" + +EXEC SQL INCLUDE sqlca; + +int py_io_0007_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM py_io_0007_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0007_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int py_io_0007_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE py_io_0007_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0007_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long py_io_0007_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM py_io_0007_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0007_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/py_io_0008.c b/app/dbio/py_io_0008.c new file mode 100644 index 0000000..e9e303a --- /dev/null +++ b/app/dbio/py_io_0008.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/py_io_0008.pgc" +/* @tier easy @module py @transform payment-dbio */ +/* + * py_io_0008.pgc - 지급 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "py_io_0008.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/py_io_0008.pgc" + + +int py_io_0008_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/py_io_0008.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/py_io_0008.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/py_io_0008.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from py_io_0008_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/py_io_0008.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0008_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int py_io_0008_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/py_io_0008.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/py_io_0008.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/py_io_0008.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update py_io_0008_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/py_io_0008.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0008_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long py_io_0008_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/py_io_0008.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/py_io_0008.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/py_io_0008.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from py_io_0008_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/py_io_0008.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0008_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/py_io_0008.pgc b/app/dbio/py_io_0008.pgc new file mode 100644 index 0000000..11c5145 --- /dev/null +++ b/app/dbio/py_io_0008.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module py @transform payment-dbio */ +/* + * py_io_0008.pgc - 지급 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "py_io_0008.h" + +EXEC SQL INCLUDE sqlca; + +int py_io_0008_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM py_io_0008_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0008_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int py_io_0008_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE py_io_0008_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0008_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long py_io_0008_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM py_io_0008_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0008_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/py_io_0009.c b/app/dbio/py_io_0009.c new file mode 100644 index 0000000..f44f207 --- /dev/null +++ b/app/dbio/py_io_0009.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/py_io_0009.pgc" +/* @tier medium @module py @transform payment-dbio */ +/* + * py_io_0009.pgc - 지급 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "py_io_0009.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/py_io_0009.pgc" + + +int py_io_0009_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/py_io_0009.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/py_io_0009.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/py_io_0009.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from py_io_0009_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/py_io_0009.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0009_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int py_io_0009_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/py_io_0009.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/py_io_0009.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/py_io_0009.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update py_io_0009_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/py_io_0009.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0009_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long py_io_0009_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/py_io_0009.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/py_io_0009.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/py_io_0009.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from py_io_0009_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/py_io_0009.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0009_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/py_io_0009.pgc b/app/dbio/py_io_0009.pgc new file mode 100644 index 0000000..4df00d5 --- /dev/null +++ b/app/dbio/py_io_0009.pgc @@ -0,0 +1,92 @@ +/* @tier medium @module py @transform payment-dbio */ +/* + * py_io_0009.pgc - 지급 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "py_io_0009.h" + +EXEC SQL INCLUDE sqlca; + +int py_io_0009_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM py_io_0009_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0009_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int py_io_0009_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE py_io_0009_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0009_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long py_io_0009_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM py_io_0009_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0009_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/py_io_0010.c b/app/dbio/py_io_0010.c new file mode 100644 index 0000000..378741b --- /dev/null +++ b/app/dbio/py_io_0010.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/py_io_0010.pgc" +/* @tier easy @module py @transform payment-dbio */ +/* + * py_io_0010.pgc - 지급 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "py_io_0010.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/py_io_0010.pgc" + + +int py_io_0010_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/py_io_0010.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/py_io_0010.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/py_io_0010.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from py_io_0010_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/py_io_0010.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0010_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int py_io_0010_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/py_io_0010.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/py_io_0010.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/py_io_0010.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update py_io_0010_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/py_io_0010.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0010_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long py_io_0010_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/py_io_0010.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/py_io_0010.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/py_io_0010.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from py_io_0010_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/py_io_0010.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0010_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/py_io_0010.pgc b/app/dbio/py_io_0010.pgc new file mode 100644 index 0000000..cce2daa --- /dev/null +++ b/app/dbio/py_io_0010.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module py @transform payment-dbio */ +/* + * py_io_0010.pgc - 지급 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "py_io_0010.h" + +EXEC SQL INCLUDE sqlca; + +int py_io_0010_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM py_io_0010_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0010_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int py_io_0010_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE py_io_0010_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0010_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long py_io_0010_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM py_io_0010_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0010_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/py_io_0011.c b/app/dbio/py_io_0011.c new file mode 100644 index 0000000..c7fe52d --- /dev/null +++ b/app/dbio/py_io_0011.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/py_io_0011.pgc" +/* @tier medium @module py @transform payment-dbio */ +/* + * py_io_0011.pgc - 지급 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "py_io_0011.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/py_io_0011.pgc" + + +int py_io_0011_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/py_io_0011.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/py_io_0011.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/py_io_0011.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from py_io_0011_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/py_io_0011.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0011_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int py_io_0011_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/py_io_0011.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/py_io_0011.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/py_io_0011.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update py_io_0011_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/py_io_0011.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0011_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long py_io_0011_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/py_io_0011.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/py_io_0011.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/py_io_0011.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from py_io_0011_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/py_io_0011.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0011_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/py_io_0011.pgc b/app/dbio/py_io_0011.pgc new file mode 100644 index 0000000..b27474d --- /dev/null +++ b/app/dbio/py_io_0011.pgc @@ -0,0 +1,92 @@ +/* @tier medium @module py @transform payment-dbio */ +/* + * py_io_0011.pgc - 지급 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "py_io_0011.h" + +EXEC SQL INCLUDE sqlca; + +int py_io_0011_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM py_io_0011_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0011_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int py_io_0011_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE py_io_0011_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0011_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long py_io_0011_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM py_io_0011_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0011_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/py_io_0012.c b/app/dbio/py_io_0012.c new file mode 100644 index 0000000..92e0852 --- /dev/null +++ b/app/dbio/py_io_0012.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/py_io_0012.pgc" +/* @tier easy @module py @transform payment-dbio */ +/* + * py_io_0012.pgc - 지급 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "py_io_0012.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/py_io_0012.pgc" + + +int py_io_0012_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/py_io_0012.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/py_io_0012.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/py_io_0012.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from py_io_0012_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/py_io_0012.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0012_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int py_io_0012_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/py_io_0012.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/py_io_0012.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/py_io_0012.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update py_io_0012_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/py_io_0012.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0012_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long py_io_0012_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/py_io_0012.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/py_io_0012.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/py_io_0012.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from py_io_0012_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/py_io_0012.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0012_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/py_io_0012.pgc b/app/dbio/py_io_0012.pgc new file mode 100644 index 0000000..ffe919e --- /dev/null +++ b/app/dbio/py_io_0012.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module py @transform payment-dbio */ +/* + * py_io_0012.pgc - 지급 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "py_io_0012.h" + +EXEC SQL INCLUDE sqlca; + +int py_io_0012_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM py_io_0012_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0012_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int py_io_0012_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE py_io_0012_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0012_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long py_io_0012_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM py_io_0012_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0012_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/py_io_0013.c b/app/dbio/py_io_0013.c new file mode 100644 index 0000000..23947e0 --- /dev/null +++ b/app/dbio/py_io_0013.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/py_io_0013.pgc" +/* @tier hard @module py @transform payment-dbio */ +/* + * py_io_0013.pgc - 지급 보조 DBIO (ECPG) [tier=hard] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "py_io_0013.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/py_io_0013.pgc" + + +int py_io_0013_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/py_io_0013.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/py_io_0013.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/py_io_0013.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from py_io_0013_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/py_io_0013.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0013_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int py_io_0013_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/py_io_0013.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/py_io_0013.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/py_io_0013.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update py_io_0013_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/py_io_0013.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0013_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long py_io_0013_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/py_io_0013.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/py_io_0013.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/py_io_0013.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from py_io_0013_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/py_io_0013.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0013_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/py_io_0013.pgc b/app/dbio/py_io_0013.pgc new file mode 100644 index 0000000..003ce3a --- /dev/null +++ b/app/dbio/py_io_0013.pgc @@ -0,0 +1,92 @@ +/* @tier hard @module py @transform payment-dbio */ +/* + * py_io_0013.pgc - 지급 보조 DBIO (ECPG) [tier=hard] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "py_io_0013.h" + +EXEC SQL INCLUDE sqlca; + +int py_io_0013_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM py_io_0013_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0013_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int py_io_0013_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE py_io_0013_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0013_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long py_io_0013_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM py_io_0013_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0013_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/py_io_0014.c b/app/dbio/py_io_0014.c new file mode 100644 index 0000000..757df15 --- /dev/null +++ b/app/dbio/py_io_0014.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/py_io_0014.pgc" +/* @tier easy @module py @transform payment-dbio */ +/* + * py_io_0014.pgc - 지급 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "py_io_0014.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/py_io_0014.pgc" + + +int py_io_0014_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/py_io_0014.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/py_io_0014.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/py_io_0014.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from py_io_0014_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/py_io_0014.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0014_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int py_io_0014_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/py_io_0014.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/py_io_0014.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/py_io_0014.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update py_io_0014_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/py_io_0014.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0014_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long py_io_0014_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/py_io_0014.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/py_io_0014.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/py_io_0014.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from py_io_0014_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/py_io_0014.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0014_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/py_io_0014.pgc b/app/dbio/py_io_0014.pgc new file mode 100644 index 0000000..6d1dc20 --- /dev/null +++ b/app/dbio/py_io_0014.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module py @transform payment-dbio */ +/* + * py_io_0014.pgc - 지급 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "py_io_0014.h" + +EXEC SQL INCLUDE sqlca; + +int py_io_0014_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM py_io_0014_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0014_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int py_io_0014_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE py_io_0014_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0014_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long py_io_0014_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM py_io_0014_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0014_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/py_io_0015.c b/app/dbio/py_io_0015.c new file mode 100644 index 0000000..ec3c6ed --- /dev/null +++ b/app/dbio/py_io_0015.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/py_io_0015.pgc" +/* @tier easy @module py @transform payment-dbio */ +/* + * py_io_0015.pgc - 지급 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "py_io_0015.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/py_io_0015.pgc" + + +int py_io_0015_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/py_io_0015.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/py_io_0015.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/py_io_0015.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from py_io_0015_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/py_io_0015.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0015_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int py_io_0015_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/py_io_0015.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/py_io_0015.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/py_io_0015.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update py_io_0015_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/py_io_0015.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0015_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long py_io_0015_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/py_io_0015.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/py_io_0015.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/py_io_0015.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from py_io_0015_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/py_io_0015.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0015_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/py_io_0015.pgc b/app/dbio/py_io_0015.pgc new file mode 100644 index 0000000..6feb03e --- /dev/null +++ b/app/dbio/py_io_0015.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module py @transform payment-dbio */ +/* + * py_io_0015.pgc - 지급 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "py_io_0015.h" + +EXEC SQL INCLUDE sqlca; + +int py_io_0015_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM py_io_0015_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0015_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int py_io_0015_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE py_io_0015_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0015_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long py_io_0015_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM py_io_0015_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0015_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/py_io_0016.c b/app/dbio/py_io_0016.c new file mode 100644 index 0000000..2963905 --- /dev/null +++ b/app/dbio/py_io_0016.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/py_io_0016.pgc" +/* @tier medium @module py @transform payment-dbio */ +/* + * py_io_0016.pgc - 지급 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "py_io_0016.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/py_io_0016.pgc" + + +int py_io_0016_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/py_io_0016.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/py_io_0016.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/py_io_0016.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from py_io_0016_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/py_io_0016.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0016_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int py_io_0016_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/py_io_0016.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/py_io_0016.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/py_io_0016.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update py_io_0016_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/py_io_0016.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0016_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long py_io_0016_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/py_io_0016.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/py_io_0016.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/py_io_0016.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from py_io_0016_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/py_io_0016.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0016_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/py_io_0016.pgc b/app/dbio/py_io_0016.pgc new file mode 100644 index 0000000..e448e64 --- /dev/null +++ b/app/dbio/py_io_0016.pgc @@ -0,0 +1,92 @@ +/* @tier medium @module py @transform payment-dbio */ +/* + * py_io_0016.pgc - 지급 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "py_io_0016.h" + +EXEC SQL INCLUDE sqlca; + +int py_io_0016_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM py_io_0016_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0016_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int py_io_0016_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE py_io_0016_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0016_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long py_io_0016_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM py_io_0016_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0016_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/py_io_0017.c b/app/dbio/py_io_0017.c new file mode 100644 index 0000000..e503f14 --- /dev/null +++ b/app/dbio/py_io_0017.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/py_io_0017.pgc" +/* @tier easy @module py @transform payment-dbio */ +/* + * py_io_0017.pgc - 지급 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "py_io_0017.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/py_io_0017.pgc" + + +int py_io_0017_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/py_io_0017.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/py_io_0017.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/py_io_0017.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from py_io_0017_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/py_io_0017.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0017_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int py_io_0017_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/py_io_0017.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/py_io_0017.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/py_io_0017.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update py_io_0017_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/py_io_0017.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0017_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long py_io_0017_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/py_io_0017.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/py_io_0017.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/py_io_0017.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from py_io_0017_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/py_io_0017.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0017_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/py_io_0017.pgc b/app/dbio/py_io_0017.pgc new file mode 100644 index 0000000..93eb296 --- /dev/null +++ b/app/dbio/py_io_0017.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module py @transform payment-dbio */ +/* + * py_io_0017.pgc - 지급 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "py_io_0017.h" + +EXEC SQL INCLUDE sqlca; + +int py_io_0017_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM py_io_0017_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0017_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int py_io_0017_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE py_io_0017_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0017_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long py_io_0017_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM py_io_0017_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0017_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/py_io_0018.c b/app/dbio/py_io_0018.c new file mode 100644 index 0000000..b206ab6 --- /dev/null +++ b/app/dbio/py_io_0018.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/py_io_0018.pgc" +/* @tier medium @module py @transform payment-dbio */ +/* + * py_io_0018.pgc - 지급 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "py_io_0018.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/py_io_0018.pgc" + + +int py_io_0018_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/py_io_0018.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/py_io_0018.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/py_io_0018.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from py_io_0018_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/py_io_0018.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0018_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int py_io_0018_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/py_io_0018.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/py_io_0018.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/py_io_0018.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update py_io_0018_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/py_io_0018.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0018_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long py_io_0018_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/py_io_0018.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/py_io_0018.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/py_io_0018.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from py_io_0018_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/py_io_0018.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0018_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/py_io_0018.pgc b/app/dbio/py_io_0018.pgc new file mode 100644 index 0000000..a059cf6 --- /dev/null +++ b/app/dbio/py_io_0018.pgc @@ -0,0 +1,92 @@ +/* @tier medium @module py @transform payment-dbio */ +/* + * py_io_0018.pgc - 지급 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "py_io_0018.h" + +EXEC SQL INCLUDE sqlca; + +int py_io_0018_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM py_io_0018_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0018_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int py_io_0018_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE py_io_0018_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0018_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long py_io_0018_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM py_io_0018_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0018_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/py_io_0019.c b/app/dbio/py_io_0019.c new file mode 100644 index 0000000..6f4cac6 --- /dev/null +++ b/app/dbio/py_io_0019.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/py_io_0019.pgc" +/* @tier easy @module py @transform payment-dbio */ +/* + * py_io_0019.pgc - 지급 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "py_io_0019.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/py_io_0019.pgc" + + +int py_io_0019_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/py_io_0019.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/py_io_0019.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/py_io_0019.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from py_io_0019_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/py_io_0019.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0019_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int py_io_0019_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/py_io_0019.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/py_io_0019.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/py_io_0019.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update py_io_0019_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/py_io_0019.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0019_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long py_io_0019_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/py_io_0019.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/py_io_0019.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/py_io_0019.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from py_io_0019_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/py_io_0019.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0019_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/py_io_0019.pgc b/app/dbio/py_io_0019.pgc new file mode 100644 index 0000000..f5f495c --- /dev/null +++ b/app/dbio/py_io_0019.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module py @transform payment-dbio */ +/* + * py_io_0019.pgc - 지급 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "py_io_0019.h" + +EXEC SQL INCLUDE sqlca; + +int py_io_0019_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM py_io_0019_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0019_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int py_io_0019_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE py_io_0019_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0019_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long py_io_0019_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM py_io_0019_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0019_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/py_io_0020.c b/app/dbio/py_io_0020.c new file mode 100644 index 0000000..c847aac --- /dev/null +++ b/app/dbio/py_io_0020.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/py_io_0020.pgc" +/* @tier medium @module py @transform payment-dbio */ +/* + * py_io_0020.pgc - 지급 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "py_io_0020.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/py_io_0020.pgc" + + +int py_io_0020_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/py_io_0020.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/py_io_0020.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/py_io_0020.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from py_io_0020_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/py_io_0020.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0020_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int py_io_0020_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/py_io_0020.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/py_io_0020.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/py_io_0020.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update py_io_0020_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/py_io_0020.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0020_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long py_io_0020_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/py_io_0020.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/py_io_0020.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/py_io_0020.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from py_io_0020_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/py_io_0020.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0020_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/py_io_0020.pgc b/app/dbio/py_io_0020.pgc new file mode 100644 index 0000000..13d0bb7 --- /dev/null +++ b/app/dbio/py_io_0020.pgc @@ -0,0 +1,92 @@ +/* @tier medium @module py @transform payment-dbio */ +/* + * py_io_0020.pgc - 지급 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "py_io_0020.h" + +EXEC SQL INCLUDE sqlca; + +int py_io_0020_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM py_io_0020_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0020_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int py_io_0020_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE py_io_0020_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0020_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long py_io_0020_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM py_io_0020_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0020_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/py_io_0021.c b/app/dbio/py_io_0021.c new file mode 100644 index 0000000..6755ea3 --- /dev/null +++ b/app/dbio/py_io_0021.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/py_io_0021.pgc" +/* @tier easy @module py @transform payment-dbio */ +/* + * py_io_0021.pgc - 지급 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "py_io_0021.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/py_io_0021.pgc" + + +int py_io_0021_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/py_io_0021.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/py_io_0021.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/py_io_0021.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from py_io_0021_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/py_io_0021.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0021_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int py_io_0021_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/py_io_0021.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/py_io_0021.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/py_io_0021.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update py_io_0021_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/py_io_0021.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0021_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long py_io_0021_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/py_io_0021.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/py_io_0021.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/py_io_0021.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from py_io_0021_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/py_io_0021.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0021_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/py_io_0021.pgc b/app/dbio/py_io_0021.pgc new file mode 100644 index 0000000..e4b292c --- /dev/null +++ b/app/dbio/py_io_0021.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module py @transform payment-dbio */ +/* + * py_io_0021.pgc - 지급 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "py_io_0021.h" + +EXEC SQL INCLUDE sqlca; + +int py_io_0021_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM py_io_0021_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0021_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int py_io_0021_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE py_io_0021_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0021_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long py_io_0021_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM py_io_0021_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0021_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/py_io_0022.c b/app/dbio/py_io_0022.c new file mode 100644 index 0000000..94436db --- /dev/null +++ b/app/dbio/py_io_0022.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/py_io_0022.pgc" +/* @tier hard @module py @transform payment-dbio */ +/* + * py_io_0022.pgc - 지급 보조 DBIO (ECPG) [tier=hard] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "py_io_0022.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/py_io_0022.pgc" + + +int py_io_0022_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/py_io_0022.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/py_io_0022.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/py_io_0022.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from py_io_0022_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/py_io_0022.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0022_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int py_io_0022_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/py_io_0022.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/py_io_0022.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/py_io_0022.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update py_io_0022_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/py_io_0022.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0022_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long py_io_0022_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/py_io_0022.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/py_io_0022.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/py_io_0022.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from py_io_0022_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/py_io_0022.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0022_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/py_io_0022.pgc b/app/dbio/py_io_0022.pgc new file mode 100644 index 0000000..2d72f31 --- /dev/null +++ b/app/dbio/py_io_0022.pgc @@ -0,0 +1,92 @@ +/* @tier hard @module py @transform payment-dbio */ +/* + * py_io_0022.pgc - 지급 보조 DBIO (ECPG) [tier=hard] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "py_io_0022.h" + +EXEC SQL INCLUDE sqlca; + +int py_io_0022_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM py_io_0022_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0022_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int py_io_0022_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE py_io_0022_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0022_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long py_io_0022_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM py_io_0022_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0022_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/py_io_0023.c b/app/dbio/py_io_0023.c new file mode 100644 index 0000000..51c54cf --- /dev/null +++ b/app/dbio/py_io_0023.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/py_io_0023.pgc" +/* @tier easy @module py @transform payment-dbio */ +/* + * py_io_0023.pgc - 지급 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "py_io_0023.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/py_io_0023.pgc" + + +int py_io_0023_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/py_io_0023.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/py_io_0023.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/py_io_0023.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from py_io_0023_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/py_io_0023.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0023_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int py_io_0023_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/py_io_0023.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/py_io_0023.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/py_io_0023.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update py_io_0023_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/py_io_0023.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0023_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long py_io_0023_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/py_io_0023.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/py_io_0023.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/py_io_0023.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from py_io_0023_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/py_io_0023.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0023_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/py_io_0023.pgc b/app/dbio/py_io_0023.pgc new file mode 100644 index 0000000..08e7c63 --- /dev/null +++ b/app/dbio/py_io_0023.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module py @transform payment-dbio */ +/* + * py_io_0023.pgc - 지급 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "py_io_0023.h" + +EXEC SQL INCLUDE sqlca; + +int py_io_0023_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM py_io_0023_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0023_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int py_io_0023_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE py_io_0023_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0023_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long py_io_0023_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM py_io_0023_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0023_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/py_io_0024.c b/app/dbio/py_io_0024.c new file mode 100644 index 0000000..379ccd3 --- /dev/null +++ b/app/dbio/py_io_0024.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/py_io_0024.pgc" +/* @tier hard @module py @transform payment-dbio */ +/* + * py_io_0024.pgc - 지급 보조 DBIO (ECPG) [tier=hard] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "py_io_0024.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/py_io_0024.pgc" + + +int py_io_0024_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/py_io_0024.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/py_io_0024.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/py_io_0024.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from py_io_0024_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/py_io_0024.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0024_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int py_io_0024_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/py_io_0024.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/py_io_0024.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/py_io_0024.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update py_io_0024_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/py_io_0024.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0024_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long py_io_0024_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/py_io_0024.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/py_io_0024.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/py_io_0024.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from py_io_0024_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/py_io_0024.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0024_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/py_io_0024.pgc b/app/dbio/py_io_0024.pgc new file mode 100644 index 0000000..d73a1f0 --- /dev/null +++ b/app/dbio/py_io_0024.pgc @@ -0,0 +1,92 @@ +/* @tier hard @module py @transform payment-dbio */ +/* + * py_io_0024.pgc - 지급 보조 DBIO (ECPG) [tier=hard] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "py_io_0024.h" + +EXEC SQL INCLUDE sqlca; + +int py_io_0024_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM py_io_0024_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0024_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int py_io_0024_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE py_io_0024_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0024_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long py_io_0024_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM py_io_0024_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0024_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/py_io_0025.c b/app/dbio/py_io_0025.c new file mode 100644 index 0000000..b8e8f88 --- /dev/null +++ b/app/dbio/py_io_0025.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/py_io_0025.pgc" +/* @tier easy @module py @transform payment-dbio */ +/* + * py_io_0025.pgc - 지급 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "py_io_0025.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/py_io_0025.pgc" + + +int py_io_0025_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/py_io_0025.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/py_io_0025.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/py_io_0025.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from py_io_0025_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/py_io_0025.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0025_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int py_io_0025_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/py_io_0025.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/py_io_0025.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/py_io_0025.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update py_io_0025_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/py_io_0025.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0025_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long py_io_0025_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/py_io_0025.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/py_io_0025.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/py_io_0025.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from py_io_0025_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/py_io_0025.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0025_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/py_io_0025.pgc b/app/dbio/py_io_0025.pgc new file mode 100644 index 0000000..81c7bcc --- /dev/null +++ b/app/dbio/py_io_0025.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module py @transform payment-dbio */ +/* + * py_io_0025.pgc - 지급 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "py_io_0025.h" + +EXEC SQL INCLUDE sqlca; + +int py_io_0025_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM py_io_0025_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0025_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int py_io_0025_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE py_io_0025_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0025_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long py_io_0025_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM py_io_0025_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0025_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/py_io_0026.c b/app/dbio/py_io_0026.c new file mode 100644 index 0000000..9771319 --- /dev/null +++ b/app/dbio/py_io_0026.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/py_io_0026.pgc" +/* @tier easy @module py @transform payment-dbio */ +/* + * py_io_0026.pgc - 지급 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "py_io_0026.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/py_io_0026.pgc" + + +int py_io_0026_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/py_io_0026.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/py_io_0026.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/py_io_0026.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from py_io_0026_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/py_io_0026.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0026_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int py_io_0026_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/py_io_0026.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/py_io_0026.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/py_io_0026.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update py_io_0026_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/py_io_0026.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0026_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long py_io_0026_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/py_io_0026.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/py_io_0026.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/py_io_0026.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from py_io_0026_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/py_io_0026.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0026_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/py_io_0026.pgc b/app/dbio/py_io_0026.pgc new file mode 100644 index 0000000..ffcfa7c --- /dev/null +++ b/app/dbio/py_io_0026.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module py @transform payment-dbio */ +/* + * py_io_0026.pgc - 지급 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "py_io_0026.h" + +EXEC SQL INCLUDE sqlca; + +int py_io_0026_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM py_io_0026_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0026_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int py_io_0026_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE py_io_0026_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0026_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long py_io_0026_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM py_io_0026_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("py_io_0026_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/rc_dbio_main.c b/app/dbio/rc_dbio_main.c new file mode 100644 index 0000000..ea15f33 --- /dev/null +++ b/app/dbio/rc_dbio_main.c @@ -0,0 +1,399 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/rc_dbio_main.pgc" +/* @tier medium @module rc @transform reconciliation-dbio */ +/* + * rc_dbio_main.pgc - 대사 표준 DBIO (ECPG 임베디드 SQL) + * + * rc_core.h 의 표준 API 를 rc_ledger 테이블에 대해 구현한다. + * 온라인/배치 프로그램은 이 함수들만 호출한다 (self-contained). + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "rc_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/dbio/rc_dbio_main.pgc" + + +int rc_dbio_connect(const char *target) +{ + /* exec sql begin declare section */ + + +#line 20 "app/dbio/rc_dbio_main.pgc" + const char * h_target ; +/* exec sql end declare section */ +#line 21 "app/dbio/rc_dbio_main.pgc" + + + h_target = (target && target[0]) ? target : "acquire@localhost"; + + { ECPGconnect(__LINE__, 0, h_target , NULL, NULL , NULL, 0); } +#line 25 "app/dbio/rc_dbio_main.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc CONNECT"); + return TX_EDB; + } + tx_log(TX_LOG_INFO, "[rc] DB 접속 완료 target=%s", h_target); + return TX_OK; +} + +int rc_dbio_disconnect(void) +{ + { ECPGdisconnect(__LINE__, "CURRENT");} +#line 36 "app/dbio/rc_dbio_main.pgc" + + return TX_OK; +} + +int rc_rec_insert(const rc_rec_t *rec) +{ + /* exec sql begin declare section */ + + + + + + + + +#line 43 "app/dbio/rc_dbio_main.pgc" + char h_key [ 16 ] ; + +#line 44 "app/dbio/rc_dbio_main.pgc" + char h_merch_id [ 16 ] ; + +#line 45 "app/dbio/rc_dbio_main.pgc" + char h_card_no [ 20 ] ; + +#line 46 "app/dbio/rc_dbio_main.pgc" + long h_amount ; + +#line 47 "app/dbio/rc_dbio_main.pgc" + char h_biz_date [ 9 ] ; + +#line 48 "app/dbio/rc_dbio_main.pgc" + char h_status [ 2 ] ; + +#line 49 "app/dbio/rc_dbio_main.pgc" + long h_fee ; +/* exec sql end declare section */ +#line 50 "app/dbio/rc_dbio_main.pgc" + + + if (!rec) + return TX_EINVAL; + + strncpy(h_key, rec->key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + strncpy(h_merch_id, rec->merch_id, sizeof(h_merch_id) - 1); + h_merch_id[sizeof(h_merch_id) - 1] = '\0'; + strncpy(h_card_no, rec->card_no, sizeof(h_card_no) - 1); + h_card_no[sizeof(h_card_no) - 1] = '\0'; + strncpy(h_biz_date, rec->biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + strncpy(h_status, rec->status, sizeof(h_status) - 1); + h_status[sizeof(h_status) - 1] = '\0'; + h_amount = rec->amount; + h_fee = rec->fee; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into rc_ledger ( key , merch_id , card_no , amount , biz_date , status , fee ) values ( $1 , $2 , $3 , $4 , $5 , $6 , $7 )", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_card_no),(long)20,(long)1,(20)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_status),(long)2,(long)1,(2)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_fee),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 71 "app/dbio/rc_dbio_main.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_rec_insert"); + return TX_EDB; + } + return TX_OK; +} + +int rc_rec_select(const char *key, rc_rec_t *out) +{ + /* exec sql begin declare section */ + + + + + + + + +#line 83 "app/dbio/rc_dbio_main.pgc" + char h_key [ 16 ] ; + +#line 84 "app/dbio/rc_dbio_main.pgc" + char h_merch_id [ 16 ] ; + +#line 85 "app/dbio/rc_dbio_main.pgc" + char h_card_no [ 20 ] ; + +#line 86 "app/dbio/rc_dbio_main.pgc" + long h_amount ; + +#line 87 "app/dbio/rc_dbio_main.pgc" + char h_biz_date [ 9 ] ; + +#line 88 "app/dbio/rc_dbio_main.pgc" + char h_status [ 2 ] ; + +#line 89 "app/dbio/rc_dbio_main.pgc" + long h_fee ; +/* exec sql end declare section */ +#line 90 "app/dbio/rc_dbio_main.pgc" + + + if (!key || !out) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select merch_id , card_no , amount , biz_date , status , fee from rc_ledger where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_card_no),(long)20,(long)1,(20)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_status),(long)2,(long)1,(2)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_fee),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 101 "app/dbio/rc_dbio_main.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_rec_select"); + return TX_EDB; + } + + memset(out, 0, sizeof(*out)); + strncpy(out->key, h_key, sizeof(out->key) - 1); + strncpy(out->merch_id, h_merch_id, sizeof(out->merch_id) - 1); + strncpy(out->card_no, h_card_no, sizeof(out->card_no) - 1); + strncpy(out->biz_date, h_biz_date, sizeof(out->biz_date) - 1); + strncpy(out->status, h_status, sizeof(out->status) - 1); + out->amount = h_amount; + out->fee = h_fee; + return TX_OK; +} + +int rc_rec_update_status(const char *key, const char *status) +{ + /* exec sql begin declare section */ + + + +#line 124 "app/dbio/rc_dbio_main.pgc" + char h_key [ 16 ] ; + +#line 125 "app/dbio/rc_dbio_main.pgc" + char h_status [ 2 ] ; +/* exec sql end declare section */ +#line 126 "app/dbio/rc_dbio_main.pgc" + + + if (!key || !status) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + strncpy(h_status, status, sizeof(h_status) - 1); + h_status[sizeof(h_status) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update rc_ledger set status = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_char,(h_status),(long)2,(long)1,(2)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 138 "app/dbio/rc_dbio_main.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_rec_update_status"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long rc_rec_count(const char *biz_date, const char *status) +{ + /* exec sql begin declare section */ + + + + +#line 152 "app/dbio/rc_dbio_main.pgc" + char h_biz_date [ 9 ] ; + +#line 153 "app/dbio/rc_dbio_main.pgc" + char h_status [ 2 ] ; + +#line 154 "app/dbio/rc_dbio_main.pgc" + int h_cnt ; +/* exec sql end declare section */ +#line 155 "app/dbio/rc_dbio_main.pgc" + + + if (!biz_date || !status) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + strncpy(h_status, status, sizeof(h_status) - 1); + h_status[sizeof(h_status) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select count ( * ) from rc_ledger where biz_date = $1 and status = $2 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_status),(long)2,(long)1,(2)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_int,&(h_cnt),(long)1,(long)1,sizeof(int), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 169 "app/dbio/rc_dbio_main.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_rec_count"); + return -1; + } + return (long)h_cnt; +} + +int rc_rec_sum(const char *biz_date, long *out_sum) +{ + /* exec sql begin declare section */ + + + +#line 181 "app/dbio/rc_dbio_main.pgc" + char h_biz_date [ 9 ] ; + +#line 182 "app/dbio/rc_dbio_main.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 183 "app/dbio/rc_dbio_main.pgc" + + + if (!biz_date || !out_sum) + return TX_EINVAL; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from rc_ledger where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 194 "app/dbio/rc_dbio_main.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_rec_sum"); + return TX_EDB; + } + *out_sum = h_sum; + return TX_OK; +} diff --git a/app/dbio/rc_dbio_main.pgc b/app/dbio/rc_dbio_main.pgc new file mode 100644 index 0000000..e311c7b --- /dev/null +++ b/app/dbio/rc_dbio_main.pgc @@ -0,0 +1,202 @@ +/* @tier medium @module rc @transform reconciliation-dbio */ +/* + * rc_dbio_main.pgc - 대사 표준 DBIO (ECPG 임베디드 SQL) + * + * rc_core.h 의 표준 API 를 rc_ledger 테이블에 대해 구현한다. + * 온라인/배치 프로그램은 이 함수들만 호출한다 (self-contained). + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "rc_core.h" + +EXEC SQL INCLUDE sqlca; + +int rc_dbio_connect(const char *target) +{ + EXEC SQL BEGIN DECLARE SECTION; + const char *h_target; + EXEC SQL END DECLARE SECTION; + + h_target = (target && target[0]) ? target : "acquire@localhost"; + + EXEC SQL CONNECT TO :h_target; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc CONNECT"); + return TX_EDB; + } + tx_log(TX_LOG_INFO, "[rc] DB 접속 완료 target=%s", h_target); + return TX_OK; +} + +int rc_dbio_disconnect(void) +{ + EXEC SQL DISCONNECT CURRENT; + return TX_OK; +} + +int rc_rec_insert(const rc_rec_t *rec) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + char h_merch_id[16]; + char h_card_no[20]; + long h_amount; + char h_biz_date[9]; + char h_status[2]; + long h_fee; + EXEC SQL END DECLARE SECTION; + + if (!rec) + return TX_EINVAL; + + strncpy(h_key, rec->key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + strncpy(h_merch_id, rec->merch_id, sizeof(h_merch_id) - 1); + h_merch_id[sizeof(h_merch_id) - 1] = '\0'; + strncpy(h_card_no, rec->card_no, sizeof(h_card_no) - 1); + h_card_no[sizeof(h_card_no) - 1] = '\0'; + strncpy(h_biz_date, rec->biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + strncpy(h_status, rec->status, sizeof(h_status) - 1); + h_status[sizeof(h_status) - 1] = '\0'; + h_amount = rec->amount; + h_fee = rec->fee; + + EXEC SQL INSERT INTO rc_ledger + (key, merch_id, card_no, amount, biz_date, status, fee) + VALUES + (:h_key, :h_merch_id, :h_card_no, :h_amount, :h_biz_date, :h_status, :h_fee); + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_rec_insert"); + return TX_EDB; + } + return TX_OK; +} + +int rc_rec_select(const char *key, rc_rec_t *out) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + char h_merch_id[16]; + char h_card_no[20]; + long h_amount; + char h_biz_date[9]; + char h_status[2]; + long h_fee; + EXEC SQL END DECLARE SECTION; + + if (!key || !out) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT merch_id, card_no, amount, biz_date, status, fee + INTO :h_merch_id, :h_card_no, :h_amount, :h_biz_date, :h_status, :h_fee + FROM rc_ledger + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_rec_select"); + return TX_EDB; + } + + memset(out, 0, sizeof(*out)); + strncpy(out->key, h_key, sizeof(out->key) - 1); + strncpy(out->merch_id, h_merch_id, sizeof(out->merch_id) - 1); + strncpy(out->card_no, h_card_no, sizeof(out->card_no) - 1); + strncpy(out->biz_date, h_biz_date, sizeof(out->biz_date) - 1); + strncpy(out->status, h_status, sizeof(out->status) - 1); + out->amount = h_amount; + out->fee = h_fee; + return TX_OK; +} + +int rc_rec_update_status(const char *key, const char *status) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + char h_status[2]; + EXEC SQL END DECLARE SECTION; + + if (!key || !status) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + strncpy(h_status, status, sizeof(h_status) - 1); + h_status[sizeof(h_status) - 1] = '\0'; + + EXEC SQL UPDATE rc_ledger + SET status = :h_status, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_rec_update_status"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long rc_rec_count(const char *biz_date, const char *status) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_status[2]; + int h_cnt; + EXEC SQL END DECLARE SECTION; + + if (!biz_date || !status) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + strncpy(h_status, status, sizeof(h_status) - 1); + h_status[sizeof(h_status) - 1] = '\0'; + + EXEC SQL SELECT count(*) + INTO :h_cnt + FROM rc_ledger + WHERE biz_date = :h_biz_date + AND status = :h_status; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_rec_count"); + return -1; + } + return (long)h_cnt; +} + +int rc_rec_sum(const char *biz_date, long *out_sum) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date || !out_sum) + return TX_EINVAL; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM rc_ledger + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_rec_sum"); + return TX_EDB; + } + *out_sum = h_sum; + return TX_OK; +} diff --git a/app/dbio/rc_io_0001.c b/app/dbio/rc_io_0001.c new file mode 100644 index 0000000..3a8fba9 --- /dev/null +++ b/app/dbio/rc_io_0001.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/rc_io_0001.pgc" +/* @tier easy @module rc @transform reconciliation-dbio */ +/* + * rc_io_0001.pgc - 대사 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "rc_io_0001.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/rc_io_0001.pgc" + + +int rc_io_0001_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/rc_io_0001.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/rc_io_0001.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/rc_io_0001.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from rc_io_0001_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/rc_io_0001.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0001_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int rc_io_0001_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/rc_io_0001.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/rc_io_0001.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/rc_io_0001.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update rc_io_0001_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/rc_io_0001.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0001_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long rc_io_0001_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/rc_io_0001.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/rc_io_0001.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/rc_io_0001.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from rc_io_0001_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/rc_io_0001.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0001_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/rc_io_0001.pgc b/app/dbio/rc_io_0001.pgc new file mode 100644 index 0000000..4483622 --- /dev/null +++ b/app/dbio/rc_io_0001.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module rc @transform reconciliation-dbio */ +/* + * rc_io_0001.pgc - 대사 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "rc_io_0001.h" + +EXEC SQL INCLUDE sqlca; + +int rc_io_0001_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM rc_io_0001_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0001_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int rc_io_0001_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE rc_io_0001_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0001_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long rc_io_0001_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM rc_io_0001_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0001_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/rc_io_0002.c b/app/dbio/rc_io_0002.c new file mode 100644 index 0000000..a099968 --- /dev/null +++ b/app/dbio/rc_io_0002.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/rc_io_0002.pgc" +/* @tier medium @module rc @transform reconciliation-dbio */ +/* + * rc_io_0002.pgc - 대사 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "rc_io_0002.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/rc_io_0002.pgc" + + +int rc_io_0002_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/rc_io_0002.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/rc_io_0002.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/rc_io_0002.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from rc_io_0002_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/rc_io_0002.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0002_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int rc_io_0002_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/rc_io_0002.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/rc_io_0002.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/rc_io_0002.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update rc_io_0002_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/rc_io_0002.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0002_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long rc_io_0002_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/rc_io_0002.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/rc_io_0002.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/rc_io_0002.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from rc_io_0002_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/rc_io_0002.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0002_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/rc_io_0002.pgc b/app/dbio/rc_io_0002.pgc new file mode 100644 index 0000000..921332c --- /dev/null +++ b/app/dbio/rc_io_0002.pgc @@ -0,0 +1,92 @@ +/* @tier medium @module rc @transform reconciliation-dbio */ +/* + * rc_io_0002.pgc - 대사 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "rc_io_0002.h" + +EXEC SQL INCLUDE sqlca; + +int rc_io_0002_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM rc_io_0002_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0002_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int rc_io_0002_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE rc_io_0002_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0002_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long rc_io_0002_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM rc_io_0002_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0002_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/rc_io_0003.c b/app/dbio/rc_io_0003.c new file mode 100644 index 0000000..8c0e18a --- /dev/null +++ b/app/dbio/rc_io_0003.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/rc_io_0003.pgc" +/* @tier easy @module rc @transform reconciliation-dbio */ +/* + * rc_io_0003.pgc - 대사 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "rc_io_0003.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/rc_io_0003.pgc" + + +int rc_io_0003_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/rc_io_0003.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/rc_io_0003.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/rc_io_0003.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from rc_io_0003_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/rc_io_0003.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0003_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int rc_io_0003_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/rc_io_0003.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/rc_io_0003.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/rc_io_0003.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update rc_io_0003_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/rc_io_0003.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0003_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long rc_io_0003_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/rc_io_0003.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/rc_io_0003.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/rc_io_0003.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from rc_io_0003_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/rc_io_0003.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0003_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/rc_io_0003.pgc b/app/dbio/rc_io_0003.pgc new file mode 100644 index 0000000..59620bc --- /dev/null +++ b/app/dbio/rc_io_0003.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module rc @transform reconciliation-dbio */ +/* + * rc_io_0003.pgc - 대사 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "rc_io_0003.h" + +EXEC SQL INCLUDE sqlca; + +int rc_io_0003_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM rc_io_0003_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0003_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int rc_io_0003_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE rc_io_0003_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0003_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long rc_io_0003_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM rc_io_0003_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0003_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/rc_io_0004.c b/app/dbio/rc_io_0004.c new file mode 100644 index 0000000..8b2a6d7 --- /dev/null +++ b/app/dbio/rc_io_0004.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/rc_io_0004.pgc" +/* @tier medium @module rc @transform reconciliation-dbio */ +/* + * rc_io_0004.pgc - 대사 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "rc_io_0004.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/rc_io_0004.pgc" + + +int rc_io_0004_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/rc_io_0004.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/rc_io_0004.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/rc_io_0004.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from rc_io_0004_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/rc_io_0004.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0004_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int rc_io_0004_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/rc_io_0004.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/rc_io_0004.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/rc_io_0004.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update rc_io_0004_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/rc_io_0004.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0004_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long rc_io_0004_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/rc_io_0004.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/rc_io_0004.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/rc_io_0004.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from rc_io_0004_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/rc_io_0004.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0004_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/rc_io_0004.pgc b/app/dbio/rc_io_0004.pgc new file mode 100644 index 0000000..561d27f --- /dev/null +++ b/app/dbio/rc_io_0004.pgc @@ -0,0 +1,92 @@ +/* @tier medium @module rc @transform reconciliation-dbio */ +/* + * rc_io_0004.pgc - 대사 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "rc_io_0004.h" + +EXEC SQL INCLUDE sqlca; + +int rc_io_0004_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM rc_io_0004_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0004_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int rc_io_0004_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE rc_io_0004_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0004_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long rc_io_0004_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM rc_io_0004_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0004_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/rc_io_0005.c b/app/dbio/rc_io_0005.c new file mode 100644 index 0000000..4f64adb --- /dev/null +++ b/app/dbio/rc_io_0005.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/rc_io_0005.pgc" +/* @tier easy @module rc @transform reconciliation-dbio */ +/* + * rc_io_0005.pgc - 대사 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "rc_io_0005.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/rc_io_0005.pgc" + + +int rc_io_0005_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/rc_io_0005.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/rc_io_0005.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/rc_io_0005.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from rc_io_0005_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/rc_io_0005.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0005_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int rc_io_0005_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/rc_io_0005.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/rc_io_0005.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/rc_io_0005.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update rc_io_0005_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/rc_io_0005.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0005_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long rc_io_0005_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/rc_io_0005.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/rc_io_0005.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/rc_io_0005.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from rc_io_0005_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/rc_io_0005.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0005_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/rc_io_0005.pgc b/app/dbio/rc_io_0005.pgc new file mode 100644 index 0000000..3b06069 --- /dev/null +++ b/app/dbio/rc_io_0005.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module rc @transform reconciliation-dbio */ +/* + * rc_io_0005.pgc - 대사 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "rc_io_0005.h" + +EXEC SQL INCLUDE sqlca; + +int rc_io_0005_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM rc_io_0005_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0005_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int rc_io_0005_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE rc_io_0005_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0005_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long rc_io_0005_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM rc_io_0005_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0005_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/rc_io_0006.c b/app/dbio/rc_io_0006.c new file mode 100644 index 0000000..4053c61 --- /dev/null +++ b/app/dbio/rc_io_0006.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/rc_io_0006.pgc" +/* @tier hard @module rc @transform reconciliation-dbio */ +/* + * rc_io_0006.pgc - 대사 보조 DBIO (ECPG) [tier=hard] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "rc_io_0006.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/rc_io_0006.pgc" + + +int rc_io_0006_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/rc_io_0006.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/rc_io_0006.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/rc_io_0006.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from rc_io_0006_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/rc_io_0006.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0006_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int rc_io_0006_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/rc_io_0006.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/rc_io_0006.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/rc_io_0006.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update rc_io_0006_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/rc_io_0006.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0006_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long rc_io_0006_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/rc_io_0006.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/rc_io_0006.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/rc_io_0006.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from rc_io_0006_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/rc_io_0006.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0006_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/rc_io_0006.pgc b/app/dbio/rc_io_0006.pgc new file mode 100644 index 0000000..42111c9 --- /dev/null +++ b/app/dbio/rc_io_0006.pgc @@ -0,0 +1,92 @@ +/* @tier hard @module rc @transform reconciliation-dbio */ +/* + * rc_io_0006.pgc - 대사 보조 DBIO (ECPG) [tier=hard] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "rc_io_0006.h" + +EXEC SQL INCLUDE sqlca; + +int rc_io_0006_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM rc_io_0006_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0006_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int rc_io_0006_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE rc_io_0006_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0006_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long rc_io_0006_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM rc_io_0006_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0006_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/rc_io_0007.c b/app/dbio/rc_io_0007.c new file mode 100644 index 0000000..4dca71d --- /dev/null +++ b/app/dbio/rc_io_0007.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/rc_io_0007.pgc" +/* @tier easy @module rc @transform reconciliation-dbio */ +/* + * rc_io_0007.pgc - 대사 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "rc_io_0007.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/rc_io_0007.pgc" + + +int rc_io_0007_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/rc_io_0007.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/rc_io_0007.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/rc_io_0007.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from rc_io_0007_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/rc_io_0007.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0007_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int rc_io_0007_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/rc_io_0007.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/rc_io_0007.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/rc_io_0007.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update rc_io_0007_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/rc_io_0007.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0007_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long rc_io_0007_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/rc_io_0007.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/rc_io_0007.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/rc_io_0007.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from rc_io_0007_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/rc_io_0007.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0007_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/rc_io_0007.pgc b/app/dbio/rc_io_0007.pgc new file mode 100644 index 0000000..c8adda4 --- /dev/null +++ b/app/dbio/rc_io_0007.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module rc @transform reconciliation-dbio */ +/* + * rc_io_0007.pgc - 대사 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "rc_io_0007.h" + +EXEC SQL INCLUDE sqlca; + +int rc_io_0007_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM rc_io_0007_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0007_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int rc_io_0007_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE rc_io_0007_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0007_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long rc_io_0007_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM rc_io_0007_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0007_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/rc_io_0008.c b/app/dbio/rc_io_0008.c new file mode 100644 index 0000000..985b2c2 --- /dev/null +++ b/app/dbio/rc_io_0008.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/rc_io_0008.pgc" +/* @tier easy @module rc @transform reconciliation-dbio */ +/* + * rc_io_0008.pgc - 대사 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "rc_io_0008.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/rc_io_0008.pgc" + + +int rc_io_0008_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/rc_io_0008.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/rc_io_0008.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/rc_io_0008.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from rc_io_0008_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/rc_io_0008.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0008_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int rc_io_0008_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/rc_io_0008.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/rc_io_0008.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/rc_io_0008.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update rc_io_0008_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/rc_io_0008.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0008_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long rc_io_0008_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/rc_io_0008.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/rc_io_0008.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/rc_io_0008.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from rc_io_0008_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/rc_io_0008.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0008_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/rc_io_0008.pgc b/app/dbio/rc_io_0008.pgc new file mode 100644 index 0000000..6c6594a --- /dev/null +++ b/app/dbio/rc_io_0008.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module rc @transform reconciliation-dbio */ +/* + * rc_io_0008.pgc - 대사 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "rc_io_0008.h" + +EXEC SQL INCLUDE sqlca; + +int rc_io_0008_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM rc_io_0008_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0008_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int rc_io_0008_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE rc_io_0008_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0008_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long rc_io_0008_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM rc_io_0008_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0008_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/rc_io_0009.c b/app/dbio/rc_io_0009.c new file mode 100644 index 0000000..5092e0d --- /dev/null +++ b/app/dbio/rc_io_0009.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/rc_io_0009.pgc" +/* @tier medium @module rc @transform reconciliation-dbio */ +/* + * rc_io_0009.pgc - 대사 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "rc_io_0009.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/rc_io_0009.pgc" + + +int rc_io_0009_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/rc_io_0009.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/rc_io_0009.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/rc_io_0009.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from rc_io_0009_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/rc_io_0009.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0009_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int rc_io_0009_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/rc_io_0009.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/rc_io_0009.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/rc_io_0009.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update rc_io_0009_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/rc_io_0009.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0009_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long rc_io_0009_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/rc_io_0009.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/rc_io_0009.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/rc_io_0009.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from rc_io_0009_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/rc_io_0009.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0009_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/rc_io_0009.pgc b/app/dbio/rc_io_0009.pgc new file mode 100644 index 0000000..e16d65f --- /dev/null +++ b/app/dbio/rc_io_0009.pgc @@ -0,0 +1,92 @@ +/* @tier medium @module rc @transform reconciliation-dbio */ +/* + * rc_io_0009.pgc - 대사 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "rc_io_0009.h" + +EXEC SQL INCLUDE sqlca; + +int rc_io_0009_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM rc_io_0009_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0009_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int rc_io_0009_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE rc_io_0009_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0009_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long rc_io_0009_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM rc_io_0009_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0009_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/rc_io_0010.c b/app/dbio/rc_io_0010.c new file mode 100644 index 0000000..c1b9ec0 --- /dev/null +++ b/app/dbio/rc_io_0010.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/rc_io_0010.pgc" +/* @tier easy @module rc @transform reconciliation-dbio */ +/* + * rc_io_0010.pgc - 대사 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "rc_io_0010.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/rc_io_0010.pgc" + + +int rc_io_0010_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/rc_io_0010.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/rc_io_0010.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/rc_io_0010.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from rc_io_0010_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/rc_io_0010.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0010_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int rc_io_0010_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/rc_io_0010.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/rc_io_0010.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/rc_io_0010.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update rc_io_0010_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/rc_io_0010.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0010_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long rc_io_0010_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/rc_io_0010.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/rc_io_0010.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/rc_io_0010.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from rc_io_0010_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/rc_io_0010.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0010_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/rc_io_0010.pgc b/app/dbio/rc_io_0010.pgc new file mode 100644 index 0000000..903c600 --- /dev/null +++ b/app/dbio/rc_io_0010.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module rc @transform reconciliation-dbio */ +/* + * rc_io_0010.pgc - 대사 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "rc_io_0010.h" + +EXEC SQL INCLUDE sqlca; + +int rc_io_0010_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM rc_io_0010_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0010_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int rc_io_0010_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE rc_io_0010_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0010_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long rc_io_0010_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM rc_io_0010_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0010_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/rc_io_0011.c b/app/dbio/rc_io_0011.c new file mode 100644 index 0000000..67006ef --- /dev/null +++ b/app/dbio/rc_io_0011.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/rc_io_0011.pgc" +/* @tier medium @module rc @transform reconciliation-dbio */ +/* + * rc_io_0011.pgc - 대사 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "rc_io_0011.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/rc_io_0011.pgc" + + +int rc_io_0011_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/rc_io_0011.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/rc_io_0011.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/rc_io_0011.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from rc_io_0011_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/rc_io_0011.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0011_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int rc_io_0011_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/rc_io_0011.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/rc_io_0011.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/rc_io_0011.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update rc_io_0011_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/rc_io_0011.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0011_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long rc_io_0011_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/rc_io_0011.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/rc_io_0011.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/rc_io_0011.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from rc_io_0011_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/rc_io_0011.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0011_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/rc_io_0011.pgc b/app/dbio/rc_io_0011.pgc new file mode 100644 index 0000000..9c86e9f --- /dev/null +++ b/app/dbio/rc_io_0011.pgc @@ -0,0 +1,92 @@ +/* @tier medium @module rc @transform reconciliation-dbio */ +/* + * rc_io_0011.pgc - 대사 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "rc_io_0011.h" + +EXEC SQL INCLUDE sqlca; + +int rc_io_0011_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM rc_io_0011_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0011_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int rc_io_0011_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE rc_io_0011_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0011_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long rc_io_0011_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM rc_io_0011_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0011_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/rc_io_0012.c b/app/dbio/rc_io_0012.c new file mode 100644 index 0000000..5331760 --- /dev/null +++ b/app/dbio/rc_io_0012.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/rc_io_0012.pgc" +/* @tier easy @module rc @transform reconciliation-dbio */ +/* + * rc_io_0012.pgc - 대사 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "rc_io_0012.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/rc_io_0012.pgc" + + +int rc_io_0012_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/rc_io_0012.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/rc_io_0012.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/rc_io_0012.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from rc_io_0012_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/rc_io_0012.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0012_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int rc_io_0012_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/rc_io_0012.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/rc_io_0012.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/rc_io_0012.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update rc_io_0012_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/rc_io_0012.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0012_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long rc_io_0012_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/rc_io_0012.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/rc_io_0012.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/rc_io_0012.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from rc_io_0012_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/rc_io_0012.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0012_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/rc_io_0012.pgc b/app/dbio/rc_io_0012.pgc new file mode 100644 index 0000000..94739f0 --- /dev/null +++ b/app/dbio/rc_io_0012.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module rc @transform reconciliation-dbio */ +/* + * rc_io_0012.pgc - 대사 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "rc_io_0012.h" + +EXEC SQL INCLUDE sqlca; + +int rc_io_0012_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM rc_io_0012_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0012_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int rc_io_0012_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE rc_io_0012_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0012_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long rc_io_0012_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM rc_io_0012_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0012_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/rc_io_0013.c b/app/dbio/rc_io_0013.c new file mode 100644 index 0000000..7f8724b --- /dev/null +++ b/app/dbio/rc_io_0013.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/rc_io_0013.pgc" +/* @tier medium @module rc @transform reconciliation-dbio */ +/* + * rc_io_0013.pgc - 대사 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "rc_io_0013.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/rc_io_0013.pgc" + + +int rc_io_0013_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/rc_io_0013.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/rc_io_0013.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/rc_io_0013.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from rc_io_0013_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/rc_io_0013.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0013_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int rc_io_0013_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/rc_io_0013.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/rc_io_0013.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/rc_io_0013.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update rc_io_0013_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/rc_io_0013.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0013_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long rc_io_0013_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/rc_io_0013.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/rc_io_0013.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/rc_io_0013.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from rc_io_0013_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/rc_io_0013.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0013_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/rc_io_0013.pgc b/app/dbio/rc_io_0013.pgc new file mode 100644 index 0000000..381b51a --- /dev/null +++ b/app/dbio/rc_io_0013.pgc @@ -0,0 +1,92 @@ +/* @tier medium @module rc @transform reconciliation-dbio */ +/* + * rc_io_0013.pgc - 대사 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "rc_io_0013.h" + +EXEC SQL INCLUDE sqlca; + +int rc_io_0013_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM rc_io_0013_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0013_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int rc_io_0013_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE rc_io_0013_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0013_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long rc_io_0013_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM rc_io_0013_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0013_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/rc_io_0014.c b/app/dbio/rc_io_0014.c new file mode 100644 index 0000000..c2918a3 --- /dev/null +++ b/app/dbio/rc_io_0014.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/rc_io_0014.pgc" +/* @tier easy @module rc @transform reconciliation-dbio */ +/* + * rc_io_0014.pgc - 대사 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "rc_io_0014.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/rc_io_0014.pgc" + + +int rc_io_0014_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/rc_io_0014.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/rc_io_0014.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/rc_io_0014.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from rc_io_0014_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/rc_io_0014.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0014_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int rc_io_0014_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/rc_io_0014.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/rc_io_0014.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/rc_io_0014.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update rc_io_0014_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/rc_io_0014.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0014_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long rc_io_0014_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/rc_io_0014.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/rc_io_0014.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/rc_io_0014.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from rc_io_0014_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/rc_io_0014.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0014_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/rc_io_0014.pgc b/app/dbio/rc_io_0014.pgc new file mode 100644 index 0000000..65dad6a --- /dev/null +++ b/app/dbio/rc_io_0014.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module rc @transform reconciliation-dbio */ +/* + * rc_io_0014.pgc - 대사 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "rc_io_0014.h" + +EXEC SQL INCLUDE sqlca; + +int rc_io_0014_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM rc_io_0014_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0014_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int rc_io_0014_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE rc_io_0014_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0014_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long rc_io_0014_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM rc_io_0014_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0014_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/rc_io_0015.c b/app/dbio/rc_io_0015.c new file mode 100644 index 0000000..2f8b213 --- /dev/null +++ b/app/dbio/rc_io_0015.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/rc_io_0015.pgc" +/* @tier hard @module rc @transform reconciliation-dbio */ +/* + * rc_io_0015.pgc - 대사 보조 DBIO (ECPG) [tier=hard] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "rc_io_0015.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/rc_io_0015.pgc" + + +int rc_io_0015_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/rc_io_0015.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/rc_io_0015.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/rc_io_0015.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from rc_io_0015_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/rc_io_0015.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0015_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int rc_io_0015_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/rc_io_0015.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/rc_io_0015.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/rc_io_0015.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update rc_io_0015_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/rc_io_0015.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0015_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long rc_io_0015_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/rc_io_0015.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/rc_io_0015.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/rc_io_0015.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from rc_io_0015_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/rc_io_0015.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0015_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/rc_io_0015.pgc b/app/dbio/rc_io_0015.pgc new file mode 100644 index 0000000..d52e71d --- /dev/null +++ b/app/dbio/rc_io_0015.pgc @@ -0,0 +1,92 @@ +/* @tier hard @module rc @transform reconciliation-dbio */ +/* + * rc_io_0015.pgc - 대사 보조 DBIO (ECPG) [tier=hard] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "rc_io_0015.h" + +EXEC SQL INCLUDE sqlca; + +int rc_io_0015_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM rc_io_0015_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0015_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int rc_io_0015_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE rc_io_0015_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0015_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long rc_io_0015_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM rc_io_0015_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0015_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/rc_io_0016.c b/app/dbio/rc_io_0016.c new file mode 100644 index 0000000..488a988 --- /dev/null +++ b/app/dbio/rc_io_0016.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/rc_io_0016.pgc" +/* @tier easy @module rc @transform reconciliation-dbio */ +/* + * rc_io_0016.pgc - 대사 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "rc_io_0016.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/rc_io_0016.pgc" + + +int rc_io_0016_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/rc_io_0016.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/rc_io_0016.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/rc_io_0016.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from rc_io_0016_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/rc_io_0016.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0016_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int rc_io_0016_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/rc_io_0016.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/rc_io_0016.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/rc_io_0016.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update rc_io_0016_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/rc_io_0016.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0016_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long rc_io_0016_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/rc_io_0016.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/rc_io_0016.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/rc_io_0016.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from rc_io_0016_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/rc_io_0016.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0016_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/rc_io_0016.pgc b/app/dbio/rc_io_0016.pgc new file mode 100644 index 0000000..2f687d4 --- /dev/null +++ b/app/dbio/rc_io_0016.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module rc @transform reconciliation-dbio */ +/* + * rc_io_0016.pgc - 대사 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "rc_io_0016.h" + +EXEC SQL INCLUDE sqlca; + +int rc_io_0016_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM rc_io_0016_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0016_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int rc_io_0016_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE rc_io_0016_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0016_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long rc_io_0016_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM rc_io_0016_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0016_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/rc_io_0017.c b/app/dbio/rc_io_0017.c new file mode 100644 index 0000000..711ef66 --- /dev/null +++ b/app/dbio/rc_io_0017.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/rc_io_0017.pgc" +/* @tier hard @module rc @transform reconciliation-dbio */ +/* + * rc_io_0017.pgc - 대사 보조 DBIO (ECPG) [tier=hard] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "rc_io_0017.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/rc_io_0017.pgc" + + +int rc_io_0017_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/rc_io_0017.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/rc_io_0017.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/rc_io_0017.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from rc_io_0017_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/rc_io_0017.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0017_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int rc_io_0017_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/rc_io_0017.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/rc_io_0017.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/rc_io_0017.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update rc_io_0017_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/rc_io_0017.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0017_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long rc_io_0017_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/rc_io_0017.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/rc_io_0017.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/rc_io_0017.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from rc_io_0017_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/rc_io_0017.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0017_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/rc_io_0017.pgc b/app/dbio/rc_io_0017.pgc new file mode 100644 index 0000000..d234a7e --- /dev/null +++ b/app/dbio/rc_io_0017.pgc @@ -0,0 +1,92 @@ +/* @tier hard @module rc @transform reconciliation-dbio */ +/* + * rc_io_0017.pgc - 대사 보조 DBIO (ECPG) [tier=hard] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "rc_io_0017.h" + +EXEC SQL INCLUDE sqlca; + +int rc_io_0017_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM rc_io_0017_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0017_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int rc_io_0017_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE rc_io_0017_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0017_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long rc_io_0017_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM rc_io_0017_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0017_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/rc_io_0018.c b/app/dbio/rc_io_0018.c new file mode 100644 index 0000000..edc5cf9 --- /dev/null +++ b/app/dbio/rc_io_0018.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/rc_io_0018.pgc" +/* @tier easy @module rc @transform reconciliation-dbio */ +/* + * rc_io_0018.pgc - 대사 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "rc_io_0018.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/rc_io_0018.pgc" + + +int rc_io_0018_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/rc_io_0018.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/rc_io_0018.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/rc_io_0018.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from rc_io_0018_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/rc_io_0018.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0018_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int rc_io_0018_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/rc_io_0018.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/rc_io_0018.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/rc_io_0018.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update rc_io_0018_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/rc_io_0018.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0018_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long rc_io_0018_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/rc_io_0018.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/rc_io_0018.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/rc_io_0018.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from rc_io_0018_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/rc_io_0018.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0018_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/rc_io_0018.pgc b/app/dbio/rc_io_0018.pgc new file mode 100644 index 0000000..1ac55c2 --- /dev/null +++ b/app/dbio/rc_io_0018.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module rc @transform reconciliation-dbio */ +/* + * rc_io_0018.pgc - 대사 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "rc_io_0018.h" + +EXEC SQL INCLUDE sqlca; + +int rc_io_0018_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM rc_io_0018_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0018_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int rc_io_0018_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE rc_io_0018_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0018_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long rc_io_0018_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM rc_io_0018_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0018_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/rc_io_0019.c b/app/dbio/rc_io_0019.c new file mode 100644 index 0000000..7e5317e --- /dev/null +++ b/app/dbio/rc_io_0019.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/rc_io_0019.pgc" +/* @tier easy @module rc @transform reconciliation-dbio */ +/* + * rc_io_0019.pgc - 대사 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "rc_io_0019.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/rc_io_0019.pgc" + + +int rc_io_0019_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/rc_io_0019.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/rc_io_0019.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/rc_io_0019.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from rc_io_0019_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/rc_io_0019.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0019_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int rc_io_0019_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/rc_io_0019.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/rc_io_0019.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/rc_io_0019.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update rc_io_0019_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/rc_io_0019.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0019_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long rc_io_0019_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/rc_io_0019.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/rc_io_0019.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/rc_io_0019.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from rc_io_0019_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/rc_io_0019.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0019_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/rc_io_0019.pgc b/app/dbio/rc_io_0019.pgc new file mode 100644 index 0000000..2014f97 --- /dev/null +++ b/app/dbio/rc_io_0019.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module rc @transform reconciliation-dbio */ +/* + * rc_io_0019.pgc - 대사 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "rc_io_0019.h" + +EXEC SQL INCLUDE sqlca; + +int rc_io_0019_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM rc_io_0019_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0019_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int rc_io_0019_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE rc_io_0019_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0019_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long rc_io_0019_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM rc_io_0019_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0019_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/rc_io_0020.c b/app/dbio/rc_io_0020.c new file mode 100644 index 0000000..a5b78c0 --- /dev/null +++ b/app/dbio/rc_io_0020.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/rc_io_0020.pgc" +/* @tier medium @module rc @transform reconciliation-dbio */ +/* + * rc_io_0020.pgc - 대사 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "rc_io_0020.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/rc_io_0020.pgc" + + +int rc_io_0020_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/rc_io_0020.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/rc_io_0020.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/rc_io_0020.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from rc_io_0020_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/rc_io_0020.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0020_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int rc_io_0020_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/rc_io_0020.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/rc_io_0020.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/rc_io_0020.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update rc_io_0020_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/rc_io_0020.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0020_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long rc_io_0020_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/rc_io_0020.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/rc_io_0020.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/rc_io_0020.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from rc_io_0020_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/rc_io_0020.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0020_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/rc_io_0020.pgc b/app/dbio/rc_io_0020.pgc new file mode 100644 index 0000000..3499080 --- /dev/null +++ b/app/dbio/rc_io_0020.pgc @@ -0,0 +1,92 @@ +/* @tier medium @module rc @transform reconciliation-dbio */ +/* + * rc_io_0020.pgc - 대사 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "rc_io_0020.h" + +EXEC SQL INCLUDE sqlca; + +int rc_io_0020_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM rc_io_0020_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0020_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int rc_io_0020_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE rc_io_0020_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0020_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long rc_io_0020_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM rc_io_0020_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0020_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/rc_io_0021.c b/app/dbio/rc_io_0021.c new file mode 100644 index 0000000..2308518 --- /dev/null +++ b/app/dbio/rc_io_0021.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/rc_io_0021.pgc" +/* @tier easy @module rc @transform reconciliation-dbio */ +/* + * rc_io_0021.pgc - 대사 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "rc_io_0021.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/rc_io_0021.pgc" + + +int rc_io_0021_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/rc_io_0021.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/rc_io_0021.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/rc_io_0021.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from rc_io_0021_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/rc_io_0021.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0021_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int rc_io_0021_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/rc_io_0021.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/rc_io_0021.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/rc_io_0021.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update rc_io_0021_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/rc_io_0021.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0021_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long rc_io_0021_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/rc_io_0021.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/rc_io_0021.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/rc_io_0021.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from rc_io_0021_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/rc_io_0021.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0021_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/rc_io_0021.pgc b/app/dbio/rc_io_0021.pgc new file mode 100644 index 0000000..2fdbf0f --- /dev/null +++ b/app/dbio/rc_io_0021.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module rc @transform reconciliation-dbio */ +/* + * rc_io_0021.pgc - 대사 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "rc_io_0021.h" + +EXEC SQL INCLUDE sqlca; + +int rc_io_0021_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM rc_io_0021_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0021_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int rc_io_0021_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE rc_io_0021_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0021_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long rc_io_0021_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM rc_io_0021_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0021_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/rc_io_0022.c b/app/dbio/rc_io_0022.c new file mode 100644 index 0000000..095f9cd --- /dev/null +++ b/app/dbio/rc_io_0022.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/rc_io_0022.pgc" +/* @tier medium @module rc @transform reconciliation-dbio */ +/* + * rc_io_0022.pgc - 대사 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "rc_io_0022.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/rc_io_0022.pgc" + + +int rc_io_0022_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/rc_io_0022.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/rc_io_0022.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/rc_io_0022.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from rc_io_0022_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/rc_io_0022.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0022_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int rc_io_0022_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/rc_io_0022.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/rc_io_0022.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/rc_io_0022.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update rc_io_0022_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/rc_io_0022.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0022_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long rc_io_0022_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/rc_io_0022.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/rc_io_0022.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/rc_io_0022.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from rc_io_0022_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/rc_io_0022.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0022_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/rc_io_0022.pgc b/app/dbio/rc_io_0022.pgc new file mode 100644 index 0000000..b85eb5c --- /dev/null +++ b/app/dbio/rc_io_0022.pgc @@ -0,0 +1,92 @@ +/* @tier medium @module rc @transform reconciliation-dbio */ +/* + * rc_io_0022.pgc - 대사 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "rc_io_0022.h" + +EXEC SQL INCLUDE sqlca; + +int rc_io_0022_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM rc_io_0022_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0022_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int rc_io_0022_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE rc_io_0022_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0022_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long rc_io_0022_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM rc_io_0022_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0022_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/rc_io_0023.c b/app/dbio/rc_io_0023.c new file mode 100644 index 0000000..e06570b --- /dev/null +++ b/app/dbio/rc_io_0023.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/rc_io_0023.pgc" +/* @tier easy @module rc @transform reconciliation-dbio */ +/* + * rc_io_0023.pgc - 대사 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "rc_io_0023.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/rc_io_0023.pgc" + + +int rc_io_0023_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/rc_io_0023.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/rc_io_0023.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/rc_io_0023.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from rc_io_0023_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/rc_io_0023.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0023_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int rc_io_0023_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/rc_io_0023.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/rc_io_0023.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/rc_io_0023.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update rc_io_0023_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/rc_io_0023.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0023_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long rc_io_0023_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/rc_io_0023.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/rc_io_0023.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/rc_io_0023.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from rc_io_0023_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/rc_io_0023.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0023_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/rc_io_0023.pgc b/app/dbio/rc_io_0023.pgc new file mode 100644 index 0000000..23ebd7b --- /dev/null +++ b/app/dbio/rc_io_0023.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module rc @transform reconciliation-dbio */ +/* + * rc_io_0023.pgc - 대사 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "rc_io_0023.h" + +EXEC SQL INCLUDE sqlca; + +int rc_io_0023_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM rc_io_0023_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0023_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int rc_io_0023_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE rc_io_0023_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0023_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long rc_io_0023_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM rc_io_0023_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0023_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/rc_io_0024.c b/app/dbio/rc_io_0024.c new file mode 100644 index 0000000..8a8629f --- /dev/null +++ b/app/dbio/rc_io_0024.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/rc_io_0024.pgc" +/* @tier medium @module rc @transform reconciliation-dbio */ +/* + * rc_io_0024.pgc - 대사 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "rc_io_0024.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/rc_io_0024.pgc" + + +int rc_io_0024_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/rc_io_0024.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/rc_io_0024.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/rc_io_0024.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from rc_io_0024_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/rc_io_0024.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0024_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int rc_io_0024_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/rc_io_0024.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/rc_io_0024.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/rc_io_0024.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update rc_io_0024_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/rc_io_0024.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0024_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long rc_io_0024_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/rc_io_0024.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/rc_io_0024.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/rc_io_0024.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from rc_io_0024_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/rc_io_0024.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0024_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/rc_io_0024.pgc b/app/dbio/rc_io_0024.pgc new file mode 100644 index 0000000..252474b --- /dev/null +++ b/app/dbio/rc_io_0024.pgc @@ -0,0 +1,92 @@ +/* @tier medium @module rc @transform reconciliation-dbio */ +/* + * rc_io_0024.pgc - 대사 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "rc_io_0024.h" + +EXEC SQL INCLUDE sqlca; + +int rc_io_0024_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM rc_io_0024_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0024_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int rc_io_0024_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE rc_io_0024_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0024_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long rc_io_0024_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM rc_io_0024_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0024_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/rc_io_0025.c b/app/dbio/rc_io_0025.c new file mode 100644 index 0000000..0b8b08c --- /dev/null +++ b/app/dbio/rc_io_0025.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/rc_io_0025.pgc" +/* @tier easy @module rc @transform reconciliation-dbio */ +/* + * rc_io_0025.pgc - 대사 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "rc_io_0025.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/rc_io_0025.pgc" + + +int rc_io_0025_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/rc_io_0025.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/rc_io_0025.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/rc_io_0025.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from rc_io_0025_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/rc_io_0025.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0025_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int rc_io_0025_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/rc_io_0025.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/rc_io_0025.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/rc_io_0025.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update rc_io_0025_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/rc_io_0025.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0025_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long rc_io_0025_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/rc_io_0025.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/rc_io_0025.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/rc_io_0025.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from rc_io_0025_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/rc_io_0025.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0025_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/rc_io_0025.pgc b/app/dbio/rc_io_0025.pgc new file mode 100644 index 0000000..7440dde --- /dev/null +++ b/app/dbio/rc_io_0025.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module rc @transform reconciliation-dbio */ +/* + * rc_io_0025.pgc - 대사 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "rc_io_0025.h" + +EXEC SQL INCLUDE sqlca; + +int rc_io_0025_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM rc_io_0025_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0025_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int rc_io_0025_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE rc_io_0025_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0025_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long rc_io_0025_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM rc_io_0025_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0025_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/rc_io_0026.c b/app/dbio/rc_io_0026.c new file mode 100644 index 0000000..b9488bd --- /dev/null +++ b/app/dbio/rc_io_0026.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/rc_io_0026.pgc" +/* @tier hard @module rc @transform reconciliation-dbio */ +/* + * rc_io_0026.pgc - 대사 보조 DBIO (ECPG) [tier=hard] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "rc_io_0026.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/rc_io_0026.pgc" + + +int rc_io_0026_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/rc_io_0026.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/rc_io_0026.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/rc_io_0026.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from rc_io_0026_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/rc_io_0026.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0026_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int rc_io_0026_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/rc_io_0026.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/rc_io_0026.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/rc_io_0026.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update rc_io_0026_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/rc_io_0026.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0026_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long rc_io_0026_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/rc_io_0026.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/rc_io_0026.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/rc_io_0026.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from rc_io_0026_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/rc_io_0026.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0026_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/rc_io_0026.pgc b/app/dbio/rc_io_0026.pgc new file mode 100644 index 0000000..de958e3 --- /dev/null +++ b/app/dbio/rc_io_0026.pgc @@ -0,0 +1,92 @@ +/* @tier hard @module rc @transform reconciliation-dbio */ +/* + * rc_io_0026.pgc - 대사 보조 DBIO (ECPG) [tier=hard] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "rc_io_0026.h" + +EXEC SQL INCLUDE sqlca; + +int rc_io_0026_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM rc_io_0026_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0026_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int rc_io_0026_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE rc_io_0026_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0026_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long rc_io_0026_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM rc_io_0026_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("rc_io_0026_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/st_dbio_main.c b/app/dbio/st_dbio_main.c new file mode 100644 index 0000000..fa75902 --- /dev/null +++ b/app/dbio/st_dbio_main.c @@ -0,0 +1,399 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/st_dbio_main.pgc" +/* @tier medium @module st @transform settlement-dbio */ +/* + * st_dbio_main.pgc - 정산수수료 표준 DBIO (ECPG 임베디드 SQL) + * + * st_core.h 의 표준 API 를 st_ledger 테이블에 대해 구현한다. + * 온라인/배치 프로그램은 이 함수들만 호출한다 (self-contained). + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "st_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/dbio/st_dbio_main.pgc" + + +int st_dbio_connect(const char *target) +{ + /* exec sql begin declare section */ + + +#line 20 "app/dbio/st_dbio_main.pgc" + const char * h_target ; +/* exec sql end declare section */ +#line 21 "app/dbio/st_dbio_main.pgc" + + + h_target = (target && target[0]) ? target : "acquire@localhost"; + + { ECPGconnect(__LINE__, 0, h_target , NULL, NULL , NULL, 0); } +#line 25 "app/dbio/st_dbio_main.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st CONNECT"); + return TX_EDB; + } + tx_log(TX_LOG_INFO, "[st] DB 접속 완료 target=%s", h_target); + return TX_OK; +} + +int st_dbio_disconnect(void) +{ + { ECPGdisconnect(__LINE__, "CURRENT");} +#line 36 "app/dbio/st_dbio_main.pgc" + + return TX_OK; +} + +int st_rec_insert(const st_rec_t *rec) +{ + /* exec sql begin declare section */ + + + + + + + + +#line 43 "app/dbio/st_dbio_main.pgc" + char h_key [ 16 ] ; + +#line 44 "app/dbio/st_dbio_main.pgc" + char h_merch_id [ 16 ] ; + +#line 45 "app/dbio/st_dbio_main.pgc" + char h_card_no [ 20 ] ; + +#line 46 "app/dbio/st_dbio_main.pgc" + long h_amount ; + +#line 47 "app/dbio/st_dbio_main.pgc" + char h_biz_date [ 9 ] ; + +#line 48 "app/dbio/st_dbio_main.pgc" + char h_status [ 2 ] ; + +#line 49 "app/dbio/st_dbio_main.pgc" + long h_fee ; +/* exec sql end declare section */ +#line 50 "app/dbio/st_dbio_main.pgc" + + + if (!rec) + return TX_EINVAL; + + strncpy(h_key, rec->key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + strncpy(h_merch_id, rec->merch_id, sizeof(h_merch_id) - 1); + h_merch_id[sizeof(h_merch_id) - 1] = '\0'; + strncpy(h_card_no, rec->card_no, sizeof(h_card_no) - 1); + h_card_no[sizeof(h_card_no) - 1] = '\0'; + strncpy(h_biz_date, rec->biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + strncpy(h_status, rec->status, sizeof(h_status) - 1); + h_status[sizeof(h_status) - 1] = '\0'; + h_amount = rec->amount; + h_fee = rec->fee; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into st_ledger ( key , merch_id , card_no , amount , biz_date , status , fee ) values ( $1 , $2 , $3 , $4 , $5 , $6 , $7 )", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_card_no),(long)20,(long)1,(20)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_status),(long)2,(long)1,(2)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_fee),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 71 "app/dbio/st_dbio_main.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_rec_insert"); + return TX_EDB; + } + return TX_OK; +} + +int st_rec_select(const char *key, st_rec_t *out) +{ + /* exec sql begin declare section */ + + + + + + + + +#line 83 "app/dbio/st_dbio_main.pgc" + char h_key [ 16 ] ; + +#line 84 "app/dbio/st_dbio_main.pgc" + char h_merch_id [ 16 ] ; + +#line 85 "app/dbio/st_dbio_main.pgc" + char h_card_no [ 20 ] ; + +#line 86 "app/dbio/st_dbio_main.pgc" + long h_amount ; + +#line 87 "app/dbio/st_dbio_main.pgc" + char h_biz_date [ 9 ] ; + +#line 88 "app/dbio/st_dbio_main.pgc" + char h_status [ 2 ] ; + +#line 89 "app/dbio/st_dbio_main.pgc" + long h_fee ; +/* exec sql end declare section */ +#line 90 "app/dbio/st_dbio_main.pgc" + + + if (!key || !out) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select merch_id , card_no , amount , biz_date , status , fee from st_ledger where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_card_no),(long)20,(long)1,(20)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_status),(long)2,(long)1,(2)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_fee),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 101 "app/dbio/st_dbio_main.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_rec_select"); + return TX_EDB; + } + + memset(out, 0, sizeof(*out)); + strncpy(out->key, h_key, sizeof(out->key) - 1); + strncpy(out->merch_id, h_merch_id, sizeof(out->merch_id) - 1); + strncpy(out->card_no, h_card_no, sizeof(out->card_no) - 1); + strncpy(out->biz_date, h_biz_date, sizeof(out->biz_date) - 1); + strncpy(out->status, h_status, sizeof(out->status) - 1); + out->amount = h_amount; + out->fee = h_fee; + return TX_OK; +} + +int st_rec_update_status(const char *key, const char *status) +{ + /* exec sql begin declare section */ + + + +#line 124 "app/dbio/st_dbio_main.pgc" + char h_key [ 16 ] ; + +#line 125 "app/dbio/st_dbio_main.pgc" + char h_status [ 2 ] ; +/* exec sql end declare section */ +#line 126 "app/dbio/st_dbio_main.pgc" + + + if (!key || !status) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + strncpy(h_status, status, sizeof(h_status) - 1); + h_status[sizeof(h_status) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update st_ledger set status = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_char,(h_status),(long)2,(long)1,(2)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 138 "app/dbio/st_dbio_main.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_rec_update_status"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long st_rec_count(const char *biz_date, const char *status) +{ + /* exec sql begin declare section */ + + + + +#line 152 "app/dbio/st_dbio_main.pgc" + char h_biz_date [ 9 ] ; + +#line 153 "app/dbio/st_dbio_main.pgc" + char h_status [ 2 ] ; + +#line 154 "app/dbio/st_dbio_main.pgc" + int h_cnt ; +/* exec sql end declare section */ +#line 155 "app/dbio/st_dbio_main.pgc" + + + if (!biz_date || !status) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + strncpy(h_status, status, sizeof(h_status) - 1); + h_status[sizeof(h_status) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select count ( * ) from st_ledger where biz_date = $1 and status = $2 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_status),(long)2,(long)1,(2)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_int,&(h_cnt),(long)1,(long)1,sizeof(int), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 169 "app/dbio/st_dbio_main.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_rec_count"); + return -1; + } + return (long)h_cnt; +} + +int st_rec_sum(const char *biz_date, long *out_sum) +{ + /* exec sql begin declare section */ + + + +#line 181 "app/dbio/st_dbio_main.pgc" + char h_biz_date [ 9 ] ; + +#line 182 "app/dbio/st_dbio_main.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 183 "app/dbio/st_dbio_main.pgc" + + + if (!biz_date || !out_sum) + return TX_EINVAL; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from st_ledger where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 194 "app/dbio/st_dbio_main.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_rec_sum"); + return TX_EDB; + } + *out_sum = h_sum; + return TX_OK; +} diff --git a/app/dbio/st_dbio_main.pgc b/app/dbio/st_dbio_main.pgc new file mode 100644 index 0000000..8afeb83 --- /dev/null +++ b/app/dbio/st_dbio_main.pgc @@ -0,0 +1,202 @@ +/* @tier medium @module st @transform settlement-dbio */ +/* + * st_dbio_main.pgc - 정산수수료 표준 DBIO (ECPG 임베디드 SQL) + * + * st_core.h 의 표준 API 를 st_ledger 테이블에 대해 구현한다. + * 온라인/배치 프로그램은 이 함수들만 호출한다 (self-contained). + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "st_core.h" + +EXEC SQL INCLUDE sqlca; + +int st_dbio_connect(const char *target) +{ + EXEC SQL BEGIN DECLARE SECTION; + const char *h_target; + EXEC SQL END DECLARE SECTION; + + h_target = (target && target[0]) ? target : "acquire@localhost"; + + EXEC SQL CONNECT TO :h_target; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st CONNECT"); + return TX_EDB; + } + tx_log(TX_LOG_INFO, "[st] DB 접속 완료 target=%s", h_target); + return TX_OK; +} + +int st_dbio_disconnect(void) +{ + EXEC SQL DISCONNECT CURRENT; + return TX_OK; +} + +int st_rec_insert(const st_rec_t *rec) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + char h_merch_id[16]; + char h_card_no[20]; + long h_amount; + char h_biz_date[9]; + char h_status[2]; + long h_fee; + EXEC SQL END DECLARE SECTION; + + if (!rec) + return TX_EINVAL; + + strncpy(h_key, rec->key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + strncpy(h_merch_id, rec->merch_id, sizeof(h_merch_id) - 1); + h_merch_id[sizeof(h_merch_id) - 1] = '\0'; + strncpy(h_card_no, rec->card_no, sizeof(h_card_no) - 1); + h_card_no[sizeof(h_card_no) - 1] = '\0'; + strncpy(h_biz_date, rec->biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + strncpy(h_status, rec->status, sizeof(h_status) - 1); + h_status[sizeof(h_status) - 1] = '\0'; + h_amount = rec->amount; + h_fee = rec->fee; + + EXEC SQL INSERT INTO st_ledger + (key, merch_id, card_no, amount, biz_date, status, fee) + VALUES + (:h_key, :h_merch_id, :h_card_no, :h_amount, :h_biz_date, :h_status, :h_fee); + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_rec_insert"); + return TX_EDB; + } + return TX_OK; +} + +int st_rec_select(const char *key, st_rec_t *out) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + char h_merch_id[16]; + char h_card_no[20]; + long h_amount; + char h_biz_date[9]; + char h_status[2]; + long h_fee; + EXEC SQL END DECLARE SECTION; + + if (!key || !out) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT merch_id, card_no, amount, biz_date, status, fee + INTO :h_merch_id, :h_card_no, :h_amount, :h_biz_date, :h_status, :h_fee + FROM st_ledger + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_rec_select"); + return TX_EDB; + } + + memset(out, 0, sizeof(*out)); + strncpy(out->key, h_key, sizeof(out->key) - 1); + strncpy(out->merch_id, h_merch_id, sizeof(out->merch_id) - 1); + strncpy(out->card_no, h_card_no, sizeof(out->card_no) - 1); + strncpy(out->biz_date, h_biz_date, sizeof(out->biz_date) - 1); + strncpy(out->status, h_status, sizeof(out->status) - 1); + out->amount = h_amount; + out->fee = h_fee; + return TX_OK; +} + +int st_rec_update_status(const char *key, const char *status) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + char h_status[2]; + EXEC SQL END DECLARE SECTION; + + if (!key || !status) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + strncpy(h_status, status, sizeof(h_status) - 1); + h_status[sizeof(h_status) - 1] = '\0'; + + EXEC SQL UPDATE st_ledger + SET status = :h_status, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_rec_update_status"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long st_rec_count(const char *biz_date, const char *status) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_status[2]; + int h_cnt; + EXEC SQL END DECLARE SECTION; + + if (!biz_date || !status) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + strncpy(h_status, status, sizeof(h_status) - 1); + h_status[sizeof(h_status) - 1] = '\0'; + + EXEC SQL SELECT count(*) + INTO :h_cnt + FROM st_ledger + WHERE biz_date = :h_biz_date + AND status = :h_status; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_rec_count"); + return -1; + } + return (long)h_cnt; +} + +int st_rec_sum(const char *biz_date, long *out_sum) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date || !out_sum) + return TX_EINVAL; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM st_ledger + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_rec_sum"); + return TX_EDB; + } + *out_sum = h_sum; + return TX_OK; +} diff --git a/app/dbio/st_io_0001.c b/app/dbio/st_io_0001.c new file mode 100644 index 0000000..2086e2d --- /dev/null +++ b/app/dbio/st_io_0001.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/st_io_0001.pgc" +/* @tier easy @module st @transform settlement-dbio */ +/* + * st_io_0001.pgc - 정산수수료 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "st_io_0001.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/st_io_0001.pgc" + + +int st_io_0001_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/st_io_0001.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/st_io_0001.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/st_io_0001.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from st_io_0001_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/st_io_0001.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0001_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int st_io_0001_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/st_io_0001.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/st_io_0001.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/st_io_0001.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update st_io_0001_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/st_io_0001.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0001_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long st_io_0001_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/st_io_0001.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/st_io_0001.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/st_io_0001.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from st_io_0001_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/st_io_0001.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0001_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/st_io_0001.pgc b/app/dbio/st_io_0001.pgc new file mode 100644 index 0000000..40f74b2 --- /dev/null +++ b/app/dbio/st_io_0001.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module st @transform settlement-dbio */ +/* + * st_io_0001.pgc - 정산수수료 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "st_io_0001.h" + +EXEC SQL INCLUDE sqlca; + +int st_io_0001_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM st_io_0001_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0001_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int st_io_0001_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE st_io_0001_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0001_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long st_io_0001_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM st_io_0001_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0001_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/st_io_0002.c b/app/dbio/st_io_0002.c new file mode 100644 index 0000000..436189e --- /dev/null +++ b/app/dbio/st_io_0002.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/st_io_0002.pgc" +/* @tier medium @module st @transform settlement-dbio */ +/* + * st_io_0002.pgc - 정산수수료 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "st_io_0002.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/st_io_0002.pgc" + + +int st_io_0002_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/st_io_0002.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/st_io_0002.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/st_io_0002.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from st_io_0002_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/st_io_0002.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0002_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int st_io_0002_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/st_io_0002.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/st_io_0002.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/st_io_0002.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update st_io_0002_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/st_io_0002.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0002_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long st_io_0002_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/st_io_0002.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/st_io_0002.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/st_io_0002.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from st_io_0002_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/st_io_0002.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0002_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/st_io_0002.pgc b/app/dbio/st_io_0002.pgc new file mode 100644 index 0000000..a4f03b0 --- /dev/null +++ b/app/dbio/st_io_0002.pgc @@ -0,0 +1,92 @@ +/* @tier medium @module st @transform settlement-dbio */ +/* + * st_io_0002.pgc - 정산수수료 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "st_io_0002.h" + +EXEC SQL INCLUDE sqlca; + +int st_io_0002_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM st_io_0002_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0002_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int st_io_0002_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE st_io_0002_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0002_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long st_io_0002_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM st_io_0002_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0002_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/st_io_0003.c b/app/dbio/st_io_0003.c new file mode 100644 index 0000000..0b01ac1 --- /dev/null +++ b/app/dbio/st_io_0003.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/st_io_0003.pgc" +/* @tier easy @module st @transform settlement-dbio */ +/* + * st_io_0003.pgc - 정산수수료 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "st_io_0003.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/st_io_0003.pgc" + + +int st_io_0003_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/st_io_0003.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/st_io_0003.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/st_io_0003.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from st_io_0003_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/st_io_0003.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0003_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int st_io_0003_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/st_io_0003.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/st_io_0003.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/st_io_0003.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update st_io_0003_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/st_io_0003.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0003_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long st_io_0003_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/st_io_0003.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/st_io_0003.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/st_io_0003.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from st_io_0003_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/st_io_0003.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0003_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/st_io_0003.pgc b/app/dbio/st_io_0003.pgc new file mode 100644 index 0000000..01628d1 --- /dev/null +++ b/app/dbio/st_io_0003.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module st @transform settlement-dbio */ +/* + * st_io_0003.pgc - 정산수수료 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "st_io_0003.h" + +EXEC SQL INCLUDE sqlca; + +int st_io_0003_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM st_io_0003_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0003_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int st_io_0003_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE st_io_0003_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0003_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long st_io_0003_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM st_io_0003_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0003_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/st_io_0004.c b/app/dbio/st_io_0004.c new file mode 100644 index 0000000..90ef738 --- /dev/null +++ b/app/dbio/st_io_0004.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/st_io_0004.pgc" +/* @tier hard @module st @transform settlement-dbio */ +/* + * st_io_0004.pgc - 정산수수료 보조 DBIO (ECPG) [tier=hard] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "st_io_0004.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/st_io_0004.pgc" + + +int st_io_0004_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/st_io_0004.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/st_io_0004.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/st_io_0004.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from st_io_0004_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/st_io_0004.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0004_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int st_io_0004_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/st_io_0004.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/st_io_0004.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/st_io_0004.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update st_io_0004_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/st_io_0004.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0004_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long st_io_0004_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/st_io_0004.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/st_io_0004.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/st_io_0004.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from st_io_0004_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/st_io_0004.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0004_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/st_io_0004.pgc b/app/dbio/st_io_0004.pgc new file mode 100644 index 0000000..aa83e9b --- /dev/null +++ b/app/dbio/st_io_0004.pgc @@ -0,0 +1,92 @@ +/* @tier hard @module st @transform settlement-dbio */ +/* + * st_io_0004.pgc - 정산수수료 보조 DBIO (ECPG) [tier=hard] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "st_io_0004.h" + +EXEC SQL INCLUDE sqlca; + +int st_io_0004_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM st_io_0004_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0004_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int st_io_0004_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE st_io_0004_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0004_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long st_io_0004_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM st_io_0004_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0004_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/st_io_0005.c b/app/dbio/st_io_0005.c new file mode 100644 index 0000000..12d3f76 --- /dev/null +++ b/app/dbio/st_io_0005.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/st_io_0005.pgc" +/* @tier easy @module st @transform settlement-dbio */ +/* + * st_io_0005.pgc - 정산수수료 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "st_io_0005.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/st_io_0005.pgc" + + +int st_io_0005_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/st_io_0005.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/st_io_0005.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/st_io_0005.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from st_io_0005_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/st_io_0005.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0005_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int st_io_0005_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/st_io_0005.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/st_io_0005.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/st_io_0005.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update st_io_0005_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/st_io_0005.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0005_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long st_io_0005_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/st_io_0005.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/st_io_0005.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/st_io_0005.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from st_io_0005_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/st_io_0005.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0005_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/st_io_0005.pgc b/app/dbio/st_io_0005.pgc new file mode 100644 index 0000000..a02995b --- /dev/null +++ b/app/dbio/st_io_0005.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module st @transform settlement-dbio */ +/* + * st_io_0005.pgc - 정산수수료 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "st_io_0005.h" + +EXEC SQL INCLUDE sqlca; + +int st_io_0005_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM st_io_0005_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0005_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int st_io_0005_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE st_io_0005_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0005_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long st_io_0005_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM st_io_0005_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0005_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/st_io_0006.c b/app/dbio/st_io_0006.c new file mode 100644 index 0000000..ae1d342 --- /dev/null +++ b/app/dbio/st_io_0006.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/st_io_0006.pgc" +/* @tier easy @module st @transform settlement-dbio */ +/* + * st_io_0006.pgc - 정산수수료 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "st_io_0006.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/st_io_0006.pgc" + + +int st_io_0006_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/st_io_0006.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/st_io_0006.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/st_io_0006.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from st_io_0006_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/st_io_0006.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0006_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int st_io_0006_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/st_io_0006.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/st_io_0006.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/st_io_0006.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update st_io_0006_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/st_io_0006.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0006_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long st_io_0006_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/st_io_0006.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/st_io_0006.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/st_io_0006.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from st_io_0006_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/st_io_0006.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0006_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/st_io_0006.pgc b/app/dbio/st_io_0006.pgc new file mode 100644 index 0000000..3e23cb8 --- /dev/null +++ b/app/dbio/st_io_0006.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module st @transform settlement-dbio */ +/* + * st_io_0006.pgc - 정산수수료 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "st_io_0006.h" + +EXEC SQL INCLUDE sqlca; + +int st_io_0006_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM st_io_0006_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0006_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int st_io_0006_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE st_io_0006_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0006_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long st_io_0006_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM st_io_0006_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0006_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/st_io_0007.c b/app/dbio/st_io_0007.c new file mode 100644 index 0000000..eb09d4c --- /dev/null +++ b/app/dbio/st_io_0007.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/st_io_0007.pgc" +/* @tier medium @module st @transform settlement-dbio */ +/* + * st_io_0007.pgc - 정산수수료 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "st_io_0007.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/st_io_0007.pgc" + + +int st_io_0007_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/st_io_0007.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/st_io_0007.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/st_io_0007.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from st_io_0007_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/st_io_0007.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0007_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int st_io_0007_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/st_io_0007.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/st_io_0007.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/st_io_0007.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update st_io_0007_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/st_io_0007.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0007_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long st_io_0007_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/st_io_0007.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/st_io_0007.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/st_io_0007.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from st_io_0007_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/st_io_0007.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0007_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/st_io_0007.pgc b/app/dbio/st_io_0007.pgc new file mode 100644 index 0000000..d4c0bb9 --- /dev/null +++ b/app/dbio/st_io_0007.pgc @@ -0,0 +1,92 @@ +/* @tier medium @module st @transform settlement-dbio */ +/* + * st_io_0007.pgc - 정산수수료 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "st_io_0007.h" + +EXEC SQL INCLUDE sqlca; + +int st_io_0007_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM st_io_0007_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0007_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int st_io_0007_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE st_io_0007_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0007_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long st_io_0007_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM st_io_0007_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0007_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/st_io_0008.c b/app/dbio/st_io_0008.c new file mode 100644 index 0000000..6f908f6 --- /dev/null +++ b/app/dbio/st_io_0008.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/st_io_0008.pgc" +/* @tier easy @module st @transform settlement-dbio */ +/* + * st_io_0008.pgc - 정산수수료 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "st_io_0008.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/st_io_0008.pgc" + + +int st_io_0008_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/st_io_0008.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/st_io_0008.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/st_io_0008.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from st_io_0008_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/st_io_0008.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0008_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int st_io_0008_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/st_io_0008.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/st_io_0008.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/st_io_0008.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update st_io_0008_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/st_io_0008.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0008_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long st_io_0008_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/st_io_0008.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/st_io_0008.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/st_io_0008.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from st_io_0008_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/st_io_0008.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0008_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/st_io_0008.pgc b/app/dbio/st_io_0008.pgc new file mode 100644 index 0000000..16d1990 --- /dev/null +++ b/app/dbio/st_io_0008.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module st @transform settlement-dbio */ +/* + * st_io_0008.pgc - 정산수수료 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "st_io_0008.h" + +EXEC SQL INCLUDE sqlca; + +int st_io_0008_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM st_io_0008_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0008_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int st_io_0008_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE st_io_0008_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0008_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long st_io_0008_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM st_io_0008_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0008_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/st_io_0009.c b/app/dbio/st_io_0009.c new file mode 100644 index 0000000..33f0b6c --- /dev/null +++ b/app/dbio/st_io_0009.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/st_io_0009.pgc" +/* @tier medium @module st @transform settlement-dbio */ +/* + * st_io_0009.pgc - 정산수수료 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "st_io_0009.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/st_io_0009.pgc" + + +int st_io_0009_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/st_io_0009.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/st_io_0009.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/st_io_0009.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from st_io_0009_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/st_io_0009.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0009_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int st_io_0009_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/st_io_0009.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/st_io_0009.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/st_io_0009.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update st_io_0009_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/st_io_0009.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0009_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long st_io_0009_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/st_io_0009.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/st_io_0009.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/st_io_0009.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from st_io_0009_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/st_io_0009.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0009_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/st_io_0009.pgc b/app/dbio/st_io_0009.pgc new file mode 100644 index 0000000..7af6331 --- /dev/null +++ b/app/dbio/st_io_0009.pgc @@ -0,0 +1,92 @@ +/* @tier medium @module st @transform settlement-dbio */ +/* + * st_io_0009.pgc - 정산수수료 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "st_io_0009.h" + +EXEC SQL INCLUDE sqlca; + +int st_io_0009_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM st_io_0009_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0009_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int st_io_0009_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE st_io_0009_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0009_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long st_io_0009_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM st_io_0009_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0009_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/st_io_0010.c b/app/dbio/st_io_0010.c new file mode 100644 index 0000000..c91d065 --- /dev/null +++ b/app/dbio/st_io_0010.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/st_io_0010.pgc" +/* @tier easy @module st @transform settlement-dbio */ +/* + * st_io_0010.pgc - 정산수수료 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "st_io_0010.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/st_io_0010.pgc" + + +int st_io_0010_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/st_io_0010.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/st_io_0010.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/st_io_0010.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from st_io_0010_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/st_io_0010.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0010_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int st_io_0010_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/st_io_0010.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/st_io_0010.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/st_io_0010.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update st_io_0010_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/st_io_0010.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0010_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long st_io_0010_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/st_io_0010.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/st_io_0010.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/st_io_0010.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from st_io_0010_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/st_io_0010.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0010_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/st_io_0010.pgc b/app/dbio/st_io_0010.pgc new file mode 100644 index 0000000..0f2b80b --- /dev/null +++ b/app/dbio/st_io_0010.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module st @transform settlement-dbio */ +/* + * st_io_0010.pgc - 정산수수료 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "st_io_0010.h" + +EXEC SQL INCLUDE sqlca; + +int st_io_0010_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM st_io_0010_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0010_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int st_io_0010_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE st_io_0010_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0010_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long st_io_0010_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM st_io_0010_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0010_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/st_io_0011.c b/app/dbio/st_io_0011.c new file mode 100644 index 0000000..929621a --- /dev/null +++ b/app/dbio/st_io_0011.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/st_io_0011.pgc" +/* @tier medium @module st @transform settlement-dbio */ +/* + * st_io_0011.pgc - 정산수수료 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "st_io_0011.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/st_io_0011.pgc" + + +int st_io_0011_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/st_io_0011.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/st_io_0011.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/st_io_0011.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from st_io_0011_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/st_io_0011.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0011_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int st_io_0011_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/st_io_0011.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/st_io_0011.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/st_io_0011.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update st_io_0011_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/st_io_0011.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0011_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long st_io_0011_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/st_io_0011.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/st_io_0011.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/st_io_0011.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from st_io_0011_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/st_io_0011.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0011_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/st_io_0011.pgc b/app/dbio/st_io_0011.pgc new file mode 100644 index 0000000..6e71e03 --- /dev/null +++ b/app/dbio/st_io_0011.pgc @@ -0,0 +1,92 @@ +/* @tier medium @module st @transform settlement-dbio */ +/* + * st_io_0011.pgc - 정산수수료 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "st_io_0011.h" + +EXEC SQL INCLUDE sqlca; + +int st_io_0011_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM st_io_0011_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0011_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int st_io_0011_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE st_io_0011_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0011_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long st_io_0011_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM st_io_0011_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0011_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/st_io_0012.c b/app/dbio/st_io_0012.c new file mode 100644 index 0000000..9a7713c --- /dev/null +++ b/app/dbio/st_io_0012.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/st_io_0012.pgc" +/* @tier easy @module st @transform settlement-dbio */ +/* + * st_io_0012.pgc - 정산수수료 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "st_io_0012.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/st_io_0012.pgc" + + +int st_io_0012_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/st_io_0012.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/st_io_0012.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/st_io_0012.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from st_io_0012_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/st_io_0012.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0012_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int st_io_0012_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/st_io_0012.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/st_io_0012.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/st_io_0012.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update st_io_0012_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/st_io_0012.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0012_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long st_io_0012_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/st_io_0012.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/st_io_0012.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/st_io_0012.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from st_io_0012_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/st_io_0012.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0012_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/st_io_0012.pgc b/app/dbio/st_io_0012.pgc new file mode 100644 index 0000000..2d2122f --- /dev/null +++ b/app/dbio/st_io_0012.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module st @transform settlement-dbio */ +/* + * st_io_0012.pgc - 정산수수료 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "st_io_0012.h" + +EXEC SQL INCLUDE sqlca; + +int st_io_0012_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM st_io_0012_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0012_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int st_io_0012_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE st_io_0012_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0012_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long st_io_0012_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM st_io_0012_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0012_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/st_io_0013.c b/app/dbio/st_io_0013.c new file mode 100644 index 0000000..aa5ead1 --- /dev/null +++ b/app/dbio/st_io_0013.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/st_io_0013.pgc" +/* @tier hard @module st @transform settlement-dbio */ +/* + * st_io_0013.pgc - 정산수수료 보조 DBIO (ECPG) [tier=hard] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "st_io_0013.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/st_io_0013.pgc" + + +int st_io_0013_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/st_io_0013.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/st_io_0013.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/st_io_0013.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from st_io_0013_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/st_io_0013.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0013_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int st_io_0013_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/st_io_0013.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/st_io_0013.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/st_io_0013.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update st_io_0013_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/st_io_0013.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0013_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long st_io_0013_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/st_io_0013.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/st_io_0013.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/st_io_0013.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from st_io_0013_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/st_io_0013.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0013_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/st_io_0013.pgc b/app/dbio/st_io_0013.pgc new file mode 100644 index 0000000..b833427 --- /dev/null +++ b/app/dbio/st_io_0013.pgc @@ -0,0 +1,92 @@ +/* @tier hard @module st @transform settlement-dbio */ +/* + * st_io_0013.pgc - 정산수수료 보조 DBIO (ECPG) [tier=hard] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "st_io_0013.h" + +EXEC SQL INCLUDE sqlca; + +int st_io_0013_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM st_io_0013_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0013_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int st_io_0013_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE st_io_0013_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0013_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long st_io_0013_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM st_io_0013_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0013_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/st_io_0014.c b/app/dbio/st_io_0014.c new file mode 100644 index 0000000..8adf43a --- /dev/null +++ b/app/dbio/st_io_0014.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/st_io_0014.pgc" +/* @tier easy @module st @transform settlement-dbio */ +/* + * st_io_0014.pgc - 정산수수료 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "st_io_0014.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/st_io_0014.pgc" + + +int st_io_0014_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/st_io_0014.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/st_io_0014.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/st_io_0014.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from st_io_0014_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/st_io_0014.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0014_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int st_io_0014_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/st_io_0014.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/st_io_0014.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/st_io_0014.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update st_io_0014_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/st_io_0014.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0014_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long st_io_0014_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/st_io_0014.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/st_io_0014.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/st_io_0014.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from st_io_0014_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/st_io_0014.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0014_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/st_io_0014.pgc b/app/dbio/st_io_0014.pgc new file mode 100644 index 0000000..8afac14 --- /dev/null +++ b/app/dbio/st_io_0014.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module st @transform settlement-dbio */ +/* + * st_io_0014.pgc - 정산수수료 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "st_io_0014.h" + +EXEC SQL INCLUDE sqlca; + +int st_io_0014_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM st_io_0014_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0014_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int st_io_0014_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE st_io_0014_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0014_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long st_io_0014_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM st_io_0014_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0014_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/st_io_0015.c b/app/dbio/st_io_0015.c new file mode 100644 index 0000000..e1900c1 --- /dev/null +++ b/app/dbio/st_io_0015.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/st_io_0015.pgc" +/* @tier hard @module st @transform settlement-dbio */ +/* + * st_io_0015.pgc - 정산수수료 보조 DBIO (ECPG) [tier=hard] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "st_io_0015.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/st_io_0015.pgc" + + +int st_io_0015_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/st_io_0015.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/st_io_0015.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/st_io_0015.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from st_io_0015_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/st_io_0015.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0015_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int st_io_0015_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/st_io_0015.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/st_io_0015.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/st_io_0015.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update st_io_0015_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/st_io_0015.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0015_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long st_io_0015_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/st_io_0015.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/st_io_0015.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/st_io_0015.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from st_io_0015_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/st_io_0015.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0015_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/st_io_0015.pgc b/app/dbio/st_io_0015.pgc new file mode 100644 index 0000000..78c3f59 --- /dev/null +++ b/app/dbio/st_io_0015.pgc @@ -0,0 +1,92 @@ +/* @tier hard @module st @transform settlement-dbio */ +/* + * st_io_0015.pgc - 정산수수료 보조 DBIO (ECPG) [tier=hard] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "st_io_0015.h" + +EXEC SQL INCLUDE sqlca; + +int st_io_0015_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM st_io_0015_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0015_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int st_io_0015_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE st_io_0015_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0015_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long st_io_0015_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM st_io_0015_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0015_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/st_io_0016.c b/app/dbio/st_io_0016.c new file mode 100644 index 0000000..9016916 --- /dev/null +++ b/app/dbio/st_io_0016.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/st_io_0016.pgc" +/* @tier easy @module st @transform settlement-dbio */ +/* + * st_io_0016.pgc - 정산수수료 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "st_io_0016.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/st_io_0016.pgc" + + +int st_io_0016_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/st_io_0016.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/st_io_0016.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/st_io_0016.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from st_io_0016_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/st_io_0016.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0016_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int st_io_0016_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/st_io_0016.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/st_io_0016.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/st_io_0016.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update st_io_0016_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/st_io_0016.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0016_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long st_io_0016_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/st_io_0016.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/st_io_0016.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/st_io_0016.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from st_io_0016_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/st_io_0016.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0016_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/st_io_0016.pgc b/app/dbio/st_io_0016.pgc new file mode 100644 index 0000000..9f87959 --- /dev/null +++ b/app/dbio/st_io_0016.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module st @transform settlement-dbio */ +/* + * st_io_0016.pgc - 정산수수료 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "st_io_0016.h" + +EXEC SQL INCLUDE sqlca; + +int st_io_0016_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM st_io_0016_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0016_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int st_io_0016_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE st_io_0016_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0016_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long st_io_0016_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM st_io_0016_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0016_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/st_io_0017.c b/app/dbio/st_io_0017.c new file mode 100644 index 0000000..3eaaec9 --- /dev/null +++ b/app/dbio/st_io_0017.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/st_io_0017.pgc" +/* @tier easy @module st @transform settlement-dbio */ +/* + * st_io_0017.pgc - 정산수수료 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "st_io_0017.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/st_io_0017.pgc" + + +int st_io_0017_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/st_io_0017.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/st_io_0017.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/st_io_0017.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from st_io_0017_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/st_io_0017.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0017_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int st_io_0017_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/st_io_0017.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/st_io_0017.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/st_io_0017.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update st_io_0017_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/st_io_0017.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0017_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long st_io_0017_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/st_io_0017.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/st_io_0017.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/st_io_0017.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from st_io_0017_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/st_io_0017.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0017_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/st_io_0017.pgc b/app/dbio/st_io_0017.pgc new file mode 100644 index 0000000..1cfbeac --- /dev/null +++ b/app/dbio/st_io_0017.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module st @transform settlement-dbio */ +/* + * st_io_0017.pgc - 정산수수료 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "st_io_0017.h" + +EXEC SQL INCLUDE sqlca; + +int st_io_0017_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM st_io_0017_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0017_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int st_io_0017_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE st_io_0017_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0017_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long st_io_0017_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM st_io_0017_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0017_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/st_io_0018.c b/app/dbio/st_io_0018.c new file mode 100644 index 0000000..f3fbaef --- /dev/null +++ b/app/dbio/st_io_0018.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/st_io_0018.pgc" +/* @tier medium @module st @transform settlement-dbio */ +/* + * st_io_0018.pgc - 정산수수료 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "st_io_0018.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/st_io_0018.pgc" + + +int st_io_0018_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/st_io_0018.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/st_io_0018.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/st_io_0018.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from st_io_0018_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/st_io_0018.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0018_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int st_io_0018_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/st_io_0018.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/st_io_0018.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/st_io_0018.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update st_io_0018_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/st_io_0018.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0018_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long st_io_0018_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/st_io_0018.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/st_io_0018.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/st_io_0018.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from st_io_0018_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/st_io_0018.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0018_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/st_io_0018.pgc b/app/dbio/st_io_0018.pgc new file mode 100644 index 0000000..67bcfe4 --- /dev/null +++ b/app/dbio/st_io_0018.pgc @@ -0,0 +1,92 @@ +/* @tier medium @module st @transform settlement-dbio */ +/* + * st_io_0018.pgc - 정산수수료 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "st_io_0018.h" + +EXEC SQL INCLUDE sqlca; + +int st_io_0018_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM st_io_0018_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0018_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int st_io_0018_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE st_io_0018_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0018_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long st_io_0018_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM st_io_0018_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0018_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/st_io_0019.c b/app/dbio/st_io_0019.c new file mode 100644 index 0000000..b233995 --- /dev/null +++ b/app/dbio/st_io_0019.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/st_io_0019.pgc" +/* @tier easy @module st @transform settlement-dbio */ +/* + * st_io_0019.pgc - 정산수수료 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "st_io_0019.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/st_io_0019.pgc" + + +int st_io_0019_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/st_io_0019.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/st_io_0019.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/st_io_0019.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from st_io_0019_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/st_io_0019.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0019_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int st_io_0019_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/st_io_0019.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/st_io_0019.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/st_io_0019.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update st_io_0019_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/st_io_0019.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0019_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long st_io_0019_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/st_io_0019.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/st_io_0019.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/st_io_0019.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from st_io_0019_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/st_io_0019.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0019_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/st_io_0019.pgc b/app/dbio/st_io_0019.pgc new file mode 100644 index 0000000..f85821b --- /dev/null +++ b/app/dbio/st_io_0019.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module st @transform settlement-dbio */ +/* + * st_io_0019.pgc - 정산수수료 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "st_io_0019.h" + +EXEC SQL INCLUDE sqlca; + +int st_io_0019_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM st_io_0019_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0019_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int st_io_0019_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE st_io_0019_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0019_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long st_io_0019_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM st_io_0019_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0019_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/st_io_0020.c b/app/dbio/st_io_0020.c new file mode 100644 index 0000000..eb10a27 --- /dev/null +++ b/app/dbio/st_io_0020.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/st_io_0020.pgc" +/* @tier medium @module st @transform settlement-dbio */ +/* + * st_io_0020.pgc - 정산수수료 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "st_io_0020.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/st_io_0020.pgc" + + +int st_io_0020_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/st_io_0020.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/st_io_0020.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/st_io_0020.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from st_io_0020_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/st_io_0020.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0020_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int st_io_0020_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/st_io_0020.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/st_io_0020.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/st_io_0020.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update st_io_0020_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/st_io_0020.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0020_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long st_io_0020_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/st_io_0020.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/st_io_0020.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/st_io_0020.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from st_io_0020_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/st_io_0020.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0020_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/st_io_0020.pgc b/app/dbio/st_io_0020.pgc new file mode 100644 index 0000000..eb2d075 --- /dev/null +++ b/app/dbio/st_io_0020.pgc @@ -0,0 +1,92 @@ +/* @tier medium @module st @transform settlement-dbio */ +/* + * st_io_0020.pgc - 정산수수료 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "st_io_0020.h" + +EXEC SQL INCLUDE sqlca; + +int st_io_0020_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM st_io_0020_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0020_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int st_io_0020_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE st_io_0020_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0020_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long st_io_0020_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM st_io_0020_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0020_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/st_io_0021.c b/app/dbio/st_io_0021.c new file mode 100644 index 0000000..348486a --- /dev/null +++ b/app/dbio/st_io_0021.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/st_io_0021.pgc" +/* @tier easy @module st @transform settlement-dbio */ +/* + * st_io_0021.pgc - 정산수수료 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "st_io_0021.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/st_io_0021.pgc" + + +int st_io_0021_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/st_io_0021.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/st_io_0021.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/st_io_0021.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from st_io_0021_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/st_io_0021.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0021_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int st_io_0021_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/st_io_0021.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/st_io_0021.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/st_io_0021.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update st_io_0021_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/st_io_0021.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0021_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long st_io_0021_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/st_io_0021.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/st_io_0021.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/st_io_0021.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from st_io_0021_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/st_io_0021.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0021_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/st_io_0021.pgc b/app/dbio/st_io_0021.pgc new file mode 100644 index 0000000..c0d7b7f --- /dev/null +++ b/app/dbio/st_io_0021.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module st @transform settlement-dbio */ +/* + * st_io_0021.pgc - 정산수수료 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "st_io_0021.h" + +EXEC SQL INCLUDE sqlca; + +int st_io_0021_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM st_io_0021_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0021_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int st_io_0021_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE st_io_0021_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0021_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long st_io_0021_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM st_io_0021_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0021_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/st_io_0022.c b/app/dbio/st_io_0022.c new file mode 100644 index 0000000..e1eae18 --- /dev/null +++ b/app/dbio/st_io_0022.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/st_io_0022.pgc" +/* @tier medium @module st @transform settlement-dbio */ +/* + * st_io_0022.pgc - 정산수수료 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "st_io_0022.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/st_io_0022.pgc" + + +int st_io_0022_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/st_io_0022.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/st_io_0022.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/st_io_0022.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from st_io_0022_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/st_io_0022.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0022_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int st_io_0022_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/st_io_0022.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/st_io_0022.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/st_io_0022.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update st_io_0022_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/st_io_0022.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0022_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long st_io_0022_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/st_io_0022.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/st_io_0022.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/st_io_0022.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from st_io_0022_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/st_io_0022.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0022_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/st_io_0022.pgc b/app/dbio/st_io_0022.pgc new file mode 100644 index 0000000..7b64d59 --- /dev/null +++ b/app/dbio/st_io_0022.pgc @@ -0,0 +1,92 @@ +/* @tier medium @module st @transform settlement-dbio */ +/* + * st_io_0022.pgc - 정산수수료 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "st_io_0022.h" + +EXEC SQL INCLUDE sqlca; + +int st_io_0022_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM st_io_0022_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0022_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int st_io_0022_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE st_io_0022_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0022_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long st_io_0022_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM st_io_0022_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0022_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/st_io_0023.c b/app/dbio/st_io_0023.c new file mode 100644 index 0000000..af61409 --- /dev/null +++ b/app/dbio/st_io_0023.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/st_io_0023.pgc" +/* @tier easy @module st @transform settlement-dbio */ +/* + * st_io_0023.pgc - 정산수수료 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "st_io_0023.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/st_io_0023.pgc" + + +int st_io_0023_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/st_io_0023.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/st_io_0023.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/st_io_0023.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from st_io_0023_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/st_io_0023.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0023_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int st_io_0023_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/st_io_0023.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/st_io_0023.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/st_io_0023.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update st_io_0023_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/st_io_0023.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0023_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long st_io_0023_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/st_io_0023.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/st_io_0023.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/st_io_0023.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from st_io_0023_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/st_io_0023.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0023_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/st_io_0023.pgc b/app/dbio/st_io_0023.pgc new file mode 100644 index 0000000..468d572 --- /dev/null +++ b/app/dbio/st_io_0023.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module st @transform settlement-dbio */ +/* + * st_io_0023.pgc - 정산수수료 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "st_io_0023.h" + +EXEC SQL INCLUDE sqlca; + +int st_io_0023_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM st_io_0023_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0023_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int st_io_0023_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE st_io_0023_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0023_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long st_io_0023_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM st_io_0023_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0023_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/st_io_0024.c b/app/dbio/st_io_0024.c new file mode 100644 index 0000000..6f94a9e --- /dev/null +++ b/app/dbio/st_io_0024.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/st_io_0024.pgc" +/* @tier hard @module st @transform settlement-dbio */ +/* + * st_io_0024.pgc - 정산수수료 보조 DBIO (ECPG) [tier=hard] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "st_io_0024.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/st_io_0024.pgc" + + +int st_io_0024_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/st_io_0024.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/st_io_0024.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/st_io_0024.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from st_io_0024_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/st_io_0024.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0024_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int st_io_0024_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/st_io_0024.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/st_io_0024.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/st_io_0024.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update st_io_0024_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/st_io_0024.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0024_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long st_io_0024_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/st_io_0024.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/st_io_0024.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/st_io_0024.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from st_io_0024_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/st_io_0024.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0024_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/st_io_0024.pgc b/app/dbio/st_io_0024.pgc new file mode 100644 index 0000000..c1f57b9 --- /dev/null +++ b/app/dbio/st_io_0024.pgc @@ -0,0 +1,92 @@ +/* @tier hard @module st @transform settlement-dbio */ +/* + * st_io_0024.pgc - 정산수수료 보조 DBIO (ECPG) [tier=hard] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "st_io_0024.h" + +EXEC SQL INCLUDE sqlca; + +int st_io_0024_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM st_io_0024_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0024_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int st_io_0024_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE st_io_0024_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0024_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long st_io_0024_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM st_io_0024_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0024_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/st_io_0025.c b/app/dbio/st_io_0025.c new file mode 100644 index 0000000..21ce098 --- /dev/null +++ b/app/dbio/st_io_0025.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/st_io_0025.pgc" +/* @tier easy @module st @transform settlement-dbio */ +/* + * st_io_0025.pgc - 정산수수료 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "st_io_0025.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/st_io_0025.pgc" + + +int st_io_0025_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/st_io_0025.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/st_io_0025.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/st_io_0025.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from st_io_0025_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/st_io_0025.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0025_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int st_io_0025_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/st_io_0025.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/st_io_0025.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/st_io_0025.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update st_io_0025_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/st_io_0025.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0025_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long st_io_0025_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/st_io_0025.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/st_io_0025.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/st_io_0025.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from st_io_0025_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/st_io_0025.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0025_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/st_io_0025.pgc b/app/dbio/st_io_0025.pgc new file mode 100644 index 0000000..bd95ebb --- /dev/null +++ b/app/dbio/st_io_0025.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module st @transform settlement-dbio */ +/* + * st_io_0025.pgc - 정산수수료 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "st_io_0025.h" + +EXEC SQL INCLUDE sqlca; + +int st_io_0025_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM st_io_0025_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0025_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int st_io_0025_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE st_io_0025_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0025_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long st_io_0025_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM st_io_0025_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0025_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/st_io_0026.c b/app/dbio/st_io_0026.c new file mode 100644 index 0000000..2aa550e --- /dev/null +++ b/app/dbio/st_io_0026.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/st_io_0026.pgc" +/* @tier easy @module st @transform settlement-dbio */ +/* + * st_io_0026.pgc - 정산수수료 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "st_io_0026.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/st_io_0026.pgc" + + +int st_io_0026_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/st_io_0026.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/st_io_0026.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/st_io_0026.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from st_io_0026_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/st_io_0026.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0026_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int st_io_0026_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/st_io_0026.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/st_io_0026.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/st_io_0026.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update st_io_0026_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/st_io_0026.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0026_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long st_io_0026_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/st_io_0026.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/st_io_0026.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/st_io_0026.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from st_io_0026_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/st_io_0026.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0026_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/st_io_0026.pgc b/app/dbio/st_io_0026.pgc new file mode 100644 index 0000000..4d6d4d4 --- /dev/null +++ b/app/dbio/st_io_0026.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module st @transform settlement-dbio */ +/* + * st_io_0026.pgc - 정산수수료 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "st_io_0026.h" + +EXEC SQL INCLUDE sqlca; + +int st_io_0026_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM st_io_0026_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0026_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int st_io_0026_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE st_io_0026_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0026_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long st_io_0026_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM st_io_0026_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("st_io_0026_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/vl_dbio_main.c b/app/dbio/vl_dbio_main.c new file mode 100644 index 0000000..b19324b --- /dev/null +++ b/app/dbio/vl_dbio_main.c @@ -0,0 +1,399 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/vl_dbio_main.pgc" +/* @tier medium @module vl @transform validation-dbio */ +/* + * vl_dbio_main.pgc - 정합성 표준 DBIO (ECPG 임베디드 SQL) + * + * vl_core.h 의 표준 API 를 vl_ledger 테이블에 대해 구현한다. + * 온라인/배치 프로그램은 이 함수들만 호출한다 (self-contained). + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "vl_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/dbio/vl_dbio_main.pgc" + + +int vl_dbio_connect(const char *target) +{ + /* exec sql begin declare section */ + + +#line 20 "app/dbio/vl_dbio_main.pgc" + const char * h_target ; +/* exec sql end declare section */ +#line 21 "app/dbio/vl_dbio_main.pgc" + + + h_target = (target && target[0]) ? target : "acquire@localhost"; + + { ECPGconnect(__LINE__, 0, h_target , NULL, NULL , NULL, 0); } +#line 25 "app/dbio/vl_dbio_main.pgc" + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl CONNECT"); + return TX_EDB; + } + tx_log(TX_LOG_INFO, "[vl] DB 접속 완료 target=%s", h_target); + return TX_OK; +} + +int vl_dbio_disconnect(void) +{ + { ECPGdisconnect(__LINE__, "CURRENT");} +#line 36 "app/dbio/vl_dbio_main.pgc" + + return TX_OK; +} + +int vl_rec_insert(const vl_rec_t *rec) +{ + /* exec sql begin declare section */ + + + + + + + + +#line 43 "app/dbio/vl_dbio_main.pgc" + char h_key [ 16 ] ; + +#line 44 "app/dbio/vl_dbio_main.pgc" + char h_merch_id [ 16 ] ; + +#line 45 "app/dbio/vl_dbio_main.pgc" + char h_card_no [ 20 ] ; + +#line 46 "app/dbio/vl_dbio_main.pgc" + long h_amount ; + +#line 47 "app/dbio/vl_dbio_main.pgc" + char h_biz_date [ 9 ] ; + +#line 48 "app/dbio/vl_dbio_main.pgc" + char h_status [ 2 ] ; + +#line 49 "app/dbio/vl_dbio_main.pgc" + long h_fee ; +/* exec sql end declare section */ +#line 50 "app/dbio/vl_dbio_main.pgc" + + + if (!rec) + return TX_EINVAL; + + strncpy(h_key, rec->key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + strncpy(h_merch_id, rec->merch_id, sizeof(h_merch_id) - 1); + h_merch_id[sizeof(h_merch_id) - 1] = '\0'; + strncpy(h_card_no, rec->card_no, sizeof(h_card_no) - 1); + h_card_no[sizeof(h_card_no) - 1] = '\0'; + strncpy(h_biz_date, rec->biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + strncpy(h_status, rec->status, sizeof(h_status) - 1); + h_status[sizeof(h_status) - 1] = '\0'; + h_amount = rec->amount; + h_fee = rec->fee; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into vl_ledger ( key , merch_id , card_no , amount , biz_date , status , fee ) values ( $1 , $2 , $3 , $4 , $5 , $6 , $7 )", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_card_no),(long)20,(long)1,(20)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_status),(long)2,(long)1,(2)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_fee),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 71 "app/dbio/vl_dbio_main.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_rec_insert"); + return TX_EDB; + } + return TX_OK; +} + +int vl_rec_select(const char *key, vl_rec_t *out) +{ + /* exec sql begin declare section */ + + + + + + + + +#line 83 "app/dbio/vl_dbio_main.pgc" + char h_key [ 16 ] ; + +#line 84 "app/dbio/vl_dbio_main.pgc" + char h_merch_id [ 16 ] ; + +#line 85 "app/dbio/vl_dbio_main.pgc" + char h_card_no [ 20 ] ; + +#line 86 "app/dbio/vl_dbio_main.pgc" + long h_amount ; + +#line 87 "app/dbio/vl_dbio_main.pgc" + char h_biz_date [ 9 ] ; + +#line 88 "app/dbio/vl_dbio_main.pgc" + char h_status [ 2 ] ; + +#line 89 "app/dbio/vl_dbio_main.pgc" + long h_fee ; +/* exec sql end declare section */ +#line 90 "app/dbio/vl_dbio_main.pgc" + + + if (!key || !out) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select merch_id , card_no , amount , biz_date , status , fee from vl_ledger where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_card_no),(long)20,(long)1,(20)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_status),(long)2,(long)1,(2)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_long,&(h_fee),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 101 "app/dbio/vl_dbio_main.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_rec_select"); + return TX_EDB; + } + + memset(out, 0, sizeof(*out)); + strncpy(out->key, h_key, sizeof(out->key) - 1); + strncpy(out->merch_id, h_merch_id, sizeof(out->merch_id) - 1); + strncpy(out->card_no, h_card_no, sizeof(out->card_no) - 1); + strncpy(out->biz_date, h_biz_date, sizeof(out->biz_date) - 1); + strncpy(out->status, h_status, sizeof(out->status) - 1); + out->amount = h_amount; + out->fee = h_fee; + return TX_OK; +} + +int vl_rec_update_status(const char *key, const char *status) +{ + /* exec sql begin declare section */ + + + +#line 124 "app/dbio/vl_dbio_main.pgc" + char h_key [ 16 ] ; + +#line 125 "app/dbio/vl_dbio_main.pgc" + char h_status [ 2 ] ; +/* exec sql end declare section */ +#line 126 "app/dbio/vl_dbio_main.pgc" + + + if (!key || !status) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + strncpy(h_status, status, sizeof(h_status) - 1); + h_status[sizeof(h_status) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update vl_ledger set status = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_char,(h_status),(long)2,(long)1,(2)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 138 "app/dbio/vl_dbio_main.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_rec_update_status"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long vl_rec_count(const char *biz_date, const char *status) +{ + /* exec sql begin declare section */ + + + + +#line 152 "app/dbio/vl_dbio_main.pgc" + char h_biz_date [ 9 ] ; + +#line 153 "app/dbio/vl_dbio_main.pgc" + char h_status [ 2 ] ; + +#line 154 "app/dbio/vl_dbio_main.pgc" + int h_cnt ; +/* exec sql end declare section */ +#line 155 "app/dbio/vl_dbio_main.pgc" + + + if (!biz_date || !status) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + strncpy(h_status, status, sizeof(h_status) - 1); + h_status[sizeof(h_status) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select count ( * ) from vl_ledger where biz_date = $1 and status = $2 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_status),(long)2,(long)1,(2)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_int,&(h_cnt),(long)1,(long)1,sizeof(int), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 169 "app/dbio/vl_dbio_main.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_rec_count"); + return -1; + } + return (long)h_cnt; +} + +int vl_rec_sum(const char *biz_date, long *out_sum) +{ + /* exec sql begin declare section */ + + + +#line 181 "app/dbio/vl_dbio_main.pgc" + char h_biz_date [ 9 ] ; + +#line 182 "app/dbio/vl_dbio_main.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 183 "app/dbio/vl_dbio_main.pgc" + + + if (!biz_date || !out_sum) + return TX_EINVAL; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from vl_ledger where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 194 "app/dbio/vl_dbio_main.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_rec_sum"); + return TX_EDB; + } + *out_sum = h_sum; + return TX_OK; +} diff --git a/app/dbio/vl_dbio_main.pgc b/app/dbio/vl_dbio_main.pgc new file mode 100644 index 0000000..e9ca561 --- /dev/null +++ b/app/dbio/vl_dbio_main.pgc @@ -0,0 +1,202 @@ +/* @tier medium @module vl @transform validation-dbio */ +/* + * vl_dbio_main.pgc - 정합성 표준 DBIO (ECPG 임베디드 SQL) + * + * vl_core.h 의 표준 API 를 vl_ledger 테이블에 대해 구현한다. + * 온라인/배치 프로그램은 이 함수들만 호출한다 (self-contained). + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "vl_core.h" + +EXEC SQL INCLUDE sqlca; + +int vl_dbio_connect(const char *target) +{ + EXEC SQL BEGIN DECLARE SECTION; + const char *h_target; + EXEC SQL END DECLARE SECTION; + + h_target = (target && target[0]) ? target : "acquire@localhost"; + + EXEC SQL CONNECT TO :h_target; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl CONNECT"); + return TX_EDB; + } + tx_log(TX_LOG_INFO, "[vl] DB 접속 완료 target=%s", h_target); + return TX_OK; +} + +int vl_dbio_disconnect(void) +{ + EXEC SQL DISCONNECT CURRENT; + return TX_OK; +} + +int vl_rec_insert(const vl_rec_t *rec) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + char h_merch_id[16]; + char h_card_no[20]; + long h_amount; + char h_biz_date[9]; + char h_status[2]; + long h_fee; + EXEC SQL END DECLARE SECTION; + + if (!rec) + return TX_EINVAL; + + strncpy(h_key, rec->key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + strncpy(h_merch_id, rec->merch_id, sizeof(h_merch_id) - 1); + h_merch_id[sizeof(h_merch_id) - 1] = '\0'; + strncpy(h_card_no, rec->card_no, sizeof(h_card_no) - 1); + h_card_no[sizeof(h_card_no) - 1] = '\0'; + strncpy(h_biz_date, rec->biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + strncpy(h_status, rec->status, sizeof(h_status) - 1); + h_status[sizeof(h_status) - 1] = '\0'; + h_amount = rec->amount; + h_fee = rec->fee; + + EXEC SQL INSERT INTO vl_ledger + (key, merch_id, card_no, amount, biz_date, status, fee) + VALUES + (:h_key, :h_merch_id, :h_card_no, :h_amount, :h_biz_date, :h_status, :h_fee); + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_rec_insert"); + return TX_EDB; + } + return TX_OK; +} + +int vl_rec_select(const char *key, vl_rec_t *out) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + char h_merch_id[16]; + char h_card_no[20]; + long h_amount; + char h_biz_date[9]; + char h_status[2]; + long h_fee; + EXEC SQL END DECLARE SECTION; + + if (!key || !out) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT merch_id, card_no, amount, biz_date, status, fee + INTO :h_merch_id, :h_card_no, :h_amount, :h_biz_date, :h_status, :h_fee + FROM vl_ledger + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_rec_select"); + return TX_EDB; + } + + memset(out, 0, sizeof(*out)); + strncpy(out->key, h_key, sizeof(out->key) - 1); + strncpy(out->merch_id, h_merch_id, sizeof(out->merch_id) - 1); + strncpy(out->card_no, h_card_no, sizeof(out->card_no) - 1); + strncpy(out->biz_date, h_biz_date, sizeof(out->biz_date) - 1); + strncpy(out->status, h_status, sizeof(out->status) - 1); + out->amount = h_amount; + out->fee = h_fee; + return TX_OK; +} + +int vl_rec_update_status(const char *key, const char *status) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + char h_status[2]; + EXEC SQL END DECLARE SECTION; + + if (!key || !status) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + strncpy(h_status, status, sizeof(h_status) - 1); + h_status[sizeof(h_status) - 1] = '\0'; + + EXEC SQL UPDATE vl_ledger + SET status = :h_status, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_rec_update_status"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long vl_rec_count(const char *biz_date, const char *status) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_status[2]; + int h_cnt; + EXEC SQL END DECLARE SECTION; + + if (!biz_date || !status) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + strncpy(h_status, status, sizeof(h_status) - 1); + h_status[sizeof(h_status) - 1] = '\0'; + + EXEC SQL SELECT count(*) + INTO :h_cnt + FROM vl_ledger + WHERE biz_date = :h_biz_date + AND status = :h_status; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_rec_count"); + return -1; + } + return (long)h_cnt; +} + +int vl_rec_sum(const char *biz_date, long *out_sum) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date || !out_sum) + return TX_EINVAL; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM vl_ledger + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_rec_sum"); + return TX_EDB; + } + *out_sum = h_sum; + return TX_OK; +} diff --git a/app/dbio/vl_io_0001.c b/app/dbio/vl_io_0001.c new file mode 100644 index 0000000..2db75e1 --- /dev/null +++ b/app/dbio/vl_io_0001.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/vl_io_0001.pgc" +/* @tier easy @module vl @transform validation-dbio */ +/* + * vl_io_0001.pgc - 정합성 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "vl_io_0001.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/vl_io_0001.pgc" + + +int vl_io_0001_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/vl_io_0001.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/vl_io_0001.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/vl_io_0001.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from vl_io_0001_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/vl_io_0001.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0001_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int vl_io_0001_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/vl_io_0001.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/vl_io_0001.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/vl_io_0001.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update vl_io_0001_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/vl_io_0001.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0001_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long vl_io_0001_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/vl_io_0001.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/vl_io_0001.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/vl_io_0001.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from vl_io_0001_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/vl_io_0001.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0001_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/vl_io_0001.pgc b/app/dbio/vl_io_0001.pgc new file mode 100644 index 0000000..aa92fb3 --- /dev/null +++ b/app/dbio/vl_io_0001.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module vl @transform validation-dbio */ +/* + * vl_io_0001.pgc - 정합성 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "vl_io_0001.h" + +EXEC SQL INCLUDE sqlca; + +int vl_io_0001_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM vl_io_0001_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0001_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int vl_io_0001_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE vl_io_0001_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0001_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long vl_io_0001_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM vl_io_0001_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0001_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/vl_io_0002.c b/app/dbio/vl_io_0002.c new file mode 100644 index 0000000..86431a3 --- /dev/null +++ b/app/dbio/vl_io_0002.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/vl_io_0002.pgc" +/* @tier medium @module vl @transform validation-dbio */ +/* + * vl_io_0002.pgc - 정합성 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "vl_io_0002.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/vl_io_0002.pgc" + + +int vl_io_0002_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/vl_io_0002.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/vl_io_0002.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/vl_io_0002.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from vl_io_0002_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/vl_io_0002.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0002_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int vl_io_0002_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/vl_io_0002.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/vl_io_0002.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/vl_io_0002.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update vl_io_0002_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/vl_io_0002.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0002_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long vl_io_0002_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/vl_io_0002.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/vl_io_0002.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/vl_io_0002.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from vl_io_0002_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/vl_io_0002.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0002_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/vl_io_0002.pgc b/app/dbio/vl_io_0002.pgc new file mode 100644 index 0000000..d84bf22 --- /dev/null +++ b/app/dbio/vl_io_0002.pgc @@ -0,0 +1,92 @@ +/* @tier medium @module vl @transform validation-dbio */ +/* + * vl_io_0002.pgc - 정합성 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "vl_io_0002.h" + +EXEC SQL INCLUDE sqlca; + +int vl_io_0002_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM vl_io_0002_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0002_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int vl_io_0002_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE vl_io_0002_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0002_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long vl_io_0002_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM vl_io_0002_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0002_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/vl_io_0003.c b/app/dbio/vl_io_0003.c new file mode 100644 index 0000000..176ed11 --- /dev/null +++ b/app/dbio/vl_io_0003.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/vl_io_0003.pgc" +/* @tier easy @module vl @transform validation-dbio */ +/* + * vl_io_0003.pgc - 정합성 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "vl_io_0003.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/vl_io_0003.pgc" + + +int vl_io_0003_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/vl_io_0003.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/vl_io_0003.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/vl_io_0003.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from vl_io_0003_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/vl_io_0003.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0003_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int vl_io_0003_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/vl_io_0003.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/vl_io_0003.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/vl_io_0003.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update vl_io_0003_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/vl_io_0003.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0003_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long vl_io_0003_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/vl_io_0003.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/vl_io_0003.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/vl_io_0003.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from vl_io_0003_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/vl_io_0003.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0003_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/vl_io_0003.pgc b/app/dbio/vl_io_0003.pgc new file mode 100644 index 0000000..e2cb5a5 --- /dev/null +++ b/app/dbio/vl_io_0003.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module vl @transform validation-dbio */ +/* + * vl_io_0003.pgc - 정합성 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "vl_io_0003.h" + +EXEC SQL INCLUDE sqlca; + +int vl_io_0003_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM vl_io_0003_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0003_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int vl_io_0003_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE vl_io_0003_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0003_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long vl_io_0003_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM vl_io_0003_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0003_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/vl_io_0004.c b/app/dbio/vl_io_0004.c new file mode 100644 index 0000000..29f977b --- /dev/null +++ b/app/dbio/vl_io_0004.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/vl_io_0004.pgc" +/* @tier hard @module vl @transform validation-dbio */ +/* + * vl_io_0004.pgc - 정합성 보조 DBIO (ECPG) [tier=hard] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "vl_io_0004.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/vl_io_0004.pgc" + + +int vl_io_0004_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/vl_io_0004.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/vl_io_0004.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/vl_io_0004.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from vl_io_0004_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/vl_io_0004.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0004_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int vl_io_0004_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/vl_io_0004.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/vl_io_0004.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/vl_io_0004.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update vl_io_0004_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/vl_io_0004.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0004_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long vl_io_0004_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/vl_io_0004.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/vl_io_0004.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/vl_io_0004.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from vl_io_0004_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/vl_io_0004.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0004_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/vl_io_0004.pgc b/app/dbio/vl_io_0004.pgc new file mode 100644 index 0000000..ff1811c --- /dev/null +++ b/app/dbio/vl_io_0004.pgc @@ -0,0 +1,92 @@ +/* @tier hard @module vl @transform validation-dbio */ +/* + * vl_io_0004.pgc - 정합성 보조 DBIO (ECPG) [tier=hard] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "vl_io_0004.h" + +EXEC SQL INCLUDE sqlca; + +int vl_io_0004_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM vl_io_0004_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0004_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int vl_io_0004_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE vl_io_0004_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0004_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long vl_io_0004_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM vl_io_0004_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0004_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/vl_io_0005.c b/app/dbio/vl_io_0005.c new file mode 100644 index 0000000..c0bc1bf --- /dev/null +++ b/app/dbio/vl_io_0005.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/vl_io_0005.pgc" +/* @tier easy @module vl @transform validation-dbio */ +/* + * vl_io_0005.pgc - 정합성 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "vl_io_0005.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/vl_io_0005.pgc" + + +int vl_io_0005_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/vl_io_0005.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/vl_io_0005.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/vl_io_0005.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from vl_io_0005_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/vl_io_0005.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0005_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int vl_io_0005_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/vl_io_0005.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/vl_io_0005.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/vl_io_0005.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update vl_io_0005_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/vl_io_0005.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0005_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long vl_io_0005_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/vl_io_0005.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/vl_io_0005.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/vl_io_0005.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from vl_io_0005_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/vl_io_0005.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0005_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/vl_io_0005.pgc b/app/dbio/vl_io_0005.pgc new file mode 100644 index 0000000..cbe3622 --- /dev/null +++ b/app/dbio/vl_io_0005.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module vl @transform validation-dbio */ +/* + * vl_io_0005.pgc - 정합성 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "vl_io_0005.h" + +EXEC SQL INCLUDE sqlca; + +int vl_io_0005_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM vl_io_0005_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0005_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int vl_io_0005_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE vl_io_0005_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0005_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long vl_io_0005_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM vl_io_0005_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0005_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/vl_io_0006.c b/app/dbio/vl_io_0006.c new file mode 100644 index 0000000..855fa67 --- /dev/null +++ b/app/dbio/vl_io_0006.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/vl_io_0006.pgc" +/* @tier hard @module vl @transform validation-dbio */ +/* + * vl_io_0006.pgc - 정합성 보조 DBIO (ECPG) [tier=hard] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "vl_io_0006.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/vl_io_0006.pgc" + + +int vl_io_0006_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/vl_io_0006.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/vl_io_0006.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/vl_io_0006.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from vl_io_0006_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/vl_io_0006.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0006_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int vl_io_0006_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/vl_io_0006.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/vl_io_0006.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/vl_io_0006.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update vl_io_0006_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/vl_io_0006.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0006_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long vl_io_0006_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/vl_io_0006.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/vl_io_0006.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/vl_io_0006.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from vl_io_0006_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/vl_io_0006.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0006_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/vl_io_0006.pgc b/app/dbio/vl_io_0006.pgc new file mode 100644 index 0000000..7e7d24b --- /dev/null +++ b/app/dbio/vl_io_0006.pgc @@ -0,0 +1,92 @@ +/* @tier hard @module vl @transform validation-dbio */ +/* + * vl_io_0006.pgc - 정합성 보조 DBIO (ECPG) [tier=hard] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "vl_io_0006.h" + +EXEC SQL INCLUDE sqlca; + +int vl_io_0006_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM vl_io_0006_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0006_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int vl_io_0006_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE vl_io_0006_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0006_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long vl_io_0006_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM vl_io_0006_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0006_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/vl_io_0007.c b/app/dbio/vl_io_0007.c new file mode 100644 index 0000000..45b2d08 --- /dev/null +++ b/app/dbio/vl_io_0007.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/vl_io_0007.pgc" +/* @tier easy @module vl @transform validation-dbio */ +/* + * vl_io_0007.pgc - 정합성 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "vl_io_0007.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/vl_io_0007.pgc" + + +int vl_io_0007_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/vl_io_0007.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/vl_io_0007.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/vl_io_0007.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from vl_io_0007_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/vl_io_0007.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0007_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int vl_io_0007_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/vl_io_0007.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/vl_io_0007.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/vl_io_0007.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update vl_io_0007_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/vl_io_0007.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0007_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long vl_io_0007_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/vl_io_0007.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/vl_io_0007.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/vl_io_0007.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from vl_io_0007_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/vl_io_0007.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0007_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/vl_io_0007.pgc b/app/dbio/vl_io_0007.pgc new file mode 100644 index 0000000..4471c3b --- /dev/null +++ b/app/dbio/vl_io_0007.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module vl @transform validation-dbio */ +/* + * vl_io_0007.pgc - 정합성 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "vl_io_0007.h" + +EXEC SQL INCLUDE sqlca; + +int vl_io_0007_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM vl_io_0007_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0007_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int vl_io_0007_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE vl_io_0007_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0007_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long vl_io_0007_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM vl_io_0007_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0007_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/vl_io_0008.c b/app/dbio/vl_io_0008.c new file mode 100644 index 0000000..f5b81f7 --- /dev/null +++ b/app/dbio/vl_io_0008.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/vl_io_0008.pgc" +/* @tier easy @module vl @transform validation-dbio */ +/* + * vl_io_0008.pgc - 정합성 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "vl_io_0008.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/vl_io_0008.pgc" + + +int vl_io_0008_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/vl_io_0008.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/vl_io_0008.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/vl_io_0008.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from vl_io_0008_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/vl_io_0008.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0008_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int vl_io_0008_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/vl_io_0008.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/vl_io_0008.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/vl_io_0008.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update vl_io_0008_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/vl_io_0008.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0008_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long vl_io_0008_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/vl_io_0008.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/vl_io_0008.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/vl_io_0008.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from vl_io_0008_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/vl_io_0008.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0008_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/vl_io_0008.pgc b/app/dbio/vl_io_0008.pgc new file mode 100644 index 0000000..db9eab6 --- /dev/null +++ b/app/dbio/vl_io_0008.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module vl @transform validation-dbio */ +/* + * vl_io_0008.pgc - 정합성 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "vl_io_0008.h" + +EXEC SQL INCLUDE sqlca; + +int vl_io_0008_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM vl_io_0008_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0008_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int vl_io_0008_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE vl_io_0008_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0008_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long vl_io_0008_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM vl_io_0008_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0008_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/vl_io_0009.c b/app/dbio/vl_io_0009.c new file mode 100644 index 0000000..022f909 --- /dev/null +++ b/app/dbio/vl_io_0009.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/vl_io_0009.pgc" +/* @tier medium @module vl @transform validation-dbio */ +/* + * vl_io_0009.pgc - 정합성 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "vl_io_0009.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/vl_io_0009.pgc" + + +int vl_io_0009_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/vl_io_0009.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/vl_io_0009.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/vl_io_0009.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from vl_io_0009_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/vl_io_0009.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0009_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int vl_io_0009_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/vl_io_0009.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/vl_io_0009.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/vl_io_0009.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update vl_io_0009_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/vl_io_0009.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0009_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long vl_io_0009_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/vl_io_0009.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/vl_io_0009.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/vl_io_0009.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from vl_io_0009_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/vl_io_0009.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0009_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/vl_io_0009.pgc b/app/dbio/vl_io_0009.pgc new file mode 100644 index 0000000..1f184e1 --- /dev/null +++ b/app/dbio/vl_io_0009.pgc @@ -0,0 +1,92 @@ +/* @tier medium @module vl @transform validation-dbio */ +/* + * vl_io_0009.pgc - 정합성 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "vl_io_0009.h" + +EXEC SQL INCLUDE sqlca; + +int vl_io_0009_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM vl_io_0009_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0009_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int vl_io_0009_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE vl_io_0009_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0009_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long vl_io_0009_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM vl_io_0009_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0009_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/vl_io_0010.c b/app/dbio/vl_io_0010.c new file mode 100644 index 0000000..2f15f59 --- /dev/null +++ b/app/dbio/vl_io_0010.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/vl_io_0010.pgc" +/* @tier easy @module vl @transform validation-dbio */ +/* + * vl_io_0010.pgc - 정합성 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "vl_io_0010.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/vl_io_0010.pgc" + + +int vl_io_0010_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/vl_io_0010.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/vl_io_0010.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/vl_io_0010.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from vl_io_0010_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/vl_io_0010.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0010_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int vl_io_0010_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/vl_io_0010.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/vl_io_0010.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/vl_io_0010.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update vl_io_0010_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/vl_io_0010.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0010_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long vl_io_0010_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/vl_io_0010.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/vl_io_0010.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/vl_io_0010.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from vl_io_0010_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/vl_io_0010.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0010_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/vl_io_0010.pgc b/app/dbio/vl_io_0010.pgc new file mode 100644 index 0000000..5edf017 --- /dev/null +++ b/app/dbio/vl_io_0010.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module vl @transform validation-dbio */ +/* + * vl_io_0010.pgc - 정합성 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "vl_io_0010.h" + +EXEC SQL INCLUDE sqlca; + +int vl_io_0010_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM vl_io_0010_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0010_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int vl_io_0010_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE vl_io_0010_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0010_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long vl_io_0010_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM vl_io_0010_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0010_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/vl_io_0011.c b/app/dbio/vl_io_0011.c new file mode 100644 index 0000000..b066a05 --- /dev/null +++ b/app/dbio/vl_io_0011.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/vl_io_0011.pgc" +/* @tier medium @module vl @transform validation-dbio */ +/* + * vl_io_0011.pgc - 정합성 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "vl_io_0011.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/vl_io_0011.pgc" + + +int vl_io_0011_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/vl_io_0011.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/vl_io_0011.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/vl_io_0011.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from vl_io_0011_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/vl_io_0011.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0011_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int vl_io_0011_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/vl_io_0011.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/vl_io_0011.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/vl_io_0011.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update vl_io_0011_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/vl_io_0011.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0011_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long vl_io_0011_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/vl_io_0011.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/vl_io_0011.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/vl_io_0011.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from vl_io_0011_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/vl_io_0011.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0011_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/vl_io_0011.pgc b/app/dbio/vl_io_0011.pgc new file mode 100644 index 0000000..e8d2e88 --- /dev/null +++ b/app/dbio/vl_io_0011.pgc @@ -0,0 +1,92 @@ +/* @tier medium @module vl @transform validation-dbio */ +/* + * vl_io_0011.pgc - 정합성 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "vl_io_0011.h" + +EXEC SQL INCLUDE sqlca; + +int vl_io_0011_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM vl_io_0011_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0011_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int vl_io_0011_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE vl_io_0011_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0011_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long vl_io_0011_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM vl_io_0011_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0011_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/vl_io_0012.c b/app/dbio/vl_io_0012.c new file mode 100644 index 0000000..b1c5849 --- /dev/null +++ b/app/dbio/vl_io_0012.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/vl_io_0012.pgc" +/* @tier easy @module vl @transform validation-dbio */ +/* + * vl_io_0012.pgc - 정합성 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "vl_io_0012.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/vl_io_0012.pgc" + + +int vl_io_0012_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/vl_io_0012.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/vl_io_0012.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/vl_io_0012.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from vl_io_0012_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/vl_io_0012.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0012_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int vl_io_0012_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/vl_io_0012.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/vl_io_0012.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/vl_io_0012.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update vl_io_0012_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/vl_io_0012.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0012_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long vl_io_0012_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/vl_io_0012.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/vl_io_0012.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/vl_io_0012.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from vl_io_0012_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/vl_io_0012.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0012_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/vl_io_0012.pgc b/app/dbio/vl_io_0012.pgc new file mode 100644 index 0000000..4c27181 --- /dev/null +++ b/app/dbio/vl_io_0012.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module vl @transform validation-dbio */ +/* + * vl_io_0012.pgc - 정합성 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "vl_io_0012.h" + +EXEC SQL INCLUDE sqlca; + +int vl_io_0012_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM vl_io_0012_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0012_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int vl_io_0012_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE vl_io_0012_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0012_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long vl_io_0012_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM vl_io_0012_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0012_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/vl_io_0013.c b/app/dbio/vl_io_0013.c new file mode 100644 index 0000000..d4a4698 --- /dev/null +++ b/app/dbio/vl_io_0013.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/vl_io_0013.pgc" +/* @tier medium @module vl @transform validation-dbio */ +/* + * vl_io_0013.pgc - 정합성 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "vl_io_0013.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/vl_io_0013.pgc" + + +int vl_io_0013_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/vl_io_0013.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/vl_io_0013.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/vl_io_0013.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from vl_io_0013_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/vl_io_0013.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0013_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int vl_io_0013_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/vl_io_0013.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/vl_io_0013.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/vl_io_0013.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update vl_io_0013_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/vl_io_0013.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0013_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long vl_io_0013_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/vl_io_0013.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/vl_io_0013.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/vl_io_0013.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from vl_io_0013_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/vl_io_0013.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0013_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/vl_io_0013.pgc b/app/dbio/vl_io_0013.pgc new file mode 100644 index 0000000..043a320 --- /dev/null +++ b/app/dbio/vl_io_0013.pgc @@ -0,0 +1,92 @@ +/* @tier medium @module vl @transform validation-dbio */ +/* + * vl_io_0013.pgc - 정합성 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "vl_io_0013.h" + +EXEC SQL INCLUDE sqlca; + +int vl_io_0013_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM vl_io_0013_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0013_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int vl_io_0013_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE vl_io_0013_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0013_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long vl_io_0013_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM vl_io_0013_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0013_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/vl_io_0014.c b/app/dbio/vl_io_0014.c new file mode 100644 index 0000000..8f02dd0 --- /dev/null +++ b/app/dbio/vl_io_0014.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/vl_io_0014.pgc" +/* @tier easy @module vl @transform validation-dbio */ +/* + * vl_io_0014.pgc - 정합성 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "vl_io_0014.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/vl_io_0014.pgc" + + +int vl_io_0014_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/vl_io_0014.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/vl_io_0014.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/vl_io_0014.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from vl_io_0014_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/vl_io_0014.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0014_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int vl_io_0014_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/vl_io_0014.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/vl_io_0014.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/vl_io_0014.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update vl_io_0014_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/vl_io_0014.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0014_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long vl_io_0014_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/vl_io_0014.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/vl_io_0014.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/vl_io_0014.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from vl_io_0014_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/vl_io_0014.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0014_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/vl_io_0014.pgc b/app/dbio/vl_io_0014.pgc new file mode 100644 index 0000000..f509358 --- /dev/null +++ b/app/dbio/vl_io_0014.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module vl @transform validation-dbio */ +/* + * vl_io_0014.pgc - 정합성 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "vl_io_0014.h" + +EXEC SQL INCLUDE sqlca; + +int vl_io_0014_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM vl_io_0014_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0014_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int vl_io_0014_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE vl_io_0014_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0014_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long vl_io_0014_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM vl_io_0014_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0014_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/vl_io_0015.c b/app/dbio/vl_io_0015.c new file mode 100644 index 0000000..99b36d8 --- /dev/null +++ b/app/dbio/vl_io_0015.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/vl_io_0015.pgc" +/* @tier hard @module vl @transform validation-dbio */ +/* + * vl_io_0015.pgc - 정합성 보조 DBIO (ECPG) [tier=hard] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "vl_io_0015.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/vl_io_0015.pgc" + + +int vl_io_0015_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/vl_io_0015.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/vl_io_0015.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/vl_io_0015.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from vl_io_0015_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/vl_io_0015.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0015_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int vl_io_0015_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/vl_io_0015.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/vl_io_0015.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/vl_io_0015.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update vl_io_0015_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/vl_io_0015.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0015_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long vl_io_0015_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/vl_io_0015.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/vl_io_0015.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/vl_io_0015.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from vl_io_0015_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/vl_io_0015.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0015_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/vl_io_0015.pgc b/app/dbio/vl_io_0015.pgc new file mode 100644 index 0000000..deecead --- /dev/null +++ b/app/dbio/vl_io_0015.pgc @@ -0,0 +1,92 @@ +/* @tier hard @module vl @transform validation-dbio */ +/* + * vl_io_0015.pgc - 정합성 보조 DBIO (ECPG) [tier=hard] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "vl_io_0015.h" + +EXEC SQL INCLUDE sqlca; + +int vl_io_0015_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM vl_io_0015_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0015_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int vl_io_0015_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE vl_io_0015_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0015_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long vl_io_0015_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM vl_io_0015_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0015_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/vl_io_0016.c b/app/dbio/vl_io_0016.c new file mode 100644 index 0000000..2ec653d --- /dev/null +++ b/app/dbio/vl_io_0016.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/vl_io_0016.pgc" +/* @tier easy @module vl @transform validation-dbio */ +/* + * vl_io_0016.pgc - 정합성 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "vl_io_0016.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/vl_io_0016.pgc" + + +int vl_io_0016_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/vl_io_0016.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/vl_io_0016.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/vl_io_0016.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from vl_io_0016_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/vl_io_0016.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0016_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int vl_io_0016_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/vl_io_0016.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/vl_io_0016.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/vl_io_0016.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update vl_io_0016_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/vl_io_0016.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0016_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long vl_io_0016_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/vl_io_0016.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/vl_io_0016.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/vl_io_0016.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from vl_io_0016_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/vl_io_0016.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0016_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/vl_io_0016.pgc b/app/dbio/vl_io_0016.pgc new file mode 100644 index 0000000..928bc92 --- /dev/null +++ b/app/dbio/vl_io_0016.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module vl @transform validation-dbio */ +/* + * vl_io_0016.pgc - 정합성 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "vl_io_0016.h" + +EXEC SQL INCLUDE sqlca; + +int vl_io_0016_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM vl_io_0016_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0016_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int vl_io_0016_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE vl_io_0016_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0016_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long vl_io_0016_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM vl_io_0016_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0016_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/vl_io_0017.c b/app/dbio/vl_io_0017.c new file mode 100644 index 0000000..28570aa --- /dev/null +++ b/app/dbio/vl_io_0017.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/vl_io_0017.pgc" +/* @tier easy @module vl @transform validation-dbio */ +/* + * vl_io_0017.pgc - 정합성 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "vl_io_0017.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/vl_io_0017.pgc" + + +int vl_io_0017_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/vl_io_0017.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/vl_io_0017.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/vl_io_0017.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from vl_io_0017_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/vl_io_0017.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0017_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int vl_io_0017_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/vl_io_0017.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/vl_io_0017.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/vl_io_0017.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update vl_io_0017_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/vl_io_0017.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0017_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long vl_io_0017_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/vl_io_0017.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/vl_io_0017.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/vl_io_0017.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from vl_io_0017_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/vl_io_0017.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0017_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/vl_io_0017.pgc b/app/dbio/vl_io_0017.pgc new file mode 100644 index 0000000..e5379e6 --- /dev/null +++ b/app/dbio/vl_io_0017.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module vl @transform validation-dbio */ +/* + * vl_io_0017.pgc - 정합성 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "vl_io_0017.h" + +EXEC SQL INCLUDE sqlca; + +int vl_io_0017_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM vl_io_0017_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0017_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int vl_io_0017_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE vl_io_0017_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0017_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long vl_io_0017_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM vl_io_0017_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0017_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/vl_io_0018.c b/app/dbio/vl_io_0018.c new file mode 100644 index 0000000..8ed20f7 --- /dev/null +++ b/app/dbio/vl_io_0018.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/vl_io_0018.pgc" +/* @tier medium @module vl @transform validation-dbio */ +/* + * vl_io_0018.pgc - 정합성 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "vl_io_0018.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/vl_io_0018.pgc" + + +int vl_io_0018_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/vl_io_0018.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/vl_io_0018.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/vl_io_0018.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from vl_io_0018_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/vl_io_0018.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0018_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int vl_io_0018_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/vl_io_0018.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/vl_io_0018.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/vl_io_0018.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update vl_io_0018_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/vl_io_0018.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0018_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long vl_io_0018_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/vl_io_0018.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/vl_io_0018.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/vl_io_0018.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from vl_io_0018_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/vl_io_0018.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0018_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/vl_io_0018.pgc b/app/dbio/vl_io_0018.pgc new file mode 100644 index 0000000..1f550a1 --- /dev/null +++ b/app/dbio/vl_io_0018.pgc @@ -0,0 +1,92 @@ +/* @tier medium @module vl @transform validation-dbio */ +/* + * vl_io_0018.pgc - 정합성 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "vl_io_0018.h" + +EXEC SQL INCLUDE sqlca; + +int vl_io_0018_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM vl_io_0018_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0018_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int vl_io_0018_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE vl_io_0018_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0018_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long vl_io_0018_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM vl_io_0018_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0018_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/vl_io_0019.c b/app/dbio/vl_io_0019.c new file mode 100644 index 0000000..7ba1525 --- /dev/null +++ b/app/dbio/vl_io_0019.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/vl_io_0019.pgc" +/* @tier easy @module vl @transform validation-dbio */ +/* + * vl_io_0019.pgc - 정합성 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "vl_io_0019.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/vl_io_0019.pgc" + + +int vl_io_0019_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/vl_io_0019.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/vl_io_0019.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/vl_io_0019.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from vl_io_0019_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/vl_io_0019.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0019_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int vl_io_0019_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/vl_io_0019.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/vl_io_0019.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/vl_io_0019.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update vl_io_0019_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/vl_io_0019.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0019_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long vl_io_0019_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/vl_io_0019.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/vl_io_0019.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/vl_io_0019.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from vl_io_0019_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/vl_io_0019.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0019_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/vl_io_0019.pgc b/app/dbio/vl_io_0019.pgc new file mode 100644 index 0000000..6b7bb16 --- /dev/null +++ b/app/dbio/vl_io_0019.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module vl @transform validation-dbio */ +/* + * vl_io_0019.pgc - 정합성 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "vl_io_0019.h" + +EXEC SQL INCLUDE sqlca; + +int vl_io_0019_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM vl_io_0019_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0019_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int vl_io_0019_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE vl_io_0019_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0019_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long vl_io_0019_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM vl_io_0019_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0019_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/vl_io_0020.c b/app/dbio/vl_io_0020.c new file mode 100644 index 0000000..170b444 --- /dev/null +++ b/app/dbio/vl_io_0020.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/vl_io_0020.pgc" +/* @tier medium @module vl @transform validation-dbio */ +/* + * vl_io_0020.pgc - 정합성 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "vl_io_0020.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/vl_io_0020.pgc" + + +int vl_io_0020_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/vl_io_0020.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/vl_io_0020.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/vl_io_0020.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from vl_io_0020_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/vl_io_0020.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0020_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int vl_io_0020_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/vl_io_0020.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/vl_io_0020.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/vl_io_0020.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update vl_io_0020_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/vl_io_0020.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0020_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long vl_io_0020_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/vl_io_0020.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/vl_io_0020.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/vl_io_0020.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from vl_io_0020_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/vl_io_0020.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0020_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/vl_io_0020.pgc b/app/dbio/vl_io_0020.pgc new file mode 100644 index 0000000..6c637d5 --- /dev/null +++ b/app/dbio/vl_io_0020.pgc @@ -0,0 +1,92 @@ +/* @tier medium @module vl @transform validation-dbio */ +/* + * vl_io_0020.pgc - 정합성 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "vl_io_0020.h" + +EXEC SQL INCLUDE sqlca; + +int vl_io_0020_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM vl_io_0020_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0020_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int vl_io_0020_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE vl_io_0020_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0020_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long vl_io_0020_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM vl_io_0020_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0020_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/vl_io_0021.c b/app/dbio/vl_io_0021.c new file mode 100644 index 0000000..215b663 --- /dev/null +++ b/app/dbio/vl_io_0021.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/vl_io_0021.pgc" +/* @tier easy @module vl @transform validation-dbio */ +/* + * vl_io_0021.pgc - 정합성 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "vl_io_0021.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/vl_io_0021.pgc" + + +int vl_io_0021_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/vl_io_0021.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/vl_io_0021.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/vl_io_0021.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from vl_io_0021_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/vl_io_0021.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0021_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int vl_io_0021_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/vl_io_0021.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/vl_io_0021.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/vl_io_0021.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update vl_io_0021_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/vl_io_0021.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0021_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long vl_io_0021_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/vl_io_0021.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/vl_io_0021.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/vl_io_0021.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from vl_io_0021_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/vl_io_0021.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0021_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/vl_io_0021.pgc b/app/dbio/vl_io_0021.pgc new file mode 100644 index 0000000..94be3fd --- /dev/null +++ b/app/dbio/vl_io_0021.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module vl @transform validation-dbio */ +/* + * vl_io_0021.pgc - 정합성 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "vl_io_0021.h" + +EXEC SQL INCLUDE sqlca; + +int vl_io_0021_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM vl_io_0021_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0021_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int vl_io_0021_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE vl_io_0021_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0021_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long vl_io_0021_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM vl_io_0021_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0021_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/vl_io_0022.c b/app/dbio/vl_io_0022.c new file mode 100644 index 0000000..03bd2fd --- /dev/null +++ b/app/dbio/vl_io_0022.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/vl_io_0022.pgc" +/* @tier medium @module vl @transform validation-dbio */ +/* + * vl_io_0022.pgc - 정합성 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "vl_io_0022.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/vl_io_0022.pgc" + + +int vl_io_0022_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/vl_io_0022.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/vl_io_0022.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/vl_io_0022.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from vl_io_0022_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/vl_io_0022.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0022_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int vl_io_0022_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/vl_io_0022.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/vl_io_0022.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/vl_io_0022.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update vl_io_0022_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/vl_io_0022.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0022_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long vl_io_0022_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/vl_io_0022.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/vl_io_0022.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/vl_io_0022.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from vl_io_0022_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/vl_io_0022.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0022_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/vl_io_0022.pgc b/app/dbio/vl_io_0022.pgc new file mode 100644 index 0000000..489c838 --- /dev/null +++ b/app/dbio/vl_io_0022.pgc @@ -0,0 +1,92 @@ +/* @tier medium @module vl @transform validation-dbio */ +/* + * vl_io_0022.pgc - 정합성 보조 DBIO (ECPG) [tier=medium] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "vl_io_0022.h" + +EXEC SQL INCLUDE sqlca; + +int vl_io_0022_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM vl_io_0022_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0022_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int vl_io_0022_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE vl_io_0022_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0022_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long vl_io_0022_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM vl_io_0022_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0022_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/vl_io_0023.c b/app/dbio/vl_io_0023.c new file mode 100644 index 0000000..e993e41 --- /dev/null +++ b/app/dbio/vl_io_0023.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/vl_io_0023.pgc" +/* @tier easy @module vl @transform validation-dbio */ +/* + * vl_io_0023.pgc - 정합성 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "vl_io_0023.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/vl_io_0023.pgc" + + +int vl_io_0023_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/vl_io_0023.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/vl_io_0023.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/vl_io_0023.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from vl_io_0023_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/vl_io_0023.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0023_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int vl_io_0023_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/vl_io_0023.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/vl_io_0023.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/vl_io_0023.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update vl_io_0023_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/vl_io_0023.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0023_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long vl_io_0023_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/vl_io_0023.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/vl_io_0023.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/vl_io_0023.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from vl_io_0023_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/vl_io_0023.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0023_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/vl_io_0023.pgc b/app/dbio/vl_io_0023.pgc new file mode 100644 index 0000000..9530ee5 --- /dev/null +++ b/app/dbio/vl_io_0023.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module vl @transform validation-dbio */ +/* + * vl_io_0023.pgc - 정합성 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "vl_io_0023.h" + +EXEC SQL INCLUDE sqlca; + +int vl_io_0023_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM vl_io_0023_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0023_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int vl_io_0023_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE vl_io_0023_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0023_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long vl_io_0023_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM vl_io_0023_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0023_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/vl_io_0024.c b/app/dbio/vl_io_0024.c new file mode 100644 index 0000000..87fc9f6 --- /dev/null +++ b/app/dbio/vl_io_0024.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/vl_io_0024.pgc" +/* @tier hard @module vl @transform validation-dbio */ +/* + * vl_io_0024.pgc - 정합성 보조 DBIO (ECPG) [tier=hard] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "vl_io_0024.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/vl_io_0024.pgc" + + +int vl_io_0024_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/vl_io_0024.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/vl_io_0024.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/vl_io_0024.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from vl_io_0024_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/vl_io_0024.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0024_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int vl_io_0024_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/vl_io_0024.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/vl_io_0024.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/vl_io_0024.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update vl_io_0024_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/vl_io_0024.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0024_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long vl_io_0024_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/vl_io_0024.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/vl_io_0024.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/vl_io_0024.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from vl_io_0024_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/vl_io_0024.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0024_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/vl_io_0024.pgc b/app/dbio/vl_io_0024.pgc new file mode 100644 index 0000000..62e53bf --- /dev/null +++ b/app/dbio/vl_io_0024.pgc @@ -0,0 +1,92 @@ +/* @tier hard @module vl @transform validation-dbio */ +/* + * vl_io_0024.pgc - 정합성 보조 DBIO (ECPG) [tier=hard] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "vl_io_0024.h" + +EXEC SQL INCLUDE sqlca; + +int vl_io_0024_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM vl_io_0024_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0024_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int vl_io_0024_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE vl_io_0024_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0024_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long vl_io_0024_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM vl_io_0024_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0024_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/vl_io_0025.c b/app/dbio/vl_io_0025.c new file mode 100644 index 0000000..a1ad837 --- /dev/null +++ b/app/dbio/vl_io_0025.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/vl_io_0025.pgc" +/* @tier easy @module vl @transform validation-dbio */ +/* + * vl_io_0025.pgc - 정합성 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "vl_io_0025.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/vl_io_0025.pgc" + + +int vl_io_0025_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/vl_io_0025.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/vl_io_0025.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/vl_io_0025.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from vl_io_0025_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/vl_io_0025.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0025_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int vl_io_0025_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/vl_io_0025.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/vl_io_0025.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/vl_io_0025.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update vl_io_0025_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/vl_io_0025.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0025_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long vl_io_0025_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/vl_io_0025.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/vl_io_0025.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/vl_io_0025.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from vl_io_0025_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/vl_io_0025.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0025_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/vl_io_0025.pgc b/app/dbio/vl_io_0025.pgc new file mode 100644 index 0000000..1b6f110 --- /dev/null +++ b/app/dbio/vl_io_0025.pgc @@ -0,0 +1,92 @@ +/* @tier easy @module vl @transform validation-dbio */ +/* + * vl_io_0025.pgc - 정합성 보조 DBIO (ECPG) [tier=easy] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "vl_io_0025.h" + +EXEC SQL INCLUDE sqlca; + +int vl_io_0025_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM vl_io_0025_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0025_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int vl_io_0025_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE vl_io_0025_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0025_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long vl_io_0025_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM vl_io_0025_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0025_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/vl_io_0026.c b/app/dbio/vl_io_0026.c new file mode 100644 index 0000000..0aba6b6 --- /dev/null +++ b/app/dbio/vl_io_0026.c @@ -0,0 +1,204 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/dbio/vl_io_0026.pgc" +/* @tier hard @module vl @transform validation-dbio */ +/* + * vl_io_0026.pgc - 정합성 보조 DBIO (ECPG) [tier=hard] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "vl_io_0026.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 12 "app/dbio/vl_io_0026.pgc" + + +int vl_io_0026_fetch(const char *key, long *out_amount) +{ + /* exec sql begin declare section */ + + + +#line 17 "app/dbio/vl_io_0026.pgc" + char h_key [ 16 ] ; + +#line 18 "app/dbio/vl_io_0026.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 19 "app/dbio/vl_io_0026.pgc" + + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from vl_io_0026_t where key = $1 ", + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 30 "app/dbio/vl_io_0026.pgc" + + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0026_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int vl_io_0026_touch(const char *key, long amount) +{ + /* exec sql begin declare section */ + + + +#line 45 "app/dbio/vl_io_0026.pgc" + char h_key [ 16 ] ; + +#line 46 "app/dbio/vl_io_0026.pgc" + long h_amount ; +/* exec sql end declare section */ +#line 47 "app/dbio/vl_io_0026.pgc" + + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update vl_io_0026_t set amount = $1 , upd_ts = now ( ) where key = $2 ", + ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} +#line 58 "app/dbio/vl_io_0026.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0026_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long vl_io_0026_total(const char *biz_date) +{ + /* exec sql begin declare section */ + + + +#line 72 "app/dbio/vl_io_0026.pgc" + char h_biz_date [ 9 ] ; + +#line 73 "app/dbio/vl_io_0026.pgc" + long h_sum ; +/* exec sql end declare section */ +#line 74 "app/dbio/vl_io_0026.pgc" + + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from vl_io_0026_t where biz_date = $1 ", + ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} +#line 85 "app/dbio/vl_io_0026.pgc" + + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0026_total"); + return -1; + } + return h_sum; +} diff --git a/app/dbio/vl_io_0026.pgc b/app/dbio/vl_io_0026.pgc new file mode 100644 index 0000000..f8ea192 --- /dev/null +++ b/app/dbio/vl_io_0026.pgc @@ -0,0 +1,92 @@ +/* @tier hard @module vl @transform validation-dbio */ +/* + * vl_io_0026.pgc - 정합성 보조 DBIO (ECPG) [tier=hard] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "vl_io_0026.h" + +EXEC SQL INCLUDE sqlca; + +int vl_io_0026_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM vl_io_0026_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0026_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int vl_io_0026_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE vl_io_0026_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0026_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long vl_io_0026_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM vl_io_0026_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("vl_io_0026_total"); + return -1; + } + return h_sum; +} diff --git a/app/include/ac_core.h b/app/include/ac_core.h new file mode 100644 index 0000000..dc6c7aa --- /dev/null +++ b/app/include/ac_core.h @@ -0,0 +1,38 @@ +/* + * ac_core.h - 매입 모듈 핵심 계약 (레코드/상태/표준 DBIO API) + * + * 이 모듈의 온라인/배치 프로그램은 SQL 을 직접 다루지 않고 아래 표준 + * DBIO API 만 호출한다. 구현은 app/dbio/ac_dbio_main.pgc (ECPG). + */ +#ifndef AC_CORE_H +#define AC_CORE_H + +#include "txcore.h" + +/* 매입 처리 상태코드 */ +#define AC_ST_RECV "R" /* 접수/수신 */ +#define AC_ST_DONE "M" /* 처리완료 */ +#define AC_ST_FAIL "U" /* 불일치/실패 */ +#define AC_ST_SETTLED "S" /* 정산완료 */ + +/* 매입 원장 레코드 (1행) */ +typedef struct { + char key[16]; /* 처리키(승인/거래 번호) PK */ + char merch_id[16]; /* 가맹점번호 */ + char card_no[20]; /* 카드번호(마스킹) */ + long amount; /* 거래금액(원) */ + char biz_date[9]; /* 영업일 YYYYMMDD */ + char status[2]; /* 상태코드 */ + long fee; /* 수수료(원) */ +} ac_rec_t; + +/* 표준 DBIO API (구현: ac_dbio_main.pgc) */ +int ac_dbio_connect(const char *target); +int ac_dbio_disconnect(void); +int ac_rec_insert(const ac_rec_t *rec); +int ac_rec_select(const char *key, ac_rec_t *out); +int ac_rec_update_status(const char *key, const char *status); +long ac_rec_count(const char *biz_date, const char *status); +int ac_rec_sum(const char *biz_date, long *out_sum); + +#endif /* AC_CORE_H */ diff --git a/app/include/ac_cu_0001.h b/app/include/ac_cu_0001.h new file mode 100644 index 0000000..a576c00 --- /dev/null +++ b/app/include/ac_cu_0001.h @@ -0,0 +1,11 @@ +/* + * ac_cu_0001.h - 매입 공통 유틸 선언 (ac_cu_0001.c 구현) + */ +#ifndef AC_CU_0001_H +#define AC_CU_0001_H + +long ac_cu_0001_fee(long amount, int rate_bp); +long ac_cu_0001_round_unit(long amount, long unit); +int ac_cu_0001_classify(long amount); + +#endif /* AC_CU_0001_H */ diff --git a/app/include/ac_cu_0002.h b/app/include/ac_cu_0002.h new file mode 100644 index 0000000..a8c9fff --- /dev/null +++ b/app/include/ac_cu_0002.h @@ -0,0 +1,11 @@ +/* + * ac_cu_0002.h - 매입 공통 유틸 선언 (ac_cu_0002.c 구현) + */ +#ifndef AC_CU_0002_H +#define AC_CU_0002_H + +long ac_cu_0002_fee(long amount, int rate_bp); +long ac_cu_0002_round_unit(long amount, long unit); +int ac_cu_0002_classify(long amount); + +#endif /* AC_CU_0002_H */ diff --git a/app/include/ac_cu_0003.h b/app/include/ac_cu_0003.h new file mode 100644 index 0000000..fea0909 --- /dev/null +++ b/app/include/ac_cu_0003.h @@ -0,0 +1,11 @@ +/* + * ac_cu_0003.h - 매입 공통 유틸 선언 (ac_cu_0003.c 구현) + */ +#ifndef AC_CU_0003_H +#define AC_CU_0003_H + +long ac_cu_0003_fee(long amount, int rate_bp); +long ac_cu_0003_round_unit(long amount, long unit); +int ac_cu_0003_classify(long amount); + +#endif /* AC_CU_0003_H */ diff --git a/app/include/ac_cu_0004.h b/app/include/ac_cu_0004.h new file mode 100644 index 0000000..22459af --- /dev/null +++ b/app/include/ac_cu_0004.h @@ -0,0 +1,11 @@ +/* + * ac_cu_0004.h - 매입 공통 유틸 선언 (ac_cu_0004.c 구현) + */ +#ifndef AC_CU_0004_H +#define AC_CU_0004_H + +long ac_cu_0004_fee(long amount, int rate_bp); +long ac_cu_0004_round_unit(long amount, long unit); +int ac_cu_0004_classify(long amount); + +#endif /* AC_CU_0004_H */ diff --git a/app/include/ac_cu_0005.h b/app/include/ac_cu_0005.h new file mode 100644 index 0000000..b687ea7 --- /dev/null +++ b/app/include/ac_cu_0005.h @@ -0,0 +1,11 @@ +/* + * ac_cu_0005.h - 매입 공통 유틸 선언 (ac_cu_0005.c 구현) + */ +#ifndef AC_CU_0005_H +#define AC_CU_0005_H + +long ac_cu_0005_fee(long amount, int rate_bp); +long ac_cu_0005_round_unit(long amount, long unit); +int ac_cu_0005_classify(long amount); + +#endif /* AC_CU_0005_H */ diff --git a/app/include/ac_cu_0006.h b/app/include/ac_cu_0006.h new file mode 100644 index 0000000..c798f72 --- /dev/null +++ b/app/include/ac_cu_0006.h @@ -0,0 +1,11 @@ +/* + * ac_cu_0006.h - 매입 공통 유틸 선언 (ac_cu_0006.c 구현) + */ +#ifndef AC_CU_0006_H +#define AC_CU_0006_H + +long ac_cu_0006_fee(long amount, int rate_bp); +long ac_cu_0006_round_unit(long amount, long unit); +int ac_cu_0006_classify(long amount); + +#endif /* AC_CU_0006_H */ diff --git a/app/include/ac_cu_0007.h b/app/include/ac_cu_0007.h new file mode 100644 index 0000000..21bba07 --- /dev/null +++ b/app/include/ac_cu_0007.h @@ -0,0 +1,11 @@ +/* + * ac_cu_0007.h - 매입 공통 유틸 선언 (ac_cu_0007.c 구현) + */ +#ifndef AC_CU_0007_H +#define AC_CU_0007_H + +long ac_cu_0007_fee(long amount, int rate_bp); +long ac_cu_0007_round_unit(long amount, long unit); +int ac_cu_0007_classify(long amount); + +#endif /* AC_CU_0007_H */ diff --git a/app/include/ac_cu_0008.h b/app/include/ac_cu_0008.h new file mode 100644 index 0000000..29a4e2d --- /dev/null +++ b/app/include/ac_cu_0008.h @@ -0,0 +1,11 @@ +/* + * ac_cu_0008.h - 매입 공통 유틸 선언 (ac_cu_0008.c 구현) + */ +#ifndef AC_CU_0008_H +#define AC_CU_0008_H + +long ac_cu_0008_fee(long amount, int rate_bp); +long ac_cu_0008_round_unit(long amount, long unit); +int ac_cu_0008_classify(long amount); + +#endif /* AC_CU_0008_H */ diff --git a/app/include/ac_cu_0009.h b/app/include/ac_cu_0009.h new file mode 100644 index 0000000..823bd4d --- /dev/null +++ b/app/include/ac_cu_0009.h @@ -0,0 +1,11 @@ +/* + * ac_cu_0009.h - 매입 공통 유틸 선언 (ac_cu_0009.c 구현) + */ +#ifndef AC_CU_0009_H +#define AC_CU_0009_H + +long ac_cu_0009_fee(long amount, int rate_bp); +long ac_cu_0009_round_unit(long amount, long unit); +int ac_cu_0009_classify(long amount); + +#endif /* AC_CU_0009_H */ diff --git a/app/include/ac_cu_0010.h b/app/include/ac_cu_0010.h new file mode 100644 index 0000000..b0db213 --- /dev/null +++ b/app/include/ac_cu_0010.h @@ -0,0 +1,11 @@ +/* + * ac_cu_0010.h - 매입 공통 유틸 선언 (ac_cu_0010.c 구현) + */ +#ifndef AC_CU_0010_H +#define AC_CU_0010_H + +long ac_cu_0010_fee(long amount, int rate_bp); +long ac_cu_0010_round_unit(long amount, long unit); +int ac_cu_0010_classify(long amount); + +#endif /* AC_CU_0010_H */ diff --git a/app/include/ac_cu_0011.h b/app/include/ac_cu_0011.h new file mode 100644 index 0000000..7bc1e74 --- /dev/null +++ b/app/include/ac_cu_0011.h @@ -0,0 +1,11 @@ +/* + * ac_cu_0011.h - 매입 공통 유틸 선언 (ac_cu_0011.c 구현) + */ +#ifndef AC_CU_0011_H +#define AC_CU_0011_H + +long ac_cu_0011_fee(long amount, int rate_bp); +long ac_cu_0011_round_unit(long amount, long unit); +int ac_cu_0011_classify(long amount); + +#endif /* AC_CU_0011_H */ diff --git a/app/include/ac_h_0001.h b/app/include/ac_h_0001.h new file mode 100644 index 0000000..f5efb2f --- /dev/null +++ b/app/include/ac_h_0001.h @@ -0,0 +1,20 @@ +/* + * ac_h_0001.h - 매입 코드/상수 테이블 + */ +#ifndef AC_H_0001_H +#define AC_H_0001_H + +#define AC_H_0001_RC_OK 0 +#define AC_H_0001_RC_RETRY 1 +#define AC_H_0001_RC_SKIP 2 +#define AC_H_0001_RC_ERROR 9 + +#define AC_H_0001_LIMIT_DAILY 100000000L +#define AC_H_0001_LIMIT_SINGLE 50000000L +#define AC_H_0001_FEE_RATE_BP 250 /* 2.50% */ + +#define AC_H_0001_CHAN_ONLINE "01" +#define AC_H_0001_CHAN_BATCH "02" +#define AC_H_0001_CHAN_RECON "03" + +#endif /* AC_H_0001_H */ diff --git a/app/include/ac_h_0002.h b/app/include/ac_h_0002.h new file mode 100644 index 0000000..511447f --- /dev/null +++ b/app/include/ac_h_0002.h @@ -0,0 +1,19 @@ +/* + * ac_h_0002.h - 매입 고정길이 전문 레이아웃 (positional, 재배치 금지) + */ +#ifndef AC_H_0002_H +#define AC_H_0002_H + +typedef struct { + char msg_type[4]; /* 전문구분 4 */ + char merch_id[15]; /* 가맹점번호 15 */ + char key[9]; /* 처리키 9 */ + char amount[12]; /* 금액 12 zero-pad */ + char biz_date[8]; /* 영업일 8 */ + char resp_code[4]; /* 응답코드 4 */ + char filler[20]; /* 예비 20 */ +} ac_h_0002_msg_t; + +#define AC_H_0002_MSG_LEN ((int)sizeof(ac_h_0002_msg_t)) + +#endif /* AC_H_0002_H */ diff --git a/app/include/ac_h_0003.h b/app/include/ac_h_0003.h new file mode 100644 index 0000000..c97a288 --- /dev/null +++ b/app/include/ac_h_0003.h @@ -0,0 +1,22 @@ +/* + * ac_h_0003.h - 매입 레코드/뷰 구조 정의 + */ +#ifndef AC_H_0003_H +#define AC_H_0003_H + +/* 매입 처리 뷰 레코드 */ +typedef struct { + char key[16]; + char merch_id[16]; + long amount; + long fee; + char biz_date[9]; + char status[2]; + char reserved[16]; +} ac_h_0003_view_t; + +#define AC_H_0003_STATUS_OPEN "O" +#define AC_H_0003_STATUS_HOLD "H" +#define AC_H_0003_STATUS_CLOSE "C" + +#endif /* AC_H_0003_H */ diff --git a/app/include/ac_h_0004.h b/app/include/ac_h_0004.h new file mode 100644 index 0000000..7a1afc7 --- /dev/null +++ b/app/include/ac_h_0004.h @@ -0,0 +1,13 @@ +/* + * ac_h_0004.h - 매입 내부 헬퍼 선언 + */ +#ifndef AC_H_0004_H +#define AC_H_0004_H + +#include "txcore.h" + +int ac_h_0004_check(const char *key, long amount); +int ac_h_0004_apply(TXBUF *in, TXBUF *out); +long ac_h_0004_eval(long amount, int factor); + +#endif /* AC_H_0004_H */ diff --git a/app/include/ac_h_0005.h b/app/include/ac_h_0005.h new file mode 100644 index 0000000..9847272 --- /dev/null +++ b/app/include/ac_h_0005.h @@ -0,0 +1,20 @@ +/* + * ac_h_0005.h - 매입 코드/상수 테이블 + */ +#ifndef AC_H_0005_H +#define AC_H_0005_H + +#define AC_H_0005_RC_OK 0 +#define AC_H_0005_RC_RETRY 1 +#define AC_H_0005_RC_SKIP 2 +#define AC_H_0005_RC_ERROR 9 + +#define AC_H_0005_LIMIT_DAILY 100000000L +#define AC_H_0005_LIMIT_SINGLE 50000000L +#define AC_H_0005_FEE_RATE_BP 250 /* 2.50% */ + +#define AC_H_0005_CHAN_ONLINE "01" +#define AC_H_0005_CHAN_BATCH "02" +#define AC_H_0005_CHAN_RECON "03" + +#endif /* AC_H_0005_H */ diff --git a/app/include/ac_h_0006.h b/app/include/ac_h_0006.h new file mode 100644 index 0000000..fb913b0 --- /dev/null +++ b/app/include/ac_h_0006.h @@ -0,0 +1,19 @@ +/* + * ac_h_0006.h - 매입 고정길이 전문 레이아웃 (positional, 재배치 금지) + */ +#ifndef AC_H_0006_H +#define AC_H_0006_H + +typedef struct { + char msg_type[4]; /* 전문구분 4 */ + char merch_id[15]; /* 가맹점번호 15 */ + char key[9]; /* 처리키 9 */ + char amount[12]; /* 금액 12 zero-pad */ + char biz_date[8]; /* 영업일 8 */ + char resp_code[4]; /* 응답코드 4 */ + char filler[20]; /* 예비 20 */ +} ac_h_0006_msg_t; + +#define AC_H_0006_MSG_LEN ((int)sizeof(ac_h_0006_msg_t)) + +#endif /* AC_H_0006_H */ diff --git a/app/include/ac_h_0007.h b/app/include/ac_h_0007.h new file mode 100644 index 0000000..dedf4fd --- /dev/null +++ b/app/include/ac_h_0007.h @@ -0,0 +1,22 @@ +/* + * ac_h_0007.h - 매입 레코드/뷰 구조 정의 + */ +#ifndef AC_H_0007_H +#define AC_H_0007_H + +/* 매입 처리 뷰 레코드 */ +typedef struct { + char key[16]; + char merch_id[16]; + long amount; + long fee; + char biz_date[9]; + char status[2]; + char reserved[16]; +} ac_h_0007_view_t; + +#define AC_H_0007_STATUS_OPEN "O" +#define AC_H_0007_STATUS_HOLD "H" +#define AC_H_0007_STATUS_CLOSE "C" + +#endif /* AC_H_0007_H */ diff --git a/app/include/ac_h_0008.h b/app/include/ac_h_0008.h new file mode 100644 index 0000000..3045c39 --- /dev/null +++ b/app/include/ac_h_0008.h @@ -0,0 +1,13 @@ +/* + * ac_h_0008.h - 매입 내부 헬퍼 선언 + */ +#ifndef AC_H_0008_H +#define AC_H_0008_H + +#include "txcore.h" + +int ac_h_0008_check(const char *key, long amount); +int ac_h_0008_apply(TXBUF *in, TXBUF *out); +long ac_h_0008_eval(long amount, int factor); + +#endif /* AC_H_0008_H */ diff --git a/app/include/ac_h_0009.h b/app/include/ac_h_0009.h new file mode 100644 index 0000000..8594e36 --- /dev/null +++ b/app/include/ac_h_0009.h @@ -0,0 +1,20 @@ +/* + * ac_h_0009.h - 매입 코드/상수 테이블 + */ +#ifndef AC_H_0009_H +#define AC_H_0009_H + +#define AC_H_0009_RC_OK 0 +#define AC_H_0009_RC_RETRY 1 +#define AC_H_0009_RC_SKIP 2 +#define AC_H_0009_RC_ERROR 9 + +#define AC_H_0009_LIMIT_DAILY 100000000L +#define AC_H_0009_LIMIT_SINGLE 50000000L +#define AC_H_0009_FEE_RATE_BP 250 /* 2.50% */ + +#define AC_H_0009_CHAN_ONLINE "01" +#define AC_H_0009_CHAN_BATCH "02" +#define AC_H_0009_CHAN_RECON "03" + +#endif /* AC_H_0009_H */ diff --git a/app/include/ac_h_0010.h b/app/include/ac_h_0010.h new file mode 100644 index 0000000..3d02936 --- /dev/null +++ b/app/include/ac_h_0010.h @@ -0,0 +1,19 @@ +/* + * ac_h_0010.h - 매입 고정길이 전문 레이아웃 (positional, 재배치 금지) + */ +#ifndef AC_H_0010_H +#define AC_H_0010_H + +typedef struct { + char msg_type[4]; /* 전문구분 4 */ + char merch_id[15]; /* 가맹점번호 15 */ + char key[9]; /* 처리키 9 */ + char amount[12]; /* 금액 12 zero-pad */ + char biz_date[8]; /* 영업일 8 */ + char resp_code[4]; /* 응답코드 4 */ + char filler[20]; /* 예비 20 */ +} ac_h_0010_msg_t; + +#define AC_H_0010_MSG_LEN ((int)sizeof(ac_h_0010_msg_t)) + +#endif /* AC_H_0010_H */ diff --git a/app/include/ac_h_0011.h b/app/include/ac_h_0011.h new file mode 100644 index 0000000..5941cd9 --- /dev/null +++ b/app/include/ac_h_0011.h @@ -0,0 +1,22 @@ +/* + * ac_h_0011.h - 매입 레코드/뷰 구조 정의 + */ +#ifndef AC_H_0011_H +#define AC_H_0011_H + +/* 매입 처리 뷰 레코드 */ +typedef struct { + char key[16]; + char merch_id[16]; + long amount; + long fee; + char biz_date[9]; + char status[2]; + char reserved[16]; +} ac_h_0011_view_t; + +#define AC_H_0011_STATUS_OPEN "O" +#define AC_H_0011_STATUS_HOLD "H" +#define AC_H_0011_STATUS_CLOSE "C" + +#endif /* AC_H_0011_H */ diff --git a/app/include/ac_h_0012.h b/app/include/ac_h_0012.h new file mode 100644 index 0000000..ee4fdf1 --- /dev/null +++ b/app/include/ac_h_0012.h @@ -0,0 +1,13 @@ +/* + * ac_h_0012.h - 매입 내부 헬퍼 선언 + */ +#ifndef AC_H_0012_H +#define AC_H_0012_H + +#include "txcore.h" + +int ac_h_0012_check(const char *key, long amount); +int ac_h_0012_apply(TXBUF *in, TXBUF *out); +long ac_h_0012_eval(long amount, int factor); + +#endif /* AC_H_0012_H */ diff --git a/app/include/ac_h_0013.h b/app/include/ac_h_0013.h new file mode 100644 index 0000000..1907e81 --- /dev/null +++ b/app/include/ac_h_0013.h @@ -0,0 +1,20 @@ +/* + * ac_h_0013.h - 매입 코드/상수 테이블 + */ +#ifndef AC_H_0013_H +#define AC_H_0013_H + +#define AC_H_0013_RC_OK 0 +#define AC_H_0013_RC_RETRY 1 +#define AC_H_0013_RC_SKIP 2 +#define AC_H_0013_RC_ERROR 9 + +#define AC_H_0013_LIMIT_DAILY 100000000L +#define AC_H_0013_LIMIT_SINGLE 50000000L +#define AC_H_0013_FEE_RATE_BP 250 /* 2.50% */ + +#define AC_H_0013_CHAN_ONLINE "01" +#define AC_H_0013_CHAN_BATCH "02" +#define AC_H_0013_CHAN_RECON "03" + +#endif /* AC_H_0013_H */ diff --git a/app/include/ac_h_0014.h b/app/include/ac_h_0014.h new file mode 100644 index 0000000..c59997d --- /dev/null +++ b/app/include/ac_h_0014.h @@ -0,0 +1,19 @@ +/* + * ac_h_0014.h - 매입 고정길이 전문 레이아웃 (positional, 재배치 금지) + */ +#ifndef AC_H_0014_H +#define AC_H_0014_H + +typedef struct { + char msg_type[4]; /* 전문구분 4 */ + char merch_id[15]; /* 가맹점번호 15 */ + char key[9]; /* 처리키 9 */ + char amount[12]; /* 금액 12 zero-pad */ + char biz_date[8]; /* 영업일 8 */ + char resp_code[4]; /* 응답코드 4 */ + char filler[20]; /* 예비 20 */ +} ac_h_0014_msg_t; + +#define AC_H_0014_MSG_LEN ((int)sizeof(ac_h_0014_msg_t)) + +#endif /* AC_H_0014_H */ diff --git a/app/include/ac_h_0015.h b/app/include/ac_h_0015.h new file mode 100644 index 0000000..ab8db18 --- /dev/null +++ b/app/include/ac_h_0015.h @@ -0,0 +1,22 @@ +/* + * ac_h_0015.h - 매입 레코드/뷰 구조 정의 + */ +#ifndef AC_H_0015_H +#define AC_H_0015_H + +/* 매입 처리 뷰 레코드 */ +typedef struct { + char key[16]; + char merch_id[16]; + long amount; + long fee; + char biz_date[9]; + char status[2]; + char reserved[16]; +} ac_h_0015_view_t; + +#define AC_H_0015_STATUS_OPEN "O" +#define AC_H_0015_STATUS_HOLD "H" +#define AC_H_0015_STATUS_CLOSE "C" + +#endif /* AC_H_0015_H */ diff --git a/app/include/ac_h_0016.h b/app/include/ac_h_0016.h new file mode 100644 index 0000000..d30a42a --- /dev/null +++ b/app/include/ac_h_0016.h @@ -0,0 +1,13 @@ +/* + * ac_h_0016.h - 매입 내부 헬퍼 선언 + */ +#ifndef AC_H_0016_H +#define AC_H_0016_H + +#include "txcore.h" + +int ac_h_0016_check(const char *key, long amount); +int ac_h_0016_apply(TXBUF *in, TXBUF *out); +long ac_h_0016_eval(long amount, int factor); + +#endif /* AC_H_0016_H */ diff --git a/app/include/ac_h_0017.h b/app/include/ac_h_0017.h new file mode 100644 index 0000000..0dc640a --- /dev/null +++ b/app/include/ac_h_0017.h @@ -0,0 +1,20 @@ +/* + * ac_h_0017.h - 매입 코드/상수 테이블 + */ +#ifndef AC_H_0017_H +#define AC_H_0017_H + +#define AC_H_0017_RC_OK 0 +#define AC_H_0017_RC_RETRY 1 +#define AC_H_0017_RC_SKIP 2 +#define AC_H_0017_RC_ERROR 9 + +#define AC_H_0017_LIMIT_DAILY 100000000L +#define AC_H_0017_LIMIT_SINGLE 50000000L +#define AC_H_0017_FEE_RATE_BP 250 /* 2.50% */ + +#define AC_H_0017_CHAN_ONLINE "01" +#define AC_H_0017_CHAN_BATCH "02" +#define AC_H_0017_CHAN_RECON "03" + +#endif /* AC_H_0017_H */ diff --git a/app/include/ac_io_0001.h b/app/include/ac_io_0001.h new file mode 100644 index 0000000..4a08b70 --- /dev/null +++ b/app/include/ac_io_0001.h @@ -0,0 +1,14 @@ +/* + * ac_io_0001.h - 매입 보조 DBIO 선언 (ac_io_0001.pgc 구현) + */ +#ifndef AC_IO_0001_H +#define AC_IO_0001_H + +#include "txcore.h" + +/* ac_io_0001 전용 조회/갱신 (테이블 ac_io_0001_t) */ +int ac_io_0001_fetch(const char *key, long *out_amount); +int ac_io_0001_touch(const char *key, long amount); +long ac_io_0001_total(const char *biz_date); + +#endif /* AC_IO_0001_H */ diff --git a/app/include/ac_io_0002.h b/app/include/ac_io_0002.h new file mode 100644 index 0000000..4c46dda --- /dev/null +++ b/app/include/ac_io_0002.h @@ -0,0 +1,14 @@ +/* + * ac_io_0002.h - 매입 보조 DBIO 선언 (ac_io_0002.pgc 구현) + */ +#ifndef AC_IO_0002_H +#define AC_IO_0002_H + +#include "txcore.h" + +/* ac_io_0002 전용 조회/갱신 (테이블 ac_io_0002_t) */ +int ac_io_0002_fetch(const char *key, long *out_amount); +int ac_io_0002_touch(const char *key, long amount); +long ac_io_0002_total(const char *biz_date); + +#endif /* AC_IO_0002_H */ diff --git a/app/include/ac_io_0003.h b/app/include/ac_io_0003.h new file mode 100644 index 0000000..ab6daf4 --- /dev/null +++ b/app/include/ac_io_0003.h @@ -0,0 +1,14 @@ +/* + * ac_io_0003.h - 매입 보조 DBIO 선언 (ac_io_0003.pgc 구현) + */ +#ifndef AC_IO_0003_H +#define AC_IO_0003_H + +#include "txcore.h" + +/* ac_io_0003 전용 조회/갱신 (테이블 ac_io_0003_t) */ +int ac_io_0003_fetch(const char *key, long *out_amount); +int ac_io_0003_touch(const char *key, long amount); +long ac_io_0003_total(const char *biz_date); + +#endif /* AC_IO_0003_H */ diff --git a/app/include/ac_io_0004.h b/app/include/ac_io_0004.h new file mode 100644 index 0000000..97cbd78 --- /dev/null +++ b/app/include/ac_io_0004.h @@ -0,0 +1,14 @@ +/* + * ac_io_0004.h - 매입 보조 DBIO 선언 (ac_io_0004.pgc 구현) + */ +#ifndef AC_IO_0004_H +#define AC_IO_0004_H + +#include "txcore.h" + +/* ac_io_0004 전용 조회/갱신 (테이블 ac_io_0004_t) */ +int ac_io_0004_fetch(const char *key, long *out_amount); +int ac_io_0004_touch(const char *key, long amount); +long ac_io_0004_total(const char *biz_date); + +#endif /* AC_IO_0004_H */ diff --git a/app/include/ac_io_0005.h b/app/include/ac_io_0005.h new file mode 100644 index 0000000..1978569 --- /dev/null +++ b/app/include/ac_io_0005.h @@ -0,0 +1,14 @@ +/* + * ac_io_0005.h - 매입 보조 DBIO 선언 (ac_io_0005.pgc 구현) + */ +#ifndef AC_IO_0005_H +#define AC_IO_0005_H + +#include "txcore.h" + +/* ac_io_0005 전용 조회/갱신 (테이블 ac_io_0005_t) */ +int ac_io_0005_fetch(const char *key, long *out_amount); +int ac_io_0005_touch(const char *key, long amount); +long ac_io_0005_total(const char *biz_date); + +#endif /* AC_IO_0005_H */ diff --git a/app/include/ac_io_0006.h b/app/include/ac_io_0006.h new file mode 100644 index 0000000..c7a49c9 --- /dev/null +++ b/app/include/ac_io_0006.h @@ -0,0 +1,14 @@ +/* + * ac_io_0006.h - 매입 보조 DBIO 선언 (ac_io_0006.pgc 구현) + */ +#ifndef AC_IO_0006_H +#define AC_IO_0006_H + +#include "txcore.h" + +/* ac_io_0006 전용 조회/갱신 (테이블 ac_io_0006_t) */ +int ac_io_0006_fetch(const char *key, long *out_amount); +int ac_io_0006_touch(const char *key, long amount); +long ac_io_0006_total(const char *biz_date); + +#endif /* AC_IO_0006_H */ diff --git a/app/include/ac_io_0007.h b/app/include/ac_io_0007.h new file mode 100644 index 0000000..9ddb748 --- /dev/null +++ b/app/include/ac_io_0007.h @@ -0,0 +1,14 @@ +/* + * ac_io_0007.h - 매입 보조 DBIO 선언 (ac_io_0007.pgc 구현) + */ +#ifndef AC_IO_0007_H +#define AC_IO_0007_H + +#include "txcore.h" + +/* ac_io_0007 전용 조회/갱신 (테이블 ac_io_0007_t) */ +int ac_io_0007_fetch(const char *key, long *out_amount); +int ac_io_0007_touch(const char *key, long amount); +long ac_io_0007_total(const char *biz_date); + +#endif /* AC_IO_0007_H */ diff --git a/app/include/ac_io_0008.h b/app/include/ac_io_0008.h new file mode 100644 index 0000000..e7b1d8b --- /dev/null +++ b/app/include/ac_io_0008.h @@ -0,0 +1,14 @@ +/* + * ac_io_0008.h - 매입 보조 DBIO 선언 (ac_io_0008.pgc 구현) + */ +#ifndef AC_IO_0008_H +#define AC_IO_0008_H + +#include "txcore.h" + +/* ac_io_0008 전용 조회/갱신 (테이블 ac_io_0008_t) */ +int ac_io_0008_fetch(const char *key, long *out_amount); +int ac_io_0008_touch(const char *key, long amount); +long ac_io_0008_total(const char *biz_date); + +#endif /* AC_IO_0008_H */ diff --git a/app/include/ac_io_0009.h b/app/include/ac_io_0009.h new file mode 100644 index 0000000..88d4c93 --- /dev/null +++ b/app/include/ac_io_0009.h @@ -0,0 +1,14 @@ +/* + * ac_io_0009.h - 매입 보조 DBIO 선언 (ac_io_0009.pgc 구현) + */ +#ifndef AC_IO_0009_H +#define AC_IO_0009_H + +#include "txcore.h" + +/* ac_io_0009 전용 조회/갱신 (테이블 ac_io_0009_t) */ +int ac_io_0009_fetch(const char *key, long *out_amount); +int ac_io_0009_touch(const char *key, long amount); +long ac_io_0009_total(const char *biz_date); + +#endif /* AC_IO_0009_H */ diff --git a/app/include/ac_io_0010.h b/app/include/ac_io_0010.h new file mode 100644 index 0000000..91777d9 --- /dev/null +++ b/app/include/ac_io_0010.h @@ -0,0 +1,14 @@ +/* + * ac_io_0010.h - 매입 보조 DBIO 선언 (ac_io_0010.pgc 구현) + */ +#ifndef AC_IO_0010_H +#define AC_IO_0010_H + +#include "txcore.h" + +/* ac_io_0010 전용 조회/갱신 (테이블 ac_io_0010_t) */ +int ac_io_0010_fetch(const char *key, long *out_amount); +int ac_io_0010_touch(const char *key, long amount); +long ac_io_0010_total(const char *biz_date); + +#endif /* AC_IO_0010_H */ diff --git a/app/include/ac_io_0011.h b/app/include/ac_io_0011.h new file mode 100644 index 0000000..06f5f7d --- /dev/null +++ b/app/include/ac_io_0011.h @@ -0,0 +1,14 @@ +/* + * ac_io_0011.h - 매입 보조 DBIO 선언 (ac_io_0011.pgc 구현) + */ +#ifndef AC_IO_0011_H +#define AC_IO_0011_H + +#include "txcore.h" + +/* ac_io_0011 전용 조회/갱신 (테이블 ac_io_0011_t) */ +int ac_io_0011_fetch(const char *key, long *out_amount); +int ac_io_0011_touch(const char *key, long amount); +long ac_io_0011_total(const char *biz_date); + +#endif /* AC_IO_0011_H */ diff --git a/app/include/ac_io_0012.h b/app/include/ac_io_0012.h new file mode 100644 index 0000000..ecbe9e4 --- /dev/null +++ b/app/include/ac_io_0012.h @@ -0,0 +1,14 @@ +/* + * ac_io_0012.h - 매입 보조 DBIO 선언 (ac_io_0012.pgc 구현) + */ +#ifndef AC_IO_0012_H +#define AC_IO_0012_H + +#include "txcore.h" + +/* ac_io_0012 전용 조회/갱신 (테이블 ac_io_0012_t) */ +int ac_io_0012_fetch(const char *key, long *out_amount); +int ac_io_0012_touch(const char *key, long amount); +long ac_io_0012_total(const char *biz_date); + +#endif /* AC_IO_0012_H */ diff --git a/app/include/ac_io_0013.h b/app/include/ac_io_0013.h new file mode 100644 index 0000000..49b528e --- /dev/null +++ b/app/include/ac_io_0013.h @@ -0,0 +1,14 @@ +/* + * ac_io_0013.h - 매입 보조 DBIO 선언 (ac_io_0013.pgc 구현) + */ +#ifndef AC_IO_0013_H +#define AC_IO_0013_H + +#include "txcore.h" + +/* ac_io_0013 전용 조회/갱신 (테이블 ac_io_0013_t) */ +int ac_io_0013_fetch(const char *key, long *out_amount); +int ac_io_0013_touch(const char *key, long amount); +long ac_io_0013_total(const char *biz_date); + +#endif /* AC_IO_0013_H */ diff --git a/app/include/ac_io_0014.h b/app/include/ac_io_0014.h new file mode 100644 index 0000000..114f822 --- /dev/null +++ b/app/include/ac_io_0014.h @@ -0,0 +1,14 @@ +/* + * ac_io_0014.h - 매입 보조 DBIO 선언 (ac_io_0014.pgc 구현) + */ +#ifndef AC_IO_0014_H +#define AC_IO_0014_H + +#include "txcore.h" + +/* ac_io_0014 전용 조회/갱신 (테이블 ac_io_0014_t) */ +int ac_io_0014_fetch(const char *key, long *out_amount); +int ac_io_0014_touch(const char *key, long amount); +long ac_io_0014_total(const char *biz_date); + +#endif /* AC_IO_0014_H */ diff --git a/app/include/ac_io_0015.h b/app/include/ac_io_0015.h new file mode 100644 index 0000000..1cb10ae --- /dev/null +++ b/app/include/ac_io_0015.h @@ -0,0 +1,14 @@ +/* + * ac_io_0015.h - 매입 보조 DBIO 선언 (ac_io_0015.pgc 구현) + */ +#ifndef AC_IO_0015_H +#define AC_IO_0015_H + +#include "txcore.h" + +/* ac_io_0015 전용 조회/갱신 (테이블 ac_io_0015_t) */ +int ac_io_0015_fetch(const char *key, long *out_amount); +int ac_io_0015_touch(const char *key, long amount); +long ac_io_0015_total(const char *biz_date); + +#endif /* AC_IO_0015_H */ diff --git a/app/include/ac_io_0016.h b/app/include/ac_io_0016.h new file mode 100644 index 0000000..0c8429c --- /dev/null +++ b/app/include/ac_io_0016.h @@ -0,0 +1,14 @@ +/* + * ac_io_0016.h - 매입 보조 DBIO 선언 (ac_io_0016.pgc 구현) + */ +#ifndef AC_IO_0016_H +#define AC_IO_0016_H + +#include "txcore.h" + +/* ac_io_0016 전용 조회/갱신 (테이블 ac_io_0016_t) */ +int ac_io_0016_fetch(const char *key, long *out_amount); +int ac_io_0016_touch(const char *key, long amount); +long ac_io_0016_total(const char *biz_date); + +#endif /* AC_IO_0016_H */ diff --git a/app/include/ac_io_0017.h b/app/include/ac_io_0017.h new file mode 100644 index 0000000..10a29af --- /dev/null +++ b/app/include/ac_io_0017.h @@ -0,0 +1,14 @@ +/* + * ac_io_0017.h - 매입 보조 DBIO 선언 (ac_io_0017.pgc 구현) + */ +#ifndef AC_IO_0017_H +#define AC_IO_0017_H + +#include "txcore.h" + +/* ac_io_0017 전용 조회/갱신 (테이블 ac_io_0017_t) */ +int ac_io_0017_fetch(const char *key, long *out_amount); +int ac_io_0017_touch(const char *key, long amount); +long ac_io_0017_total(const char *biz_date); + +#endif /* AC_IO_0017_H */ diff --git a/app/include/ac_io_0018.h b/app/include/ac_io_0018.h new file mode 100644 index 0000000..39a074f --- /dev/null +++ b/app/include/ac_io_0018.h @@ -0,0 +1,14 @@ +/* + * ac_io_0018.h - 매입 보조 DBIO 선언 (ac_io_0018.pgc 구현) + */ +#ifndef AC_IO_0018_H +#define AC_IO_0018_H + +#include "txcore.h" + +/* ac_io_0018 전용 조회/갱신 (테이블 ac_io_0018_t) */ +int ac_io_0018_fetch(const char *key, long *out_amount); +int ac_io_0018_touch(const char *key, long amount); +long ac_io_0018_total(const char *biz_date); + +#endif /* AC_IO_0018_H */ diff --git a/app/include/ac_io_0019.h b/app/include/ac_io_0019.h new file mode 100644 index 0000000..aebf200 --- /dev/null +++ b/app/include/ac_io_0019.h @@ -0,0 +1,14 @@ +/* + * ac_io_0019.h - 매입 보조 DBIO 선언 (ac_io_0019.pgc 구현) + */ +#ifndef AC_IO_0019_H +#define AC_IO_0019_H + +#include "txcore.h" + +/* ac_io_0019 전용 조회/갱신 (테이블 ac_io_0019_t) */ +int ac_io_0019_fetch(const char *key, long *out_amount); +int ac_io_0019_touch(const char *key, long amount); +long ac_io_0019_total(const char *biz_date); + +#endif /* AC_IO_0019_H */ diff --git a/app/include/ac_io_0020.h b/app/include/ac_io_0020.h new file mode 100644 index 0000000..278e4cd --- /dev/null +++ b/app/include/ac_io_0020.h @@ -0,0 +1,14 @@ +/* + * ac_io_0020.h - 매입 보조 DBIO 선언 (ac_io_0020.pgc 구현) + */ +#ifndef AC_IO_0020_H +#define AC_IO_0020_H + +#include "txcore.h" + +/* ac_io_0020 전용 조회/갱신 (테이블 ac_io_0020_t) */ +int ac_io_0020_fetch(const char *key, long *out_amount); +int ac_io_0020_touch(const char *key, long amount); +long ac_io_0020_total(const char *biz_date); + +#endif /* AC_IO_0020_H */ diff --git a/app/include/ac_io_0021.h b/app/include/ac_io_0021.h new file mode 100644 index 0000000..c9d8aa5 --- /dev/null +++ b/app/include/ac_io_0021.h @@ -0,0 +1,14 @@ +/* + * ac_io_0021.h - 매입 보조 DBIO 선언 (ac_io_0021.pgc 구현) + */ +#ifndef AC_IO_0021_H +#define AC_IO_0021_H + +#include "txcore.h" + +/* ac_io_0021 전용 조회/갱신 (테이블 ac_io_0021_t) */ +int ac_io_0021_fetch(const char *key, long *out_amount); +int ac_io_0021_touch(const char *key, long amount); +long ac_io_0021_total(const char *biz_date); + +#endif /* AC_IO_0021_H */ diff --git a/app/include/ac_io_0022.h b/app/include/ac_io_0022.h new file mode 100644 index 0000000..e1f0f21 --- /dev/null +++ b/app/include/ac_io_0022.h @@ -0,0 +1,14 @@ +/* + * ac_io_0022.h - 매입 보조 DBIO 선언 (ac_io_0022.pgc 구현) + */ +#ifndef AC_IO_0022_H +#define AC_IO_0022_H + +#include "txcore.h" + +/* ac_io_0022 전용 조회/갱신 (테이블 ac_io_0022_t) */ +int ac_io_0022_fetch(const char *key, long *out_amount); +int ac_io_0022_touch(const char *key, long amount); +long ac_io_0022_total(const char *biz_date); + +#endif /* AC_IO_0022_H */ diff --git a/app/include/ac_io_0023.h b/app/include/ac_io_0023.h new file mode 100644 index 0000000..0044efe --- /dev/null +++ b/app/include/ac_io_0023.h @@ -0,0 +1,14 @@ +/* + * ac_io_0023.h - 매입 보조 DBIO 선언 (ac_io_0023.pgc 구현) + */ +#ifndef AC_IO_0023_H +#define AC_IO_0023_H + +#include "txcore.h" + +/* ac_io_0023 전용 조회/갱신 (테이블 ac_io_0023_t) */ +int ac_io_0023_fetch(const char *key, long *out_amount); +int ac_io_0023_touch(const char *key, long amount); +long ac_io_0023_total(const char *biz_date); + +#endif /* AC_IO_0023_H */ diff --git a/app/include/ac_io_0024.h b/app/include/ac_io_0024.h new file mode 100644 index 0000000..2625cf2 --- /dev/null +++ b/app/include/ac_io_0024.h @@ -0,0 +1,14 @@ +/* + * ac_io_0024.h - 매입 보조 DBIO 선언 (ac_io_0024.pgc 구현) + */ +#ifndef AC_IO_0024_H +#define AC_IO_0024_H + +#include "txcore.h" + +/* ac_io_0024 전용 조회/갱신 (테이블 ac_io_0024_t) */ +int ac_io_0024_fetch(const char *key, long *out_amount); +int ac_io_0024_touch(const char *key, long amount); +long ac_io_0024_total(const char *biz_date); + +#endif /* AC_IO_0024_H */ diff --git a/app/include/ac_io_0025.h b/app/include/ac_io_0025.h new file mode 100644 index 0000000..a84ddad --- /dev/null +++ b/app/include/ac_io_0025.h @@ -0,0 +1,14 @@ +/* + * ac_io_0025.h - 매입 보조 DBIO 선언 (ac_io_0025.pgc 구현) + */ +#ifndef AC_IO_0025_H +#define AC_IO_0025_H + +#include "txcore.h" + +/* ac_io_0025 전용 조회/갱신 (테이블 ac_io_0025_t) */ +int ac_io_0025_fetch(const char *key, long *out_amount); +int ac_io_0025_touch(const char *key, long amount); +long ac_io_0025_total(const char *biz_date); + +#endif /* AC_IO_0025_H */ diff --git a/app/include/ac_io_0026.h b/app/include/ac_io_0026.h new file mode 100644 index 0000000..8fef34a --- /dev/null +++ b/app/include/ac_io_0026.h @@ -0,0 +1,14 @@ +/* + * ac_io_0026.h - 매입 보조 DBIO 선언 (ac_io_0026.pgc 구현) + */ +#ifndef AC_IO_0026_H +#define AC_IO_0026_H + +#include "txcore.h" + +/* ac_io_0026 전용 조회/갱신 (테이블 ac_io_0026_t) */ +int ac_io_0026_fetch(const char *key, long *out_amount); +int ac_io_0026_touch(const char *key, long amount); +long ac_io_0026_total(const char *biz_date); + +#endif /* AC_IO_0026_H */ diff --git a/app/include/ac_io_0027.h b/app/include/ac_io_0027.h new file mode 100644 index 0000000..30cf40f --- /dev/null +++ b/app/include/ac_io_0027.h @@ -0,0 +1,14 @@ +/* + * ac_io_0027.h - 매입 보조 DBIO 선언 (ac_io_0027.pgc 구현) + */ +#ifndef AC_IO_0027_H +#define AC_IO_0027_H + +#include "txcore.h" + +/* ac_io_0027 전용 조회/갱신 (테이블 ac_io_0027_t) */ +int ac_io_0027_fetch(const char *key, long *out_amount); +int ac_io_0027_touch(const char *key, long amount); +long ac_io_0027_total(const char *biz_date); + +#endif /* AC_IO_0027_H */ diff --git a/app/include/au_core.h b/app/include/au_core.h new file mode 100644 index 0000000..6dcf4fe --- /dev/null +++ b/app/include/au_core.h @@ -0,0 +1,38 @@ +/* + * au_core.h - 승인한도 모듈 핵심 계약 (레코드/상태/표준 DBIO API) + * + * 이 모듈의 온라인/배치 프로그램은 SQL 을 직접 다루지 않고 아래 표준 + * DBIO API 만 호출한다. 구현은 app/dbio/au_dbio_main.pgc (ECPG). + */ +#ifndef AU_CORE_H +#define AU_CORE_H + +#include "txcore.h" + +/* 승인한도 처리 상태코드 */ +#define AU_ST_RECV "R" /* 접수/수신 */ +#define AU_ST_DONE "M" /* 처리완료 */ +#define AU_ST_FAIL "U" /* 불일치/실패 */ +#define AU_ST_SETTLED "S" /* 정산완료 */ + +/* 승인한도 원장 레코드 (1행) */ +typedef struct { + char key[16]; /* 처리키(승인/거래 번호) PK */ + char merch_id[16]; /* 가맹점번호 */ + char card_no[20]; /* 카드번호(마스킹) */ + long amount; /* 거래금액(원) */ + char biz_date[9]; /* 영업일 YYYYMMDD */ + char status[2]; /* 상태코드 */ + long fee; /* 수수료(원) */ +} au_rec_t; + +/* 표준 DBIO API (구현: au_dbio_main.pgc) */ +int au_dbio_connect(const char *target); +int au_dbio_disconnect(void); +int au_rec_insert(const au_rec_t *rec); +int au_rec_select(const char *key, au_rec_t *out); +int au_rec_update_status(const char *key, const char *status); +long au_rec_count(const char *biz_date, const char *status); +int au_rec_sum(const char *biz_date, long *out_sum); + +#endif /* AU_CORE_H */ diff --git a/app/include/au_cu_0001.h b/app/include/au_cu_0001.h new file mode 100644 index 0000000..7b808cb --- /dev/null +++ b/app/include/au_cu_0001.h @@ -0,0 +1,11 @@ +/* + * au_cu_0001.h - 승인한도 공통 유틸 선언 (au_cu_0001.c 구현) + */ +#ifndef AU_CU_0001_H +#define AU_CU_0001_H + +long au_cu_0001_fee(long amount, int rate_bp); +long au_cu_0001_round_unit(long amount, long unit); +int au_cu_0001_classify(long amount); + +#endif /* AU_CU_0001_H */ diff --git a/app/include/au_cu_0002.h b/app/include/au_cu_0002.h new file mode 100644 index 0000000..f7bc2dc --- /dev/null +++ b/app/include/au_cu_0002.h @@ -0,0 +1,11 @@ +/* + * au_cu_0002.h - 승인한도 공통 유틸 선언 (au_cu_0002.c 구현) + */ +#ifndef AU_CU_0002_H +#define AU_CU_0002_H + +long au_cu_0002_fee(long amount, int rate_bp); +long au_cu_0002_round_unit(long amount, long unit); +int au_cu_0002_classify(long amount); + +#endif /* AU_CU_0002_H */ diff --git a/app/include/au_cu_0003.h b/app/include/au_cu_0003.h new file mode 100644 index 0000000..4cc71f4 --- /dev/null +++ b/app/include/au_cu_0003.h @@ -0,0 +1,11 @@ +/* + * au_cu_0003.h - 승인한도 공통 유틸 선언 (au_cu_0003.c 구현) + */ +#ifndef AU_CU_0003_H +#define AU_CU_0003_H + +long au_cu_0003_fee(long amount, int rate_bp); +long au_cu_0003_round_unit(long amount, long unit); +int au_cu_0003_classify(long amount); + +#endif /* AU_CU_0003_H */ diff --git a/app/include/au_cu_0004.h b/app/include/au_cu_0004.h new file mode 100644 index 0000000..faba070 --- /dev/null +++ b/app/include/au_cu_0004.h @@ -0,0 +1,11 @@ +/* + * au_cu_0004.h - 승인한도 공통 유틸 선언 (au_cu_0004.c 구현) + */ +#ifndef AU_CU_0004_H +#define AU_CU_0004_H + +long au_cu_0004_fee(long amount, int rate_bp); +long au_cu_0004_round_unit(long amount, long unit); +int au_cu_0004_classify(long amount); + +#endif /* AU_CU_0004_H */ diff --git a/app/include/au_cu_0005.h b/app/include/au_cu_0005.h new file mode 100644 index 0000000..cd67ab3 --- /dev/null +++ b/app/include/au_cu_0005.h @@ -0,0 +1,11 @@ +/* + * au_cu_0005.h - 승인한도 공통 유틸 선언 (au_cu_0005.c 구현) + */ +#ifndef AU_CU_0005_H +#define AU_CU_0005_H + +long au_cu_0005_fee(long amount, int rate_bp); +long au_cu_0005_round_unit(long amount, long unit); +int au_cu_0005_classify(long amount); + +#endif /* AU_CU_0005_H */ diff --git a/app/include/au_cu_0006.h b/app/include/au_cu_0006.h new file mode 100644 index 0000000..d824efd --- /dev/null +++ b/app/include/au_cu_0006.h @@ -0,0 +1,11 @@ +/* + * au_cu_0006.h - 승인한도 공통 유틸 선언 (au_cu_0006.c 구현) + */ +#ifndef AU_CU_0006_H +#define AU_CU_0006_H + +long au_cu_0006_fee(long amount, int rate_bp); +long au_cu_0006_round_unit(long amount, long unit); +int au_cu_0006_classify(long amount); + +#endif /* AU_CU_0006_H */ diff --git a/app/include/au_cu_0007.h b/app/include/au_cu_0007.h new file mode 100644 index 0000000..a159d33 --- /dev/null +++ b/app/include/au_cu_0007.h @@ -0,0 +1,11 @@ +/* + * au_cu_0007.h - 승인한도 공통 유틸 선언 (au_cu_0007.c 구현) + */ +#ifndef AU_CU_0007_H +#define AU_CU_0007_H + +long au_cu_0007_fee(long amount, int rate_bp); +long au_cu_0007_round_unit(long amount, long unit); +int au_cu_0007_classify(long amount); + +#endif /* AU_CU_0007_H */ diff --git a/app/include/au_cu_0008.h b/app/include/au_cu_0008.h new file mode 100644 index 0000000..5484c09 --- /dev/null +++ b/app/include/au_cu_0008.h @@ -0,0 +1,11 @@ +/* + * au_cu_0008.h - 승인한도 공통 유틸 선언 (au_cu_0008.c 구현) + */ +#ifndef AU_CU_0008_H +#define AU_CU_0008_H + +long au_cu_0008_fee(long amount, int rate_bp); +long au_cu_0008_round_unit(long amount, long unit); +int au_cu_0008_classify(long amount); + +#endif /* AU_CU_0008_H */ diff --git a/app/include/au_cu_0009.h b/app/include/au_cu_0009.h new file mode 100644 index 0000000..b3b5a70 --- /dev/null +++ b/app/include/au_cu_0009.h @@ -0,0 +1,11 @@ +/* + * au_cu_0009.h - 승인한도 공통 유틸 선언 (au_cu_0009.c 구현) + */ +#ifndef AU_CU_0009_H +#define AU_CU_0009_H + +long au_cu_0009_fee(long amount, int rate_bp); +long au_cu_0009_round_unit(long amount, long unit); +int au_cu_0009_classify(long amount); + +#endif /* AU_CU_0009_H */ diff --git a/app/include/au_cu_0010.h b/app/include/au_cu_0010.h new file mode 100644 index 0000000..7f57199 --- /dev/null +++ b/app/include/au_cu_0010.h @@ -0,0 +1,11 @@ +/* + * au_cu_0010.h - 승인한도 공통 유틸 선언 (au_cu_0010.c 구현) + */ +#ifndef AU_CU_0010_H +#define AU_CU_0010_H + +long au_cu_0010_fee(long amount, int rate_bp); +long au_cu_0010_round_unit(long amount, long unit); +int au_cu_0010_classify(long amount); + +#endif /* AU_CU_0010_H */ diff --git a/app/include/au_cu_0011.h b/app/include/au_cu_0011.h new file mode 100644 index 0000000..d615dfc --- /dev/null +++ b/app/include/au_cu_0011.h @@ -0,0 +1,11 @@ +/* + * au_cu_0011.h - 승인한도 공통 유틸 선언 (au_cu_0011.c 구현) + */ +#ifndef AU_CU_0011_H +#define AU_CU_0011_H + +long au_cu_0011_fee(long amount, int rate_bp); +long au_cu_0011_round_unit(long amount, long unit); +int au_cu_0011_classify(long amount); + +#endif /* AU_CU_0011_H */ diff --git a/app/include/au_h_0001.h b/app/include/au_h_0001.h new file mode 100644 index 0000000..ad93cfb --- /dev/null +++ b/app/include/au_h_0001.h @@ -0,0 +1,19 @@ +/* + * au_h_0001.h - 승인한도 고정길이 전문 레이아웃 (positional, 재배치 금지) + */ +#ifndef AU_H_0001_H +#define AU_H_0001_H + +typedef struct { + char msg_type[4]; /* 전문구분 4 */ + char merch_id[15]; /* 가맹점번호 15 */ + char key[9]; /* 처리키 9 */ + char amount[12]; /* 금액 12 zero-pad */ + char biz_date[8]; /* 영업일 8 */ + char resp_code[4]; /* 응답코드 4 */ + char filler[20]; /* 예비 20 */ +} au_h_0001_msg_t; + +#define AU_H_0001_MSG_LEN ((int)sizeof(au_h_0001_msg_t)) + +#endif /* AU_H_0001_H */ diff --git a/app/include/au_h_0002.h b/app/include/au_h_0002.h new file mode 100644 index 0000000..d13ee3d --- /dev/null +++ b/app/include/au_h_0002.h @@ -0,0 +1,22 @@ +/* + * au_h_0002.h - 승인한도 레코드/뷰 구조 정의 + */ +#ifndef AU_H_0002_H +#define AU_H_0002_H + +/* 승인한도 처리 뷰 레코드 */ +typedef struct { + char key[16]; + char merch_id[16]; + long amount; + long fee; + char biz_date[9]; + char status[2]; + char reserved[16]; +} au_h_0002_view_t; + +#define AU_H_0002_STATUS_OPEN "O" +#define AU_H_0002_STATUS_HOLD "H" +#define AU_H_0002_STATUS_CLOSE "C" + +#endif /* AU_H_0002_H */ diff --git a/app/include/au_h_0003.h b/app/include/au_h_0003.h new file mode 100644 index 0000000..5a3f99d --- /dev/null +++ b/app/include/au_h_0003.h @@ -0,0 +1,13 @@ +/* + * au_h_0003.h - 승인한도 내부 헬퍼 선언 + */ +#ifndef AU_H_0003_H +#define AU_H_0003_H + +#include "txcore.h" + +int au_h_0003_check(const char *key, long amount); +int au_h_0003_apply(TXBUF *in, TXBUF *out); +long au_h_0003_eval(long amount, int factor); + +#endif /* AU_H_0003_H */ diff --git a/app/include/au_h_0004.h b/app/include/au_h_0004.h new file mode 100644 index 0000000..4c1e25c --- /dev/null +++ b/app/include/au_h_0004.h @@ -0,0 +1,20 @@ +/* + * au_h_0004.h - 승인한도 코드/상수 테이블 + */ +#ifndef AU_H_0004_H +#define AU_H_0004_H + +#define AU_H_0004_RC_OK 0 +#define AU_H_0004_RC_RETRY 1 +#define AU_H_0004_RC_SKIP 2 +#define AU_H_0004_RC_ERROR 9 + +#define AU_H_0004_LIMIT_DAILY 100000000L +#define AU_H_0004_LIMIT_SINGLE 50000000L +#define AU_H_0004_FEE_RATE_BP 250 /* 2.50% */ + +#define AU_H_0004_CHAN_ONLINE "01" +#define AU_H_0004_CHAN_BATCH "02" +#define AU_H_0004_CHAN_RECON "03" + +#endif /* AU_H_0004_H */ diff --git a/app/include/au_h_0005.h b/app/include/au_h_0005.h new file mode 100644 index 0000000..bbea7ab --- /dev/null +++ b/app/include/au_h_0005.h @@ -0,0 +1,19 @@ +/* + * au_h_0005.h - 승인한도 고정길이 전문 레이아웃 (positional, 재배치 금지) + */ +#ifndef AU_H_0005_H +#define AU_H_0005_H + +typedef struct { + char msg_type[4]; /* 전문구분 4 */ + char merch_id[15]; /* 가맹점번호 15 */ + char key[9]; /* 처리키 9 */ + char amount[12]; /* 금액 12 zero-pad */ + char biz_date[8]; /* 영업일 8 */ + char resp_code[4]; /* 응답코드 4 */ + char filler[20]; /* 예비 20 */ +} au_h_0005_msg_t; + +#define AU_H_0005_MSG_LEN ((int)sizeof(au_h_0005_msg_t)) + +#endif /* AU_H_0005_H */ diff --git a/app/include/au_h_0006.h b/app/include/au_h_0006.h new file mode 100644 index 0000000..d484696 --- /dev/null +++ b/app/include/au_h_0006.h @@ -0,0 +1,22 @@ +/* + * au_h_0006.h - 승인한도 레코드/뷰 구조 정의 + */ +#ifndef AU_H_0006_H +#define AU_H_0006_H + +/* 승인한도 처리 뷰 레코드 */ +typedef struct { + char key[16]; + char merch_id[16]; + long amount; + long fee; + char biz_date[9]; + char status[2]; + char reserved[16]; +} au_h_0006_view_t; + +#define AU_H_0006_STATUS_OPEN "O" +#define AU_H_0006_STATUS_HOLD "H" +#define AU_H_0006_STATUS_CLOSE "C" + +#endif /* AU_H_0006_H */ diff --git a/app/include/au_h_0007.h b/app/include/au_h_0007.h new file mode 100644 index 0000000..768b409 --- /dev/null +++ b/app/include/au_h_0007.h @@ -0,0 +1,13 @@ +/* + * au_h_0007.h - 승인한도 내부 헬퍼 선언 + */ +#ifndef AU_H_0007_H +#define AU_H_0007_H + +#include "txcore.h" + +int au_h_0007_check(const char *key, long amount); +int au_h_0007_apply(TXBUF *in, TXBUF *out); +long au_h_0007_eval(long amount, int factor); + +#endif /* AU_H_0007_H */ diff --git a/app/include/au_h_0008.h b/app/include/au_h_0008.h new file mode 100644 index 0000000..9e979c3 --- /dev/null +++ b/app/include/au_h_0008.h @@ -0,0 +1,20 @@ +/* + * au_h_0008.h - 승인한도 코드/상수 테이블 + */ +#ifndef AU_H_0008_H +#define AU_H_0008_H + +#define AU_H_0008_RC_OK 0 +#define AU_H_0008_RC_RETRY 1 +#define AU_H_0008_RC_SKIP 2 +#define AU_H_0008_RC_ERROR 9 + +#define AU_H_0008_LIMIT_DAILY 100000000L +#define AU_H_0008_LIMIT_SINGLE 50000000L +#define AU_H_0008_FEE_RATE_BP 250 /* 2.50% */ + +#define AU_H_0008_CHAN_ONLINE "01" +#define AU_H_0008_CHAN_BATCH "02" +#define AU_H_0008_CHAN_RECON "03" + +#endif /* AU_H_0008_H */ diff --git a/app/include/au_h_0009.h b/app/include/au_h_0009.h new file mode 100644 index 0000000..9d96b89 --- /dev/null +++ b/app/include/au_h_0009.h @@ -0,0 +1,19 @@ +/* + * au_h_0009.h - 승인한도 고정길이 전문 레이아웃 (positional, 재배치 금지) + */ +#ifndef AU_H_0009_H +#define AU_H_0009_H + +typedef struct { + char msg_type[4]; /* 전문구분 4 */ + char merch_id[15]; /* 가맹점번호 15 */ + char key[9]; /* 처리키 9 */ + char amount[12]; /* 금액 12 zero-pad */ + char biz_date[8]; /* 영업일 8 */ + char resp_code[4]; /* 응답코드 4 */ + char filler[20]; /* 예비 20 */ +} au_h_0009_msg_t; + +#define AU_H_0009_MSG_LEN ((int)sizeof(au_h_0009_msg_t)) + +#endif /* AU_H_0009_H */ diff --git a/app/include/au_h_0010.h b/app/include/au_h_0010.h new file mode 100644 index 0000000..eed8be4 --- /dev/null +++ b/app/include/au_h_0010.h @@ -0,0 +1,22 @@ +/* + * au_h_0010.h - 승인한도 레코드/뷰 구조 정의 + */ +#ifndef AU_H_0010_H +#define AU_H_0010_H + +/* 승인한도 처리 뷰 레코드 */ +typedef struct { + char key[16]; + char merch_id[16]; + long amount; + long fee; + char biz_date[9]; + char status[2]; + char reserved[16]; +} au_h_0010_view_t; + +#define AU_H_0010_STATUS_OPEN "O" +#define AU_H_0010_STATUS_HOLD "H" +#define AU_H_0010_STATUS_CLOSE "C" + +#endif /* AU_H_0010_H */ diff --git a/app/include/au_h_0011.h b/app/include/au_h_0011.h new file mode 100644 index 0000000..1da7a45 --- /dev/null +++ b/app/include/au_h_0011.h @@ -0,0 +1,13 @@ +/* + * au_h_0011.h - 승인한도 내부 헬퍼 선언 + */ +#ifndef AU_H_0011_H +#define AU_H_0011_H + +#include "txcore.h" + +int au_h_0011_check(const char *key, long amount); +int au_h_0011_apply(TXBUF *in, TXBUF *out); +long au_h_0011_eval(long amount, int factor); + +#endif /* AU_H_0011_H */ diff --git a/app/include/au_h_0012.h b/app/include/au_h_0012.h new file mode 100644 index 0000000..e5b3251 --- /dev/null +++ b/app/include/au_h_0012.h @@ -0,0 +1,20 @@ +/* + * au_h_0012.h - 승인한도 코드/상수 테이블 + */ +#ifndef AU_H_0012_H +#define AU_H_0012_H + +#define AU_H_0012_RC_OK 0 +#define AU_H_0012_RC_RETRY 1 +#define AU_H_0012_RC_SKIP 2 +#define AU_H_0012_RC_ERROR 9 + +#define AU_H_0012_LIMIT_DAILY 100000000L +#define AU_H_0012_LIMIT_SINGLE 50000000L +#define AU_H_0012_FEE_RATE_BP 250 /* 2.50% */ + +#define AU_H_0012_CHAN_ONLINE "01" +#define AU_H_0012_CHAN_BATCH "02" +#define AU_H_0012_CHAN_RECON "03" + +#endif /* AU_H_0012_H */ diff --git a/app/include/au_h_0013.h b/app/include/au_h_0013.h new file mode 100644 index 0000000..2784707 --- /dev/null +++ b/app/include/au_h_0013.h @@ -0,0 +1,19 @@ +/* + * au_h_0013.h - 승인한도 고정길이 전문 레이아웃 (positional, 재배치 금지) + */ +#ifndef AU_H_0013_H +#define AU_H_0013_H + +typedef struct { + char msg_type[4]; /* 전문구분 4 */ + char merch_id[15]; /* 가맹점번호 15 */ + char key[9]; /* 처리키 9 */ + char amount[12]; /* 금액 12 zero-pad */ + char biz_date[8]; /* 영업일 8 */ + char resp_code[4]; /* 응답코드 4 */ + char filler[20]; /* 예비 20 */ +} au_h_0013_msg_t; + +#define AU_H_0013_MSG_LEN ((int)sizeof(au_h_0013_msg_t)) + +#endif /* AU_H_0013_H */ diff --git a/app/include/au_h_0014.h b/app/include/au_h_0014.h new file mode 100644 index 0000000..d4c193d --- /dev/null +++ b/app/include/au_h_0014.h @@ -0,0 +1,22 @@ +/* + * au_h_0014.h - 승인한도 레코드/뷰 구조 정의 + */ +#ifndef AU_H_0014_H +#define AU_H_0014_H + +/* 승인한도 처리 뷰 레코드 */ +typedef struct { + char key[16]; + char merch_id[16]; + long amount; + long fee; + char biz_date[9]; + char status[2]; + char reserved[16]; +} au_h_0014_view_t; + +#define AU_H_0014_STATUS_OPEN "O" +#define AU_H_0014_STATUS_HOLD "H" +#define AU_H_0014_STATUS_CLOSE "C" + +#endif /* AU_H_0014_H */ diff --git a/app/include/au_h_0015.h b/app/include/au_h_0015.h new file mode 100644 index 0000000..5b027a7 --- /dev/null +++ b/app/include/au_h_0015.h @@ -0,0 +1,13 @@ +/* + * au_h_0015.h - 승인한도 내부 헬퍼 선언 + */ +#ifndef AU_H_0015_H +#define AU_H_0015_H + +#include "txcore.h" + +int au_h_0015_check(const char *key, long amount); +int au_h_0015_apply(TXBUF *in, TXBUF *out); +long au_h_0015_eval(long amount, int factor); + +#endif /* AU_H_0015_H */ diff --git a/app/include/au_h_0016.h b/app/include/au_h_0016.h new file mode 100644 index 0000000..f62c406 --- /dev/null +++ b/app/include/au_h_0016.h @@ -0,0 +1,20 @@ +/* + * au_h_0016.h - 승인한도 코드/상수 테이블 + */ +#ifndef AU_H_0016_H +#define AU_H_0016_H + +#define AU_H_0016_RC_OK 0 +#define AU_H_0016_RC_RETRY 1 +#define AU_H_0016_RC_SKIP 2 +#define AU_H_0016_RC_ERROR 9 + +#define AU_H_0016_LIMIT_DAILY 100000000L +#define AU_H_0016_LIMIT_SINGLE 50000000L +#define AU_H_0016_FEE_RATE_BP 250 /* 2.50% */ + +#define AU_H_0016_CHAN_ONLINE "01" +#define AU_H_0016_CHAN_BATCH "02" +#define AU_H_0016_CHAN_RECON "03" + +#endif /* AU_H_0016_H */ diff --git a/app/include/au_h_0017.h b/app/include/au_h_0017.h new file mode 100644 index 0000000..4f2583e --- /dev/null +++ b/app/include/au_h_0017.h @@ -0,0 +1,19 @@ +/* + * au_h_0017.h - 승인한도 고정길이 전문 레이아웃 (positional, 재배치 금지) + */ +#ifndef AU_H_0017_H +#define AU_H_0017_H + +typedef struct { + char msg_type[4]; /* 전문구분 4 */ + char merch_id[15]; /* 가맹점번호 15 */ + char key[9]; /* 처리키 9 */ + char amount[12]; /* 금액 12 zero-pad */ + char biz_date[8]; /* 영업일 8 */ + char resp_code[4]; /* 응답코드 4 */ + char filler[20]; /* 예비 20 */ +} au_h_0017_msg_t; + +#define AU_H_0017_MSG_LEN ((int)sizeof(au_h_0017_msg_t)) + +#endif /* AU_H_0017_H */ diff --git a/app/include/au_io_0001.h b/app/include/au_io_0001.h new file mode 100644 index 0000000..8ca3828 --- /dev/null +++ b/app/include/au_io_0001.h @@ -0,0 +1,14 @@ +/* + * au_io_0001.h - 승인한도 보조 DBIO 선언 (au_io_0001.pgc 구현) + */ +#ifndef AU_IO_0001_H +#define AU_IO_0001_H + +#include "txcore.h" + +/* au_io_0001 전용 조회/갱신 (테이블 au_io_0001_t) */ +int au_io_0001_fetch(const char *key, long *out_amount); +int au_io_0001_touch(const char *key, long amount); +long au_io_0001_total(const char *biz_date); + +#endif /* AU_IO_0001_H */ diff --git a/app/include/au_io_0002.h b/app/include/au_io_0002.h new file mode 100644 index 0000000..aaca2fb --- /dev/null +++ b/app/include/au_io_0002.h @@ -0,0 +1,14 @@ +/* + * au_io_0002.h - 승인한도 보조 DBIO 선언 (au_io_0002.pgc 구현) + */ +#ifndef AU_IO_0002_H +#define AU_IO_0002_H + +#include "txcore.h" + +/* au_io_0002 전용 조회/갱신 (테이블 au_io_0002_t) */ +int au_io_0002_fetch(const char *key, long *out_amount); +int au_io_0002_touch(const char *key, long amount); +long au_io_0002_total(const char *biz_date); + +#endif /* AU_IO_0002_H */ diff --git a/app/include/au_io_0003.h b/app/include/au_io_0003.h new file mode 100644 index 0000000..37e6224 --- /dev/null +++ b/app/include/au_io_0003.h @@ -0,0 +1,14 @@ +/* + * au_io_0003.h - 승인한도 보조 DBIO 선언 (au_io_0003.pgc 구현) + */ +#ifndef AU_IO_0003_H +#define AU_IO_0003_H + +#include "txcore.h" + +/* au_io_0003 전용 조회/갱신 (테이블 au_io_0003_t) */ +int au_io_0003_fetch(const char *key, long *out_amount); +int au_io_0003_touch(const char *key, long amount); +long au_io_0003_total(const char *biz_date); + +#endif /* AU_IO_0003_H */ diff --git a/app/include/au_io_0004.h b/app/include/au_io_0004.h new file mode 100644 index 0000000..e532208 --- /dev/null +++ b/app/include/au_io_0004.h @@ -0,0 +1,14 @@ +/* + * au_io_0004.h - 승인한도 보조 DBIO 선언 (au_io_0004.pgc 구현) + */ +#ifndef AU_IO_0004_H +#define AU_IO_0004_H + +#include "txcore.h" + +/* au_io_0004 전용 조회/갱신 (테이블 au_io_0004_t) */ +int au_io_0004_fetch(const char *key, long *out_amount); +int au_io_0004_touch(const char *key, long amount); +long au_io_0004_total(const char *biz_date); + +#endif /* AU_IO_0004_H */ diff --git a/app/include/au_io_0005.h b/app/include/au_io_0005.h new file mode 100644 index 0000000..468dfe4 --- /dev/null +++ b/app/include/au_io_0005.h @@ -0,0 +1,14 @@ +/* + * au_io_0005.h - 승인한도 보조 DBIO 선언 (au_io_0005.pgc 구현) + */ +#ifndef AU_IO_0005_H +#define AU_IO_0005_H + +#include "txcore.h" + +/* au_io_0005 전용 조회/갱신 (테이블 au_io_0005_t) */ +int au_io_0005_fetch(const char *key, long *out_amount); +int au_io_0005_touch(const char *key, long amount); +long au_io_0005_total(const char *biz_date); + +#endif /* AU_IO_0005_H */ diff --git a/app/include/au_io_0006.h b/app/include/au_io_0006.h new file mode 100644 index 0000000..e01d2c9 --- /dev/null +++ b/app/include/au_io_0006.h @@ -0,0 +1,14 @@ +/* + * au_io_0006.h - 승인한도 보조 DBIO 선언 (au_io_0006.pgc 구현) + */ +#ifndef AU_IO_0006_H +#define AU_IO_0006_H + +#include "txcore.h" + +/* au_io_0006 전용 조회/갱신 (테이블 au_io_0006_t) */ +int au_io_0006_fetch(const char *key, long *out_amount); +int au_io_0006_touch(const char *key, long amount); +long au_io_0006_total(const char *biz_date); + +#endif /* AU_IO_0006_H */ diff --git a/app/include/au_io_0007.h b/app/include/au_io_0007.h new file mode 100644 index 0000000..be56957 --- /dev/null +++ b/app/include/au_io_0007.h @@ -0,0 +1,14 @@ +/* + * au_io_0007.h - 승인한도 보조 DBIO 선언 (au_io_0007.pgc 구현) + */ +#ifndef AU_IO_0007_H +#define AU_IO_0007_H + +#include "txcore.h" + +/* au_io_0007 전용 조회/갱신 (테이블 au_io_0007_t) */ +int au_io_0007_fetch(const char *key, long *out_amount); +int au_io_0007_touch(const char *key, long amount); +long au_io_0007_total(const char *biz_date); + +#endif /* AU_IO_0007_H */ diff --git a/app/include/au_io_0008.h b/app/include/au_io_0008.h new file mode 100644 index 0000000..9e12cf4 --- /dev/null +++ b/app/include/au_io_0008.h @@ -0,0 +1,14 @@ +/* + * au_io_0008.h - 승인한도 보조 DBIO 선언 (au_io_0008.pgc 구현) + */ +#ifndef AU_IO_0008_H +#define AU_IO_0008_H + +#include "txcore.h" + +/* au_io_0008 전용 조회/갱신 (테이블 au_io_0008_t) */ +int au_io_0008_fetch(const char *key, long *out_amount); +int au_io_0008_touch(const char *key, long amount); +long au_io_0008_total(const char *biz_date); + +#endif /* AU_IO_0008_H */ diff --git a/app/include/au_io_0009.h b/app/include/au_io_0009.h new file mode 100644 index 0000000..073813f --- /dev/null +++ b/app/include/au_io_0009.h @@ -0,0 +1,14 @@ +/* + * au_io_0009.h - 승인한도 보조 DBIO 선언 (au_io_0009.pgc 구현) + */ +#ifndef AU_IO_0009_H +#define AU_IO_0009_H + +#include "txcore.h" + +/* au_io_0009 전용 조회/갱신 (테이블 au_io_0009_t) */ +int au_io_0009_fetch(const char *key, long *out_amount); +int au_io_0009_touch(const char *key, long amount); +long au_io_0009_total(const char *biz_date); + +#endif /* AU_IO_0009_H */ diff --git a/app/include/au_io_0010.h b/app/include/au_io_0010.h new file mode 100644 index 0000000..80cccaa --- /dev/null +++ b/app/include/au_io_0010.h @@ -0,0 +1,14 @@ +/* + * au_io_0010.h - 승인한도 보조 DBIO 선언 (au_io_0010.pgc 구현) + */ +#ifndef AU_IO_0010_H +#define AU_IO_0010_H + +#include "txcore.h" + +/* au_io_0010 전용 조회/갱신 (테이블 au_io_0010_t) */ +int au_io_0010_fetch(const char *key, long *out_amount); +int au_io_0010_touch(const char *key, long amount); +long au_io_0010_total(const char *biz_date); + +#endif /* AU_IO_0010_H */ diff --git a/app/include/au_io_0011.h b/app/include/au_io_0011.h new file mode 100644 index 0000000..d764a70 --- /dev/null +++ b/app/include/au_io_0011.h @@ -0,0 +1,14 @@ +/* + * au_io_0011.h - 승인한도 보조 DBIO 선언 (au_io_0011.pgc 구현) + */ +#ifndef AU_IO_0011_H +#define AU_IO_0011_H + +#include "txcore.h" + +/* au_io_0011 전용 조회/갱신 (테이블 au_io_0011_t) */ +int au_io_0011_fetch(const char *key, long *out_amount); +int au_io_0011_touch(const char *key, long amount); +long au_io_0011_total(const char *biz_date); + +#endif /* AU_IO_0011_H */ diff --git a/app/include/au_io_0012.h b/app/include/au_io_0012.h new file mode 100644 index 0000000..da3e4a5 --- /dev/null +++ b/app/include/au_io_0012.h @@ -0,0 +1,14 @@ +/* + * au_io_0012.h - 승인한도 보조 DBIO 선언 (au_io_0012.pgc 구현) + */ +#ifndef AU_IO_0012_H +#define AU_IO_0012_H + +#include "txcore.h" + +/* au_io_0012 전용 조회/갱신 (테이블 au_io_0012_t) */ +int au_io_0012_fetch(const char *key, long *out_amount); +int au_io_0012_touch(const char *key, long amount); +long au_io_0012_total(const char *biz_date); + +#endif /* AU_IO_0012_H */ diff --git a/app/include/au_io_0013.h b/app/include/au_io_0013.h new file mode 100644 index 0000000..f6daf72 --- /dev/null +++ b/app/include/au_io_0013.h @@ -0,0 +1,14 @@ +/* + * au_io_0013.h - 승인한도 보조 DBIO 선언 (au_io_0013.pgc 구현) + */ +#ifndef AU_IO_0013_H +#define AU_IO_0013_H + +#include "txcore.h" + +/* au_io_0013 전용 조회/갱신 (테이블 au_io_0013_t) */ +int au_io_0013_fetch(const char *key, long *out_amount); +int au_io_0013_touch(const char *key, long amount); +long au_io_0013_total(const char *biz_date); + +#endif /* AU_IO_0013_H */ diff --git a/app/include/au_io_0014.h b/app/include/au_io_0014.h new file mode 100644 index 0000000..447a1f5 --- /dev/null +++ b/app/include/au_io_0014.h @@ -0,0 +1,14 @@ +/* + * au_io_0014.h - 승인한도 보조 DBIO 선언 (au_io_0014.pgc 구현) + */ +#ifndef AU_IO_0014_H +#define AU_IO_0014_H + +#include "txcore.h" + +/* au_io_0014 전용 조회/갱신 (테이블 au_io_0014_t) */ +int au_io_0014_fetch(const char *key, long *out_amount); +int au_io_0014_touch(const char *key, long amount); +long au_io_0014_total(const char *biz_date); + +#endif /* AU_IO_0014_H */ diff --git a/app/include/au_io_0015.h b/app/include/au_io_0015.h new file mode 100644 index 0000000..d6bf20e --- /dev/null +++ b/app/include/au_io_0015.h @@ -0,0 +1,14 @@ +/* + * au_io_0015.h - 승인한도 보조 DBIO 선언 (au_io_0015.pgc 구현) + */ +#ifndef AU_IO_0015_H +#define AU_IO_0015_H + +#include "txcore.h" + +/* au_io_0015 전용 조회/갱신 (테이블 au_io_0015_t) */ +int au_io_0015_fetch(const char *key, long *out_amount); +int au_io_0015_touch(const char *key, long amount); +long au_io_0015_total(const char *biz_date); + +#endif /* AU_IO_0015_H */ diff --git a/app/include/au_io_0016.h b/app/include/au_io_0016.h new file mode 100644 index 0000000..8257184 --- /dev/null +++ b/app/include/au_io_0016.h @@ -0,0 +1,14 @@ +/* + * au_io_0016.h - 승인한도 보조 DBIO 선언 (au_io_0016.pgc 구현) + */ +#ifndef AU_IO_0016_H +#define AU_IO_0016_H + +#include "txcore.h" + +/* au_io_0016 전용 조회/갱신 (테이블 au_io_0016_t) */ +int au_io_0016_fetch(const char *key, long *out_amount); +int au_io_0016_touch(const char *key, long amount); +long au_io_0016_total(const char *biz_date); + +#endif /* AU_IO_0016_H */ diff --git a/app/include/au_io_0017.h b/app/include/au_io_0017.h new file mode 100644 index 0000000..f44992b --- /dev/null +++ b/app/include/au_io_0017.h @@ -0,0 +1,14 @@ +/* + * au_io_0017.h - 승인한도 보조 DBIO 선언 (au_io_0017.pgc 구현) + */ +#ifndef AU_IO_0017_H +#define AU_IO_0017_H + +#include "txcore.h" + +/* au_io_0017 전용 조회/갱신 (테이블 au_io_0017_t) */ +int au_io_0017_fetch(const char *key, long *out_amount); +int au_io_0017_touch(const char *key, long amount); +long au_io_0017_total(const char *biz_date); + +#endif /* AU_IO_0017_H */ diff --git a/app/include/au_io_0018.h b/app/include/au_io_0018.h new file mode 100644 index 0000000..f51a39e --- /dev/null +++ b/app/include/au_io_0018.h @@ -0,0 +1,14 @@ +/* + * au_io_0018.h - 승인한도 보조 DBIO 선언 (au_io_0018.pgc 구현) + */ +#ifndef AU_IO_0018_H +#define AU_IO_0018_H + +#include "txcore.h" + +/* au_io_0018 전용 조회/갱신 (테이블 au_io_0018_t) */ +int au_io_0018_fetch(const char *key, long *out_amount); +int au_io_0018_touch(const char *key, long amount); +long au_io_0018_total(const char *biz_date); + +#endif /* AU_IO_0018_H */ diff --git a/app/include/au_io_0019.h b/app/include/au_io_0019.h new file mode 100644 index 0000000..78997cc --- /dev/null +++ b/app/include/au_io_0019.h @@ -0,0 +1,14 @@ +/* + * au_io_0019.h - 승인한도 보조 DBIO 선언 (au_io_0019.pgc 구현) + */ +#ifndef AU_IO_0019_H +#define AU_IO_0019_H + +#include "txcore.h" + +/* au_io_0019 전용 조회/갱신 (테이블 au_io_0019_t) */ +int au_io_0019_fetch(const char *key, long *out_amount); +int au_io_0019_touch(const char *key, long amount); +long au_io_0019_total(const char *biz_date); + +#endif /* AU_IO_0019_H */ diff --git a/app/include/au_io_0020.h b/app/include/au_io_0020.h new file mode 100644 index 0000000..27fdd84 --- /dev/null +++ b/app/include/au_io_0020.h @@ -0,0 +1,14 @@ +/* + * au_io_0020.h - 승인한도 보조 DBIO 선언 (au_io_0020.pgc 구현) + */ +#ifndef AU_IO_0020_H +#define AU_IO_0020_H + +#include "txcore.h" + +/* au_io_0020 전용 조회/갱신 (테이블 au_io_0020_t) */ +int au_io_0020_fetch(const char *key, long *out_amount); +int au_io_0020_touch(const char *key, long amount); +long au_io_0020_total(const char *biz_date); + +#endif /* AU_IO_0020_H */ diff --git a/app/include/au_io_0021.h b/app/include/au_io_0021.h new file mode 100644 index 0000000..7d2af8e --- /dev/null +++ b/app/include/au_io_0021.h @@ -0,0 +1,14 @@ +/* + * au_io_0021.h - 승인한도 보조 DBIO 선언 (au_io_0021.pgc 구현) + */ +#ifndef AU_IO_0021_H +#define AU_IO_0021_H + +#include "txcore.h" + +/* au_io_0021 전용 조회/갱신 (테이블 au_io_0021_t) */ +int au_io_0021_fetch(const char *key, long *out_amount); +int au_io_0021_touch(const char *key, long amount); +long au_io_0021_total(const char *biz_date); + +#endif /* AU_IO_0021_H */ diff --git a/app/include/au_io_0022.h b/app/include/au_io_0022.h new file mode 100644 index 0000000..d9b271c --- /dev/null +++ b/app/include/au_io_0022.h @@ -0,0 +1,14 @@ +/* + * au_io_0022.h - 승인한도 보조 DBIO 선언 (au_io_0022.pgc 구현) + */ +#ifndef AU_IO_0022_H +#define AU_IO_0022_H + +#include "txcore.h" + +/* au_io_0022 전용 조회/갱신 (테이블 au_io_0022_t) */ +int au_io_0022_fetch(const char *key, long *out_amount); +int au_io_0022_touch(const char *key, long amount); +long au_io_0022_total(const char *biz_date); + +#endif /* AU_IO_0022_H */ diff --git a/app/include/au_io_0023.h b/app/include/au_io_0023.h new file mode 100644 index 0000000..d02eea4 --- /dev/null +++ b/app/include/au_io_0023.h @@ -0,0 +1,14 @@ +/* + * au_io_0023.h - 승인한도 보조 DBIO 선언 (au_io_0023.pgc 구현) + */ +#ifndef AU_IO_0023_H +#define AU_IO_0023_H + +#include "txcore.h" + +/* au_io_0023 전용 조회/갱신 (테이블 au_io_0023_t) */ +int au_io_0023_fetch(const char *key, long *out_amount); +int au_io_0023_touch(const char *key, long amount); +long au_io_0023_total(const char *biz_date); + +#endif /* AU_IO_0023_H */ diff --git a/app/include/au_io_0024.h b/app/include/au_io_0024.h new file mode 100644 index 0000000..de4e24a --- /dev/null +++ b/app/include/au_io_0024.h @@ -0,0 +1,14 @@ +/* + * au_io_0024.h - 승인한도 보조 DBIO 선언 (au_io_0024.pgc 구현) + */ +#ifndef AU_IO_0024_H +#define AU_IO_0024_H + +#include "txcore.h" + +/* au_io_0024 전용 조회/갱신 (테이블 au_io_0024_t) */ +int au_io_0024_fetch(const char *key, long *out_amount); +int au_io_0024_touch(const char *key, long amount); +long au_io_0024_total(const char *biz_date); + +#endif /* AU_IO_0024_H */ diff --git a/app/include/au_io_0025.h b/app/include/au_io_0025.h new file mode 100644 index 0000000..c41b3ca --- /dev/null +++ b/app/include/au_io_0025.h @@ -0,0 +1,14 @@ +/* + * au_io_0025.h - 승인한도 보조 DBIO 선언 (au_io_0025.pgc 구현) + */ +#ifndef AU_IO_0025_H +#define AU_IO_0025_H + +#include "txcore.h" + +/* au_io_0025 전용 조회/갱신 (테이블 au_io_0025_t) */ +int au_io_0025_fetch(const char *key, long *out_amount); +int au_io_0025_touch(const char *key, long amount); +long au_io_0025_total(const char *biz_date); + +#endif /* AU_IO_0025_H */ diff --git a/app/include/au_io_0026.h b/app/include/au_io_0026.h new file mode 100644 index 0000000..5238c57 --- /dev/null +++ b/app/include/au_io_0026.h @@ -0,0 +1,14 @@ +/* + * au_io_0026.h - 승인한도 보조 DBIO 선언 (au_io_0026.pgc 구현) + */ +#ifndef AU_IO_0026_H +#define AU_IO_0026_H + +#include "txcore.h" + +/* au_io_0026 전용 조회/갱신 (테이블 au_io_0026_t) */ +int au_io_0026_fetch(const char *key, long *out_amount); +int au_io_0026_touch(const char *key, long amount); +long au_io_0026_total(const char *biz_date); + +#endif /* AU_IO_0026_H */ diff --git a/app/include/au_io_0027.h b/app/include/au_io_0027.h new file mode 100644 index 0000000..521d8af --- /dev/null +++ b/app/include/au_io_0027.h @@ -0,0 +1,14 @@ +/* + * au_io_0027.h - 승인한도 보조 DBIO 선언 (au_io_0027.pgc 구현) + */ +#ifndef AU_IO_0027_H +#define AU_IO_0027_H + +#include "txcore.h" + +/* au_io_0027 전용 조회/갱신 (테이블 au_io_0027_t) */ +int au_io_0027_fetch(const char *key, long *out_amount); +int au_io_0027_touch(const char *key, long amount); +long au_io_0027_total(const char *biz_date); + +#endif /* AU_IO_0027_H */ diff --git a/app/include/cl_core.h b/app/include/cl_core.h new file mode 100644 index 0000000..ec88bcb --- /dev/null +++ b/app/include/cl_core.h @@ -0,0 +1,38 @@ +/* + * cl_core.h - 마감 모듈 핵심 계약 (레코드/상태/표준 DBIO API) + * + * 이 모듈의 온라인/배치 프로그램은 SQL 을 직접 다루지 않고 아래 표준 + * DBIO API 만 호출한다. 구현은 app/dbio/cl_dbio_main.pgc (ECPG). + */ +#ifndef CL_CORE_H +#define CL_CORE_H + +#include "txcore.h" + +/* 마감 처리 상태코드 */ +#define CL_ST_RECV "R" /* 접수/수신 */ +#define CL_ST_DONE "M" /* 처리완료 */ +#define CL_ST_FAIL "U" /* 불일치/실패 */ +#define CL_ST_SETTLED "S" /* 정산완료 */ + +/* 마감 원장 레코드 (1행) */ +typedef struct { + char key[16]; /* 처리키(승인/거래 번호) PK */ + char merch_id[16]; /* 가맹점번호 */ + char card_no[20]; /* 카드번호(마스킹) */ + long amount; /* 거래금액(원) */ + char biz_date[9]; /* 영업일 YYYYMMDD */ + char status[2]; /* 상태코드 */ + long fee; /* 수수료(원) */ +} cl_rec_t; + +/* 표준 DBIO API (구현: cl_dbio_main.pgc) */ +int cl_dbio_connect(const char *target); +int cl_dbio_disconnect(void); +int cl_rec_insert(const cl_rec_t *rec); +int cl_rec_select(const char *key, cl_rec_t *out); +int cl_rec_update_status(const char *key, const char *status); +long cl_rec_count(const char *biz_date, const char *status); +int cl_rec_sum(const char *biz_date, long *out_sum); + +#endif /* CL_CORE_H */ diff --git a/app/include/cl_cu_0001.h b/app/include/cl_cu_0001.h new file mode 100644 index 0000000..65aeb32 --- /dev/null +++ b/app/include/cl_cu_0001.h @@ -0,0 +1,11 @@ +/* + * cl_cu_0001.h - 마감 공통 유틸 선언 (cl_cu_0001.c 구현) + */ +#ifndef CL_CU_0001_H +#define CL_CU_0001_H + +long cl_cu_0001_fee(long amount, int rate_bp); +long cl_cu_0001_round_unit(long amount, long unit); +int cl_cu_0001_classify(long amount); + +#endif /* CL_CU_0001_H */ diff --git a/app/include/cl_cu_0002.h b/app/include/cl_cu_0002.h new file mode 100644 index 0000000..3016b97 --- /dev/null +++ b/app/include/cl_cu_0002.h @@ -0,0 +1,11 @@ +/* + * cl_cu_0002.h - 마감 공통 유틸 선언 (cl_cu_0002.c 구현) + */ +#ifndef CL_CU_0002_H +#define CL_CU_0002_H + +long cl_cu_0002_fee(long amount, int rate_bp); +long cl_cu_0002_round_unit(long amount, long unit); +int cl_cu_0002_classify(long amount); + +#endif /* CL_CU_0002_H */ diff --git a/app/include/cl_cu_0003.h b/app/include/cl_cu_0003.h new file mode 100644 index 0000000..a778f22 --- /dev/null +++ b/app/include/cl_cu_0003.h @@ -0,0 +1,11 @@ +/* + * cl_cu_0003.h - 마감 공통 유틸 선언 (cl_cu_0003.c 구현) + */ +#ifndef CL_CU_0003_H +#define CL_CU_0003_H + +long cl_cu_0003_fee(long amount, int rate_bp); +long cl_cu_0003_round_unit(long amount, long unit); +int cl_cu_0003_classify(long amount); + +#endif /* CL_CU_0003_H */ diff --git a/app/include/cl_cu_0004.h b/app/include/cl_cu_0004.h new file mode 100644 index 0000000..7ce93a9 --- /dev/null +++ b/app/include/cl_cu_0004.h @@ -0,0 +1,11 @@ +/* + * cl_cu_0004.h - 마감 공통 유틸 선언 (cl_cu_0004.c 구현) + */ +#ifndef CL_CU_0004_H +#define CL_CU_0004_H + +long cl_cu_0004_fee(long amount, int rate_bp); +long cl_cu_0004_round_unit(long amount, long unit); +int cl_cu_0004_classify(long amount); + +#endif /* CL_CU_0004_H */ diff --git a/app/include/cl_cu_0005.h b/app/include/cl_cu_0005.h new file mode 100644 index 0000000..5a79be5 --- /dev/null +++ b/app/include/cl_cu_0005.h @@ -0,0 +1,11 @@ +/* + * cl_cu_0005.h - 마감 공통 유틸 선언 (cl_cu_0005.c 구현) + */ +#ifndef CL_CU_0005_H +#define CL_CU_0005_H + +long cl_cu_0005_fee(long amount, int rate_bp); +long cl_cu_0005_round_unit(long amount, long unit); +int cl_cu_0005_classify(long amount); + +#endif /* CL_CU_0005_H */ diff --git a/app/include/cl_cu_0006.h b/app/include/cl_cu_0006.h new file mode 100644 index 0000000..749a294 --- /dev/null +++ b/app/include/cl_cu_0006.h @@ -0,0 +1,11 @@ +/* + * cl_cu_0006.h - 마감 공통 유틸 선언 (cl_cu_0006.c 구현) + */ +#ifndef CL_CU_0006_H +#define CL_CU_0006_H + +long cl_cu_0006_fee(long amount, int rate_bp); +long cl_cu_0006_round_unit(long amount, long unit); +int cl_cu_0006_classify(long amount); + +#endif /* CL_CU_0006_H */ diff --git a/app/include/cl_cu_0007.h b/app/include/cl_cu_0007.h new file mode 100644 index 0000000..f58bd9d --- /dev/null +++ b/app/include/cl_cu_0007.h @@ -0,0 +1,11 @@ +/* + * cl_cu_0007.h - 마감 공통 유틸 선언 (cl_cu_0007.c 구현) + */ +#ifndef CL_CU_0007_H +#define CL_CU_0007_H + +long cl_cu_0007_fee(long amount, int rate_bp); +long cl_cu_0007_round_unit(long amount, long unit); +int cl_cu_0007_classify(long amount); + +#endif /* CL_CU_0007_H */ diff --git a/app/include/cl_cu_0008.h b/app/include/cl_cu_0008.h new file mode 100644 index 0000000..e477f80 --- /dev/null +++ b/app/include/cl_cu_0008.h @@ -0,0 +1,11 @@ +/* + * cl_cu_0008.h - 마감 공통 유틸 선언 (cl_cu_0008.c 구현) + */ +#ifndef CL_CU_0008_H +#define CL_CU_0008_H + +long cl_cu_0008_fee(long amount, int rate_bp); +long cl_cu_0008_round_unit(long amount, long unit); +int cl_cu_0008_classify(long amount); + +#endif /* CL_CU_0008_H */ diff --git a/app/include/cl_cu_0009.h b/app/include/cl_cu_0009.h new file mode 100644 index 0000000..4fd3b3a --- /dev/null +++ b/app/include/cl_cu_0009.h @@ -0,0 +1,11 @@ +/* + * cl_cu_0009.h - 마감 공통 유틸 선언 (cl_cu_0009.c 구현) + */ +#ifndef CL_CU_0009_H +#define CL_CU_0009_H + +long cl_cu_0009_fee(long amount, int rate_bp); +long cl_cu_0009_round_unit(long amount, long unit); +int cl_cu_0009_classify(long amount); + +#endif /* CL_CU_0009_H */ diff --git a/app/include/cl_cu_0010.h b/app/include/cl_cu_0010.h new file mode 100644 index 0000000..84e1696 --- /dev/null +++ b/app/include/cl_cu_0010.h @@ -0,0 +1,11 @@ +/* + * cl_cu_0010.h - 마감 공통 유틸 선언 (cl_cu_0010.c 구현) + */ +#ifndef CL_CU_0010_H +#define CL_CU_0010_H + +long cl_cu_0010_fee(long amount, int rate_bp); +long cl_cu_0010_round_unit(long amount, long unit); +int cl_cu_0010_classify(long amount); + +#endif /* CL_CU_0010_H */ diff --git a/app/include/cl_h_0001.h b/app/include/cl_h_0001.h new file mode 100644 index 0000000..0de8b67 --- /dev/null +++ b/app/include/cl_h_0001.h @@ -0,0 +1,20 @@ +/* + * cl_h_0001.h - 마감 코드/상수 테이블 + */ +#ifndef CL_H_0001_H +#define CL_H_0001_H + +#define CL_H_0001_RC_OK 0 +#define CL_H_0001_RC_RETRY 1 +#define CL_H_0001_RC_SKIP 2 +#define CL_H_0001_RC_ERROR 9 + +#define CL_H_0001_LIMIT_DAILY 100000000L +#define CL_H_0001_LIMIT_SINGLE 50000000L +#define CL_H_0001_FEE_RATE_BP 250 /* 2.50% */ + +#define CL_H_0001_CHAN_ONLINE "01" +#define CL_H_0001_CHAN_BATCH "02" +#define CL_H_0001_CHAN_RECON "03" + +#endif /* CL_H_0001_H */ diff --git a/app/include/cl_h_0002.h b/app/include/cl_h_0002.h new file mode 100644 index 0000000..6e415ed --- /dev/null +++ b/app/include/cl_h_0002.h @@ -0,0 +1,19 @@ +/* + * cl_h_0002.h - 마감 고정길이 전문 레이아웃 (positional, 재배치 금지) + */ +#ifndef CL_H_0002_H +#define CL_H_0002_H + +typedef struct { + char msg_type[4]; /* 전문구분 4 */ + char merch_id[15]; /* 가맹점번호 15 */ + char key[9]; /* 처리키 9 */ + char amount[12]; /* 금액 12 zero-pad */ + char biz_date[8]; /* 영업일 8 */ + char resp_code[4]; /* 응답코드 4 */ + char filler[20]; /* 예비 20 */ +} cl_h_0002_msg_t; + +#define CL_H_0002_MSG_LEN ((int)sizeof(cl_h_0002_msg_t)) + +#endif /* CL_H_0002_H */ diff --git a/app/include/cl_h_0003.h b/app/include/cl_h_0003.h new file mode 100644 index 0000000..90b551c --- /dev/null +++ b/app/include/cl_h_0003.h @@ -0,0 +1,22 @@ +/* + * cl_h_0003.h - 마감 레코드/뷰 구조 정의 + */ +#ifndef CL_H_0003_H +#define CL_H_0003_H + +/* 마감 처리 뷰 레코드 */ +typedef struct { + char key[16]; + char merch_id[16]; + long amount; + long fee; + char biz_date[9]; + char status[2]; + char reserved[16]; +} cl_h_0003_view_t; + +#define CL_H_0003_STATUS_OPEN "O" +#define CL_H_0003_STATUS_HOLD "H" +#define CL_H_0003_STATUS_CLOSE "C" + +#endif /* CL_H_0003_H */ diff --git a/app/include/cl_h_0004.h b/app/include/cl_h_0004.h new file mode 100644 index 0000000..d919153 --- /dev/null +++ b/app/include/cl_h_0004.h @@ -0,0 +1,13 @@ +/* + * cl_h_0004.h - 마감 내부 헬퍼 선언 + */ +#ifndef CL_H_0004_H +#define CL_H_0004_H + +#include "txcore.h" + +int cl_h_0004_check(const char *key, long amount); +int cl_h_0004_apply(TXBUF *in, TXBUF *out); +long cl_h_0004_eval(long amount, int factor); + +#endif /* CL_H_0004_H */ diff --git a/app/include/cl_h_0005.h b/app/include/cl_h_0005.h new file mode 100644 index 0000000..7a51525 --- /dev/null +++ b/app/include/cl_h_0005.h @@ -0,0 +1,20 @@ +/* + * cl_h_0005.h - 마감 코드/상수 테이블 + */ +#ifndef CL_H_0005_H +#define CL_H_0005_H + +#define CL_H_0005_RC_OK 0 +#define CL_H_0005_RC_RETRY 1 +#define CL_H_0005_RC_SKIP 2 +#define CL_H_0005_RC_ERROR 9 + +#define CL_H_0005_LIMIT_DAILY 100000000L +#define CL_H_0005_LIMIT_SINGLE 50000000L +#define CL_H_0005_FEE_RATE_BP 250 /* 2.50% */ + +#define CL_H_0005_CHAN_ONLINE "01" +#define CL_H_0005_CHAN_BATCH "02" +#define CL_H_0005_CHAN_RECON "03" + +#endif /* CL_H_0005_H */ diff --git a/app/include/cl_h_0006.h b/app/include/cl_h_0006.h new file mode 100644 index 0000000..b466a20 --- /dev/null +++ b/app/include/cl_h_0006.h @@ -0,0 +1,19 @@ +/* + * cl_h_0006.h - 마감 고정길이 전문 레이아웃 (positional, 재배치 금지) + */ +#ifndef CL_H_0006_H +#define CL_H_0006_H + +typedef struct { + char msg_type[4]; /* 전문구분 4 */ + char merch_id[15]; /* 가맹점번호 15 */ + char key[9]; /* 처리키 9 */ + char amount[12]; /* 금액 12 zero-pad */ + char biz_date[8]; /* 영업일 8 */ + char resp_code[4]; /* 응답코드 4 */ + char filler[20]; /* 예비 20 */ +} cl_h_0006_msg_t; + +#define CL_H_0006_MSG_LEN ((int)sizeof(cl_h_0006_msg_t)) + +#endif /* CL_H_0006_H */ diff --git a/app/include/cl_h_0007.h b/app/include/cl_h_0007.h new file mode 100644 index 0000000..d360c3d --- /dev/null +++ b/app/include/cl_h_0007.h @@ -0,0 +1,22 @@ +/* + * cl_h_0007.h - 마감 레코드/뷰 구조 정의 + */ +#ifndef CL_H_0007_H +#define CL_H_0007_H + +/* 마감 처리 뷰 레코드 */ +typedef struct { + char key[16]; + char merch_id[16]; + long amount; + long fee; + char biz_date[9]; + char status[2]; + char reserved[16]; +} cl_h_0007_view_t; + +#define CL_H_0007_STATUS_OPEN "O" +#define CL_H_0007_STATUS_HOLD "H" +#define CL_H_0007_STATUS_CLOSE "C" + +#endif /* CL_H_0007_H */ diff --git a/app/include/cl_h_0008.h b/app/include/cl_h_0008.h new file mode 100644 index 0000000..85de9cc --- /dev/null +++ b/app/include/cl_h_0008.h @@ -0,0 +1,13 @@ +/* + * cl_h_0008.h - 마감 내부 헬퍼 선언 + */ +#ifndef CL_H_0008_H +#define CL_H_0008_H + +#include "txcore.h" + +int cl_h_0008_check(const char *key, long amount); +int cl_h_0008_apply(TXBUF *in, TXBUF *out); +long cl_h_0008_eval(long amount, int factor); + +#endif /* CL_H_0008_H */ diff --git a/app/include/cl_h_0009.h b/app/include/cl_h_0009.h new file mode 100644 index 0000000..5ecd6d6 --- /dev/null +++ b/app/include/cl_h_0009.h @@ -0,0 +1,20 @@ +/* + * cl_h_0009.h - 마감 코드/상수 테이블 + */ +#ifndef CL_H_0009_H +#define CL_H_0009_H + +#define CL_H_0009_RC_OK 0 +#define CL_H_0009_RC_RETRY 1 +#define CL_H_0009_RC_SKIP 2 +#define CL_H_0009_RC_ERROR 9 + +#define CL_H_0009_LIMIT_DAILY 100000000L +#define CL_H_0009_LIMIT_SINGLE 50000000L +#define CL_H_0009_FEE_RATE_BP 250 /* 2.50% */ + +#define CL_H_0009_CHAN_ONLINE "01" +#define CL_H_0009_CHAN_BATCH "02" +#define CL_H_0009_CHAN_RECON "03" + +#endif /* CL_H_0009_H */ diff --git a/app/include/cl_h_0010.h b/app/include/cl_h_0010.h new file mode 100644 index 0000000..f1ef695 --- /dev/null +++ b/app/include/cl_h_0010.h @@ -0,0 +1,19 @@ +/* + * cl_h_0010.h - 마감 고정길이 전문 레이아웃 (positional, 재배치 금지) + */ +#ifndef CL_H_0010_H +#define CL_H_0010_H + +typedef struct { + char msg_type[4]; /* 전문구분 4 */ + char merch_id[15]; /* 가맹점번호 15 */ + char key[9]; /* 처리키 9 */ + char amount[12]; /* 금액 12 zero-pad */ + char biz_date[8]; /* 영업일 8 */ + char resp_code[4]; /* 응답코드 4 */ + char filler[20]; /* 예비 20 */ +} cl_h_0010_msg_t; + +#define CL_H_0010_MSG_LEN ((int)sizeof(cl_h_0010_msg_t)) + +#endif /* CL_H_0010_H */ diff --git a/app/include/cl_h_0011.h b/app/include/cl_h_0011.h new file mode 100644 index 0000000..dd292d0 --- /dev/null +++ b/app/include/cl_h_0011.h @@ -0,0 +1,22 @@ +/* + * cl_h_0011.h - 마감 레코드/뷰 구조 정의 + */ +#ifndef CL_H_0011_H +#define CL_H_0011_H + +/* 마감 처리 뷰 레코드 */ +typedef struct { + char key[16]; + char merch_id[16]; + long amount; + long fee; + char biz_date[9]; + char status[2]; + char reserved[16]; +} cl_h_0011_view_t; + +#define CL_H_0011_STATUS_OPEN "O" +#define CL_H_0011_STATUS_HOLD "H" +#define CL_H_0011_STATUS_CLOSE "C" + +#endif /* CL_H_0011_H */ diff --git a/app/include/cl_h_0012.h b/app/include/cl_h_0012.h new file mode 100644 index 0000000..79dc395 --- /dev/null +++ b/app/include/cl_h_0012.h @@ -0,0 +1,13 @@ +/* + * cl_h_0012.h - 마감 내부 헬퍼 선언 + */ +#ifndef CL_H_0012_H +#define CL_H_0012_H + +#include "txcore.h" + +int cl_h_0012_check(const char *key, long amount); +int cl_h_0012_apply(TXBUF *in, TXBUF *out); +long cl_h_0012_eval(long amount, int factor); + +#endif /* CL_H_0012_H */ diff --git a/app/include/cl_h_0013.h b/app/include/cl_h_0013.h new file mode 100644 index 0000000..cfead21 --- /dev/null +++ b/app/include/cl_h_0013.h @@ -0,0 +1,20 @@ +/* + * cl_h_0013.h - 마감 코드/상수 테이블 + */ +#ifndef CL_H_0013_H +#define CL_H_0013_H + +#define CL_H_0013_RC_OK 0 +#define CL_H_0013_RC_RETRY 1 +#define CL_H_0013_RC_SKIP 2 +#define CL_H_0013_RC_ERROR 9 + +#define CL_H_0013_LIMIT_DAILY 100000000L +#define CL_H_0013_LIMIT_SINGLE 50000000L +#define CL_H_0013_FEE_RATE_BP 250 /* 2.50% */ + +#define CL_H_0013_CHAN_ONLINE "01" +#define CL_H_0013_CHAN_BATCH "02" +#define CL_H_0013_CHAN_RECON "03" + +#endif /* CL_H_0013_H */ diff --git a/app/include/cl_h_0014.h b/app/include/cl_h_0014.h new file mode 100644 index 0000000..f421b8f --- /dev/null +++ b/app/include/cl_h_0014.h @@ -0,0 +1,19 @@ +/* + * cl_h_0014.h - 마감 고정길이 전문 레이아웃 (positional, 재배치 금지) + */ +#ifndef CL_H_0014_H +#define CL_H_0014_H + +typedef struct { + char msg_type[4]; /* 전문구분 4 */ + char merch_id[15]; /* 가맹점번호 15 */ + char key[9]; /* 처리키 9 */ + char amount[12]; /* 금액 12 zero-pad */ + char biz_date[8]; /* 영업일 8 */ + char resp_code[4]; /* 응답코드 4 */ + char filler[20]; /* 예비 20 */ +} cl_h_0014_msg_t; + +#define CL_H_0014_MSG_LEN ((int)sizeof(cl_h_0014_msg_t)) + +#endif /* CL_H_0014_H */ diff --git a/app/include/cl_h_0015.h b/app/include/cl_h_0015.h new file mode 100644 index 0000000..9b9cf1c --- /dev/null +++ b/app/include/cl_h_0015.h @@ -0,0 +1,22 @@ +/* + * cl_h_0015.h - 마감 레코드/뷰 구조 정의 + */ +#ifndef CL_H_0015_H +#define CL_H_0015_H + +/* 마감 처리 뷰 레코드 */ +typedef struct { + char key[16]; + char merch_id[16]; + long amount; + long fee; + char biz_date[9]; + char status[2]; + char reserved[16]; +} cl_h_0015_view_t; + +#define CL_H_0015_STATUS_OPEN "O" +#define CL_H_0015_STATUS_HOLD "H" +#define CL_H_0015_STATUS_CLOSE "C" + +#endif /* CL_H_0015_H */ diff --git a/app/include/cl_h_0016.h b/app/include/cl_h_0016.h new file mode 100644 index 0000000..5c53688 --- /dev/null +++ b/app/include/cl_h_0016.h @@ -0,0 +1,13 @@ +/* + * cl_h_0016.h - 마감 내부 헬퍼 선언 + */ +#ifndef CL_H_0016_H +#define CL_H_0016_H + +#include "txcore.h" + +int cl_h_0016_check(const char *key, long amount); +int cl_h_0016_apply(TXBUF *in, TXBUF *out); +long cl_h_0016_eval(long amount, int factor); + +#endif /* CL_H_0016_H */ diff --git a/app/include/cl_io_0001.h b/app/include/cl_io_0001.h new file mode 100644 index 0000000..29efc04 --- /dev/null +++ b/app/include/cl_io_0001.h @@ -0,0 +1,14 @@ +/* + * cl_io_0001.h - 마감 보조 DBIO 선언 (cl_io_0001.pgc 구현) + */ +#ifndef CL_IO_0001_H +#define CL_IO_0001_H + +#include "txcore.h" + +/* cl_io_0001 전용 조회/갱신 (테이블 cl_io_0001_t) */ +int cl_io_0001_fetch(const char *key, long *out_amount); +int cl_io_0001_touch(const char *key, long amount); +long cl_io_0001_total(const char *biz_date); + +#endif /* CL_IO_0001_H */ diff --git a/app/include/cl_io_0002.h b/app/include/cl_io_0002.h new file mode 100644 index 0000000..ab934d9 --- /dev/null +++ b/app/include/cl_io_0002.h @@ -0,0 +1,14 @@ +/* + * cl_io_0002.h - 마감 보조 DBIO 선언 (cl_io_0002.pgc 구현) + */ +#ifndef CL_IO_0002_H +#define CL_IO_0002_H + +#include "txcore.h" + +/* cl_io_0002 전용 조회/갱신 (테이블 cl_io_0002_t) */ +int cl_io_0002_fetch(const char *key, long *out_amount); +int cl_io_0002_touch(const char *key, long amount); +long cl_io_0002_total(const char *biz_date); + +#endif /* CL_IO_0002_H */ diff --git a/app/include/cl_io_0003.h b/app/include/cl_io_0003.h new file mode 100644 index 0000000..679c85f --- /dev/null +++ b/app/include/cl_io_0003.h @@ -0,0 +1,14 @@ +/* + * cl_io_0003.h - 마감 보조 DBIO 선언 (cl_io_0003.pgc 구현) + */ +#ifndef CL_IO_0003_H +#define CL_IO_0003_H + +#include "txcore.h" + +/* cl_io_0003 전용 조회/갱신 (테이블 cl_io_0003_t) */ +int cl_io_0003_fetch(const char *key, long *out_amount); +int cl_io_0003_touch(const char *key, long amount); +long cl_io_0003_total(const char *biz_date); + +#endif /* CL_IO_0003_H */ diff --git a/app/include/cl_io_0004.h b/app/include/cl_io_0004.h new file mode 100644 index 0000000..f1c12d7 --- /dev/null +++ b/app/include/cl_io_0004.h @@ -0,0 +1,14 @@ +/* + * cl_io_0004.h - 마감 보조 DBIO 선언 (cl_io_0004.pgc 구현) + */ +#ifndef CL_IO_0004_H +#define CL_IO_0004_H + +#include "txcore.h" + +/* cl_io_0004 전용 조회/갱신 (테이블 cl_io_0004_t) */ +int cl_io_0004_fetch(const char *key, long *out_amount); +int cl_io_0004_touch(const char *key, long amount); +long cl_io_0004_total(const char *biz_date); + +#endif /* CL_IO_0004_H */ diff --git a/app/include/cl_io_0005.h b/app/include/cl_io_0005.h new file mode 100644 index 0000000..22db6f2 --- /dev/null +++ b/app/include/cl_io_0005.h @@ -0,0 +1,14 @@ +/* + * cl_io_0005.h - 마감 보조 DBIO 선언 (cl_io_0005.pgc 구현) + */ +#ifndef CL_IO_0005_H +#define CL_IO_0005_H + +#include "txcore.h" + +/* cl_io_0005 전용 조회/갱신 (테이블 cl_io_0005_t) */ +int cl_io_0005_fetch(const char *key, long *out_amount); +int cl_io_0005_touch(const char *key, long amount); +long cl_io_0005_total(const char *biz_date); + +#endif /* CL_IO_0005_H */ diff --git a/app/include/cl_io_0006.h b/app/include/cl_io_0006.h new file mode 100644 index 0000000..2578c11 --- /dev/null +++ b/app/include/cl_io_0006.h @@ -0,0 +1,14 @@ +/* + * cl_io_0006.h - 마감 보조 DBIO 선언 (cl_io_0006.pgc 구현) + */ +#ifndef CL_IO_0006_H +#define CL_IO_0006_H + +#include "txcore.h" + +/* cl_io_0006 전용 조회/갱신 (테이블 cl_io_0006_t) */ +int cl_io_0006_fetch(const char *key, long *out_amount); +int cl_io_0006_touch(const char *key, long amount); +long cl_io_0006_total(const char *biz_date); + +#endif /* CL_IO_0006_H */ diff --git a/app/include/cl_io_0007.h b/app/include/cl_io_0007.h new file mode 100644 index 0000000..e513c88 --- /dev/null +++ b/app/include/cl_io_0007.h @@ -0,0 +1,14 @@ +/* + * cl_io_0007.h - 마감 보조 DBIO 선언 (cl_io_0007.pgc 구현) + */ +#ifndef CL_IO_0007_H +#define CL_IO_0007_H + +#include "txcore.h" + +/* cl_io_0007 전용 조회/갱신 (테이블 cl_io_0007_t) */ +int cl_io_0007_fetch(const char *key, long *out_amount); +int cl_io_0007_touch(const char *key, long amount); +long cl_io_0007_total(const char *biz_date); + +#endif /* CL_IO_0007_H */ diff --git a/app/include/cl_io_0008.h b/app/include/cl_io_0008.h new file mode 100644 index 0000000..a8914b3 --- /dev/null +++ b/app/include/cl_io_0008.h @@ -0,0 +1,14 @@ +/* + * cl_io_0008.h - 마감 보조 DBIO 선언 (cl_io_0008.pgc 구현) + */ +#ifndef CL_IO_0008_H +#define CL_IO_0008_H + +#include "txcore.h" + +/* cl_io_0008 전용 조회/갱신 (테이블 cl_io_0008_t) */ +int cl_io_0008_fetch(const char *key, long *out_amount); +int cl_io_0008_touch(const char *key, long amount); +long cl_io_0008_total(const char *biz_date); + +#endif /* CL_IO_0008_H */ diff --git a/app/include/cl_io_0009.h b/app/include/cl_io_0009.h new file mode 100644 index 0000000..784be84 --- /dev/null +++ b/app/include/cl_io_0009.h @@ -0,0 +1,14 @@ +/* + * cl_io_0009.h - 마감 보조 DBIO 선언 (cl_io_0009.pgc 구현) + */ +#ifndef CL_IO_0009_H +#define CL_IO_0009_H + +#include "txcore.h" + +/* cl_io_0009 전용 조회/갱신 (테이블 cl_io_0009_t) */ +int cl_io_0009_fetch(const char *key, long *out_amount); +int cl_io_0009_touch(const char *key, long amount); +long cl_io_0009_total(const char *biz_date); + +#endif /* CL_IO_0009_H */ diff --git a/app/include/cl_io_0010.h b/app/include/cl_io_0010.h new file mode 100644 index 0000000..75c40f5 --- /dev/null +++ b/app/include/cl_io_0010.h @@ -0,0 +1,14 @@ +/* + * cl_io_0010.h - 마감 보조 DBIO 선언 (cl_io_0010.pgc 구현) + */ +#ifndef CL_IO_0010_H +#define CL_IO_0010_H + +#include "txcore.h" + +/* cl_io_0010 전용 조회/갱신 (테이블 cl_io_0010_t) */ +int cl_io_0010_fetch(const char *key, long *out_amount); +int cl_io_0010_touch(const char *key, long amount); +long cl_io_0010_total(const char *biz_date); + +#endif /* CL_IO_0010_H */ diff --git a/app/include/cl_io_0011.h b/app/include/cl_io_0011.h new file mode 100644 index 0000000..45b7d64 --- /dev/null +++ b/app/include/cl_io_0011.h @@ -0,0 +1,14 @@ +/* + * cl_io_0011.h - 마감 보조 DBIO 선언 (cl_io_0011.pgc 구현) + */ +#ifndef CL_IO_0011_H +#define CL_IO_0011_H + +#include "txcore.h" + +/* cl_io_0011 전용 조회/갱신 (테이블 cl_io_0011_t) */ +int cl_io_0011_fetch(const char *key, long *out_amount); +int cl_io_0011_touch(const char *key, long amount); +long cl_io_0011_total(const char *biz_date); + +#endif /* CL_IO_0011_H */ diff --git a/app/include/cl_io_0012.h b/app/include/cl_io_0012.h new file mode 100644 index 0000000..1dd2d2e --- /dev/null +++ b/app/include/cl_io_0012.h @@ -0,0 +1,14 @@ +/* + * cl_io_0012.h - 마감 보조 DBIO 선언 (cl_io_0012.pgc 구현) + */ +#ifndef CL_IO_0012_H +#define CL_IO_0012_H + +#include "txcore.h" + +/* cl_io_0012 전용 조회/갱신 (테이블 cl_io_0012_t) */ +int cl_io_0012_fetch(const char *key, long *out_amount); +int cl_io_0012_touch(const char *key, long amount); +long cl_io_0012_total(const char *biz_date); + +#endif /* CL_IO_0012_H */ diff --git a/app/include/cl_io_0013.h b/app/include/cl_io_0013.h new file mode 100644 index 0000000..20b329e --- /dev/null +++ b/app/include/cl_io_0013.h @@ -0,0 +1,14 @@ +/* + * cl_io_0013.h - 마감 보조 DBIO 선언 (cl_io_0013.pgc 구현) + */ +#ifndef CL_IO_0013_H +#define CL_IO_0013_H + +#include "txcore.h" + +/* cl_io_0013 전용 조회/갱신 (테이블 cl_io_0013_t) */ +int cl_io_0013_fetch(const char *key, long *out_amount); +int cl_io_0013_touch(const char *key, long amount); +long cl_io_0013_total(const char *biz_date); + +#endif /* CL_IO_0013_H */ diff --git a/app/include/cl_io_0014.h b/app/include/cl_io_0014.h new file mode 100644 index 0000000..b7462bc --- /dev/null +++ b/app/include/cl_io_0014.h @@ -0,0 +1,14 @@ +/* + * cl_io_0014.h - 마감 보조 DBIO 선언 (cl_io_0014.pgc 구현) + */ +#ifndef CL_IO_0014_H +#define CL_IO_0014_H + +#include "txcore.h" + +/* cl_io_0014 전용 조회/갱신 (테이블 cl_io_0014_t) */ +int cl_io_0014_fetch(const char *key, long *out_amount); +int cl_io_0014_touch(const char *key, long amount); +long cl_io_0014_total(const char *biz_date); + +#endif /* CL_IO_0014_H */ diff --git a/app/include/cl_io_0015.h b/app/include/cl_io_0015.h new file mode 100644 index 0000000..f24cab5 --- /dev/null +++ b/app/include/cl_io_0015.h @@ -0,0 +1,14 @@ +/* + * cl_io_0015.h - 마감 보조 DBIO 선언 (cl_io_0015.pgc 구현) + */ +#ifndef CL_IO_0015_H +#define CL_IO_0015_H + +#include "txcore.h" + +/* cl_io_0015 전용 조회/갱신 (테이블 cl_io_0015_t) */ +int cl_io_0015_fetch(const char *key, long *out_amount); +int cl_io_0015_touch(const char *key, long amount); +long cl_io_0015_total(const char *biz_date); + +#endif /* CL_IO_0015_H */ diff --git a/app/include/cl_io_0016.h b/app/include/cl_io_0016.h new file mode 100644 index 0000000..0f8a2a0 --- /dev/null +++ b/app/include/cl_io_0016.h @@ -0,0 +1,14 @@ +/* + * cl_io_0016.h - 마감 보조 DBIO 선언 (cl_io_0016.pgc 구현) + */ +#ifndef CL_IO_0016_H +#define CL_IO_0016_H + +#include "txcore.h" + +/* cl_io_0016 전용 조회/갱신 (테이블 cl_io_0016_t) */ +int cl_io_0016_fetch(const char *key, long *out_amount); +int cl_io_0016_touch(const char *key, long amount); +long cl_io_0016_total(const char *biz_date); + +#endif /* CL_IO_0016_H */ diff --git a/app/include/cl_io_0017.h b/app/include/cl_io_0017.h new file mode 100644 index 0000000..b5805b8 --- /dev/null +++ b/app/include/cl_io_0017.h @@ -0,0 +1,14 @@ +/* + * cl_io_0017.h - 마감 보조 DBIO 선언 (cl_io_0017.pgc 구현) + */ +#ifndef CL_IO_0017_H +#define CL_IO_0017_H + +#include "txcore.h" + +/* cl_io_0017 전용 조회/갱신 (테이블 cl_io_0017_t) */ +int cl_io_0017_fetch(const char *key, long *out_amount); +int cl_io_0017_touch(const char *key, long amount); +long cl_io_0017_total(const char *biz_date); + +#endif /* CL_IO_0017_H */ diff --git a/app/include/cl_io_0018.h b/app/include/cl_io_0018.h new file mode 100644 index 0000000..669bc40 --- /dev/null +++ b/app/include/cl_io_0018.h @@ -0,0 +1,14 @@ +/* + * cl_io_0018.h - 마감 보조 DBIO 선언 (cl_io_0018.pgc 구현) + */ +#ifndef CL_IO_0018_H +#define CL_IO_0018_H + +#include "txcore.h" + +/* cl_io_0018 전용 조회/갱신 (테이블 cl_io_0018_t) */ +int cl_io_0018_fetch(const char *key, long *out_amount); +int cl_io_0018_touch(const char *key, long amount); +long cl_io_0018_total(const char *biz_date); + +#endif /* CL_IO_0018_H */ diff --git a/app/include/cl_io_0019.h b/app/include/cl_io_0019.h new file mode 100644 index 0000000..d0d0faa --- /dev/null +++ b/app/include/cl_io_0019.h @@ -0,0 +1,14 @@ +/* + * cl_io_0019.h - 마감 보조 DBIO 선언 (cl_io_0019.pgc 구현) + */ +#ifndef CL_IO_0019_H +#define CL_IO_0019_H + +#include "txcore.h" + +/* cl_io_0019 전용 조회/갱신 (테이블 cl_io_0019_t) */ +int cl_io_0019_fetch(const char *key, long *out_amount); +int cl_io_0019_touch(const char *key, long amount); +long cl_io_0019_total(const char *biz_date); + +#endif /* CL_IO_0019_H */ diff --git a/app/include/cl_io_0020.h b/app/include/cl_io_0020.h new file mode 100644 index 0000000..26e4ccf --- /dev/null +++ b/app/include/cl_io_0020.h @@ -0,0 +1,14 @@ +/* + * cl_io_0020.h - 마감 보조 DBIO 선언 (cl_io_0020.pgc 구현) + */ +#ifndef CL_IO_0020_H +#define CL_IO_0020_H + +#include "txcore.h" + +/* cl_io_0020 전용 조회/갱신 (테이블 cl_io_0020_t) */ +int cl_io_0020_fetch(const char *key, long *out_amount); +int cl_io_0020_touch(const char *key, long amount); +long cl_io_0020_total(const char *biz_date); + +#endif /* CL_IO_0020_H */ diff --git a/app/include/cl_io_0021.h b/app/include/cl_io_0021.h new file mode 100644 index 0000000..7b45562 --- /dev/null +++ b/app/include/cl_io_0021.h @@ -0,0 +1,14 @@ +/* + * cl_io_0021.h - 마감 보조 DBIO 선언 (cl_io_0021.pgc 구현) + */ +#ifndef CL_IO_0021_H +#define CL_IO_0021_H + +#include "txcore.h" + +/* cl_io_0021 전용 조회/갱신 (테이블 cl_io_0021_t) */ +int cl_io_0021_fetch(const char *key, long *out_amount); +int cl_io_0021_touch(const char *key, long amount); +long cl_io_0021_total(const char *biz_date); + +#endif /* CL_IO_0021_H */ diff --git a/app/include/cl_io_0022.h b/app/include/cl_io_0022.h new file mode 100644 index 0000000..5bfcf2c --- /dev/null +++ b/app/include/cl_io_0022.h @@ -0,0 +1,14 @@ +/* + * cl_io_0022.h - 마감 보조 DBIO 선언 (cl_io_0022.pgc 구현) + */ +#ifndef CL_IO_0022_H +#define CL_IO_0022_H + +#include "txcore.h" + +/* cl_io_0022 전용 조회/갱신 (테이블 cl_io_0022_t) */ +int cl_io_0022_fetch(const char *key, long *out_amount); +int cl_io_0022_touch(const char *key, long amount); +long cl_io_0022_total(const char *biz_date); + +#endif /* CL_IO_0022_H */ diff --git a/app/include/cl_io_0023.h b/app/include/cl_io_0023.h new file mode 100644 index 0000000..c77dbe6 --- /dev/null +++ b/app/include/cl_io_0023.h @@ -0,0 +1,14 @@ +/* + * cl_io_0023.h - 마감 보조 DBIO 선언 (cl_io_0023.pgc 구현) + */ +#ifndef CL_IO_0023_H +#define CL_IO_0023_H + +#include "txcore.h" + +/* cl_io_0023 전용 조회/갱신 (테이블 cl_io_0023_t) */ +int cl_io_0023_fetch(const char *key, long *out_amount); +int cl_io_0023_touch(const char *key, long amount); +long cl_io_0023_total(const char *biz_date); + +#endif /* CL_IO_0023_H */ diff --git a/app/include/cl_io_0024.h b/app/include/cl_io_0024.h new file mode 100644 index 0000000..0ecca2f --- /dev/null +++ b/app/include/cl_io_0024.h @@ -0,0 +1,14 @@ +/* + * cl_io_0024.h - 마감 보조 DBIO 선언 (cl_io_0024.pgc 구현) + */ +#ifndef CL_IO_0024_H +#define CL_IO_0024_H + +#include "txcore.h" + +/* cl_io_0024 전용 조회/갱신 (테이블 cl_io_0024_t) */ +int cl_io_0024_fetch(const char *key, long *out_amount); +int cl_io_0024_touch(const char *key, long amount); +long cl_io_0024_total(const char *biz_date); + +#endif /* CL_IO_0024_H */ diff --git a/app/include/cl_io_0025.h b/app/include/cl_io_0025.h new file mode 100644 index 0000000..82b7e34 --- /dev/null +++ b/app/include/cl_io_0025.h @@ -0,0 +1,14 @@ +/* + * cl_io_0025.h - 마감 보조 DBIO 선언 (cl_io_0025.pgc 구현) + */ +#ifndef CL_IO_0025_H +#define CL_IO_0025_H + +#include "txcore.h" + +/* cl_io_0025 전용 조회/갱신 (테이블 cl_io_0025_t) */ +int cl_io_0025_fetch(const char *key, long *out_amount); +int cl_io_0025_touch(const char *key, long amount); +long cl_io_0025_total(const char *biz_date); + +#endif /* CL_IO_0025_H */ diff --git a/app/include/cl_io_0026.h b/app/include/cl_io_0026.h new file mode 100644 index 0000000..151a40a --- /dev/null +++ b/app/include/cl_io_0026.h @@ -0,0 +1,14 @@ +/* + * cl_io_0026.h - 마감 보조 DBIO 선언 (cl_io_0026.pgc 구현) + */ +#ifndef CL_IO_0026_H +#define CL_IO_0026_H + +#include "txcore.h" + +/* cl_io_0026 전용 조회/갱신 (테이블 cl_io_0026_t) */ +int cl_io_0026_fetch(const char *key, long *out_amount); +int cl_io_0026_touch(const char *key, long amount); +long cl_io_0026_total(const char *biz_date); + +#endif /* CL_IO_0026_H */ diff --git a/app/include/cm_core.h b/app/include/cm_core.h new file mode 100644 index 0000000..34179f2 --- /dev/null +++ b/app/include/cm_core.h @@ -0,0 +1,38 @@ +/* + * cm_core.h - 공통 모듈 핵심 계약 (레코드/상태/표준 DBIO API) + * + * 이 모듈의 온라인/배치 프로그램은 SQL 을 직접 다루지 않고 아래 표준 + * DBIO API 만 호출한다. 구현은 app/dbio/cm_dbio_main.pgc (ECPG). + */ +#ifndef CM_CORE_H +#define CM_CORE_H + +#include "txcore.h" + +/* 공통 처리 상태코드 */ +#define CM_ST_RECV "R" /* 접수/수신 */ +#define CM_ST_DONE "M" /* 처리완료 */ +#define CM_ST_FAIL "U" /* 불일치/실패 */ +#define CM_ST_SETTLED "S" /* 정산완료 */ + +/* 공통 원장 레코드 (1행) */ +typedef struct { + char key[16]; /* 처리키(승인/거래 번호) PK */ + char merch_id[16]; /* 가맹점번호 */ + char card_no[20]; /* 카드번호(마스킹) */ + long amount; /* 거래금액(원) */ + char biz_date[9]; /* 영업일 YYYYMMDD */ + char status[2]; /* 상태코드 */ + long fee; /* 수수료(원) */ +} cm_rec_t; + +/* 표준 DBIO API (구현: cm_dbio_main.pgc) */ +int cm_dbio_connect(const char *target); +int cm_dbio_disconnect(void); +int cm_rec_insert(const cm_rec_t *rec); +int cm_rec_select(const char *key, cm_rec_t *out); +int cm_rec_update_status(const char *key, const char *status); +long cm_rec_count(const char *biz_date, const char *status); +int cm_rec_sum(const char *biz_date, long *out_sum); + +#endif /* CM_CORE_H */ diff --git a/app/include/cm_cu_0001.h b/app/include/cm_cu_0001.h new file mode 100644 index 0000000..a53fb6d --- /dev/null +++ b/app/include/cm_cu_0001.h @@ -0,0 +1,11 @@ +/* + * cm_cu_0001.h - 공통 공통 유틸 선언 (cm_cu_0001.c 구현) + */ +#ifndef CM_CU_0001_H +#define CM_CU_0001_H + +long cm_cu_0001_fee(long amount, int rate_bp); +long cm_cu_0001_round_unit(long amount, long unit); +int cm_cu_0001_classify(long amount); + +#endif /* CM_CU_0001_H */ diff --git a/app/include/cm_cu_0002.h b/app/include/cm_cu_0002.h new file mode 100644 index 0000000..38897a1 --- /dev/null +++ b/app/include/cm_cu_0002.h @@ -0,0 +1,11 @@ +/* + * cm_cu_0002.h - 공통 공통 유틸 선언 (cm_cu_0002.c 구현) + */ +#ifndef CM_CU_0002_H +#define CM_CU_0002_H + +long cm_cu_0002_fee(long amount, int rate_bp); +long cm_cu_0002_round_unit(long amount, long unit); +int cm_cu_0002_classify(long amount); + +#endif /* CM_CU_0002_H */ diff --git a/app/include/cm_cu_0003.h b/app/include/cm_cu_0003.h new file mode 100644 index 0000000..97418ce --- /dev/null +++ b/app/include/cm_cu_0003.h @@ -0,0 +1,11 @@ +/* + * cm_cu_0003.h - 공통 공통 유틸 선언 (cm_cu_0003.c 구현) + */ +#ifndef CM_CU_0003_H +#define CM_CU_0003_H + +long cm_cu_0003_fee(long amount, int rate_bp); +long cm_cu_0003_round_unit(long amount, long unit); +int cm_cu_0003_classify(long amount); + +#endif /* CM_CU_0003_H */ diff --git a/app/include/cm_cu_0004.h b/app/include/cm_cu_0004.h new file mode 100644 index 0000000..c89d8d5 --- /dev/null +++ b/app/include/cm_cu_0004.h @@ -0,0 +1,11 @@ +/* + * cm_cu_0004.h - 공통 공통 유틸 선언 (cm_cu_0004.c 구현) + */ +#ifndef CM_CU_0004_H +#define CM_CU_0004_H + +long cm_cu_0004_fee(long amount, int rate_bp); +long cm_cu_0004_round_unit(long amount, long unit); +int cm_cu_0004_classify(long amount); + +#endif /* CM_CU_0004_H */ diff --git a/app/include/cm_cu_0005.h b/app/include/cm_cu_0005.h new file mode 100644 index 0000000..dc9502b --- /dev/null +++ b/app/include/cm_cu_0005.h @@ -0,0 +1,11 @@ +/* + * cm_cu_0005.h - 공통 공통 유틸 선언 (cm_cu_0005.c 구현) + */ +#ifndef CM_CU_0005_H +#define CM_CU_0005_H + +long cm_cu_0005_fee(long amount, int rate_bp); +long cm_cu_0005_round_unit(long amount, long unit); +int cm_cu_0005_classify(long amount); + +#endif /* CM_CU_0005_H */ diff --git a/app/include/cm_cu_0006.h b/app/include/cm_cu_0006.h new file mode 100644 index 0000000..a1e923d --- /dev/null +++ b/app/include/cm_cu_0006.h @@ -0,0 +1,11 @@ +/* + * cm_cu_0006.h - 공통 공통 유틸 선언 (cm_cu_0006.c 구현) + */ +#ifndef CM_CU_0006_H +#define CM_CU_0006_H + +long cm_cu_0006_fee(long amount, int rate_bp); +long cm_cu_0006_round_unit(long amount, long unit); +int cm_cu_0006_classify(long amount); + +#endif /* CM_CU_0006_H */ diff --git a/app/include/cm_cu_0007.h b/app/include/cm_cu_0007.h new file mode 100644 index 0000000..3b4dba6 --- /dev/null +++ b/app/include/cm_cu_0007.h @@ -0,0 +1,11 @@ +/* + * cm_cu_0007.h - 공통 공통 유틸 선언 (cm_cu_0007.c 구현) + */ +#ifndef CM_CU_0007_H +#define CM_CU_0007_H + +long cm_cu_0007_fee(long amount, int rate_bp); +long cm_cu_0007_round_unit(long amount, long unit); +int cm_cu_0007_classify(long amount); + +#endif /* CM_CU_0007_H */ diff --git a/app/include/cm_cu_0008.h b/app/include/cm_cu_0008.h new file mode 100644 index 0000000..7ec72c7 --- /dev/null +++ b/app/include/cm_cu_0008.h @@ -0,0 +1,11 @@ +/* + * cm_cu_0008.h - 공통 공통 유틸 선언 (cm_cu_0008.c 구현) + */ +#ifndef CM_CU_0008_H +#define CM_CU_0008_H + +long cm_cu_0008_fee(long amount, int rate_bp); +long cm_cu_0008_round_unit(long amount, long unit); +int cm_cu_0008_classify(long amount); + +#endif /* CM_CU_0008_H */ diff --git a/app/include/cm_cu_0009.h b/app/include/cm_cu_0009.h new file mode 100644 index 0000000..1ce949f --- /dev/null +++ b/app/include/cm_cu_0009.h @@ -0,0 +1,11 @@ +/* + * cm_cu_0009.h - 공통 공통 유틸 선언 (cm_cu_0009.c 구현) + */ +#ifndef CM_CU_0009_H +#define CM_CU_0009_H + +long cm_cu_0009_fee(long amount, int rate_bp); +long cm_cu_0009_round_unit(long amount, long unit); +int cm_cu_0009_classify(long amount); + +#endif /* CM_CU_0009_H */ diff --git a/app/include/cm_cu_0010.h b/app/include/cm_cu_0010.h new file mode 100644 index 0000000..376ea95 --- /dev/null +++ b/app/include/cm_cu_0010.h @@ -0,0 +1,11 @@ +/* + * cm_cu_0010.h - 공통 공통 유틸 선언 (cm_cu_0010.c 구현) + */ +#ifndef CM_CU_0010_H +#define CM_CU_0010_H + +long cm_cu_0010_fee(long amount, int rate_bp); +long cm_cu_0010_round_unit(long amount, long unit); +int cm_cu_0010_classify(long amount); + +#endif /* CM_CU_0010_H */ diff --git a/app/include/cm_cu_0011.h b/app/include/cm_cu_0011.h new file mode 100644 index 0000000..33bbf66 --- /dev/null +++ b/app/include/cm_cu_0011.h @@ -0,0 +1,11 @@ +/* + * cm_cu_0011.h - 공통 공통 유틸 선언 (cm_cu_0011.c 구현) + */ +#ifndef CM_CU_0011_H +#define CM_CU_0011_H + +long cm_cu_0011_fee(long amount, int rate_bp); +long cm_cu_0011_round_unit(long amount, long unit); +int cm_cu_0011_classify(long amount); + +#endif /* CM_CU_0011_H */ diff --git a/app/include/cm_h_0001.h b/app/include/cm_h_0001.h new file mode 100644 index 0000000..dbf7bf8 --- /dev/null +++ b/app/include/cm_h_0001.h @@ -0,0 +1,19 @@ +/* + * cm_h_0001.h - 공통 고정길이 전문 레이아웃 (positional, 재배치 금지) + */ +#ifndef CM_H_0001_H +#define CM_H_0001_H + +typedef struct { + char msg_type[4]; /* 전문구분 4 */ + char merch_id[15]; /* 가맹점번호 15 */ + char key[9]; /* 처리키 9 */ + char amount[12]; /* 금액 12 zero-pad */ + char biz_date[8]; /* 영업일 8 */ + char resp_code[4]; /* 응답코드 4 */ + char filler[20]; /* 예비 20 */ +} cm_h_0001_msg_t; + +#define CM_H_0001_MSG_LEN ((int)sizeof(cm_h_0001_msg_t)) + +#endif /* CM_H_0001_H */ diff --git a/app/include/cm_h_0002.h b/app/include/cm_h_0002.h new file mode 100644 index 0000000..077dd17 --- /dev/null +++ b/app/include/cm_h_0002.h @@ -0,0 +1,22 @@ +/* + * cm_h_0002.h - 공통 레코드/뷰 구조 정의 + */ +#ifndef CM_H_0002_H +#define CM_H_0002_H + +/* 공통 처리 뷰 레코드 */ +typedef struct { + char key[16]; + char merch_id[16]; + long amount; + long fee; + char biz_date[9]; + char status[2]; + char reserved[16]; +} cm_h_0002_view_t; + +#define CM_H_0002_STATUS_OPEN "O" +#define CM_H_0002_STATUS_HOLD "H" +#define CM_H_0002_STATUS_CLOSE "C" + +#endif /* CM_H_0002_H */ diff --git a/app/include/cm_h_0003.h b/app/include/cm_h_0003.h new file mode 100644 index 0000000..6809a6f --- /dev/null +++ b/app/include/cm_h_0003.h @@ -0,0 +1,13 @@ +/* + * cm_h_0003.h - 공통 내부 헬퍼 선언 + */ +#ifndef CM_H_0003_H +#define CM_H_0003_H + +#include "txcore.h" + +int cm_h_0003_check(const char *key, long amount); +int cm_h_0003_apply(TXBUF *in, TXBUF *out); +long cm_h_0003_eval(long amount, int factor); + +#endif /* CM_H_0003_H */ diff --git a/app/include/cm_h_0004.h b/app/include/cm_h_0004.h new file mode 100644 index 0000000..a93d414 --- /dev/null +++ b/app/include/cm_h_0004.h @@ -0,0 +1,20 @@ +/* + * cm_h_0004.h - 공통 코드/상수 테이블 + */ +#ifndef CM_H_0004_H +#define CM_H_0004_H + +#define CM_H_0004_RC_OK 0 +#define CM_H_0004_RC_RETRY 1 +#define CM_H_0004_RC_SKIP 2 +#define CM_H_0004_RC_ERROR 9 + +#define CM_H_0004_LIMIT_DAILY 100000000L +#define CM_H_0004_LIMIT_SINGLE 50000000L +#define CM_H_0004_FEE_RATE_BP 250 /* 2.50% */ + +#define CM_H_0004_CHAN_ONLINE "01" +#define CM_H_0004_CHAN_BATCH "02" +#define CM_H_0004_CHAN_RECON "03" + +#endif /* CM_H_0004_H */ diff --git a/app/include/cm_h_0005.h b/app/include/cm_h_0005.h new file mode 100644 index 0000000..57696f4 --- /dev/null +++ b/app/include/cm_h_0005.h @@ -0,0 +1,19 @@ +/* + * cm_h_0005.h - 공통 고정길이 전문 레이아웃 (positional, 재배치 금지) + */ +#ifndef CM_H_0005_H +#define CM_H_0005_H + +typedef struct { + char msg_type[4]; /* 전문구분 4 */ + char merch_id[15]; /* 가맹점번호 15 */ + char key[9]; /* 처리키 9 */ + char amount[12]; /* 금액 12 zero-pad */ + char biz_date[8]; /* 영업일 8 */ + char resp_code[4]; /* 응답코드 4 */ + char filler[20]; /* 예비 20 */ +} cm_h_0005_msg_t; + +#define CM_H_0005_MSG_LEN ((int)sizeof(cm_h_0005_msg_t)) + +#endif /* CM_H_0005_H */ diff --git a/app/include/cm_h_0006.h b/app/include/cm_h_0006.h new file mode 100644 index 0000000..60eb28a --- /dev/null +++ b/app/include/cm_h_0006.h @@ -0,0 +1,22 @@ +/* + * cm_h_0006.h - 공통 레코드/뷰 구조 정의 + */ +#ifndef CM_H_0006_H +#define CM_H_0006_H + +/* 공통 처리 뷰 레코드 */ +typedef struct { + char key[16]; + char merch_id[16]; + long amount; + long fee; + char biz_date[9]; + char status[2]; + char reserved[16]; +} cm_h_0006_view_t; + +#define CM_H_0006_STATUS_OPEN "O" +#define CM_H_0006_STATUS_HOLD "H" +#define CM_H_0006_STATUS_CLOSE "C" + +#endif /* CM_H_0006_H */ diff --git a/app/include/cm_h_0007.h b/app/include/cm_h_0007.h new file mode 100644 index 0000000..38afd90 --- /dev/null +++ b/app/include/cm_h_0007.h @@ -0,0 +1,13 @@ +/* + * cm_h_0007.h - 공통 내부 헬퍼 선언 + */ +#ifndef CM_H_0007_H +#define CM_H_0007_H + +#include "txcore.h" + +int cm_h_0007_check(const char *key, long amount); +int cm_h_0007_apply(TXBUF *in, TXBUF *out); +long cm_h_0007_eval(long amount, int factor); + +#endif /* CM_H_0007_H */ diff --git a/app/include/cm_h_0008.h b/app/include/cm_h_0008.h new file mode 100644 index 0000000..e9ce512 --- /dev/null +++ b/app/include/cm_h_0008.h @@ -0,0 +1,20 @@ +/* + * cm_h_0008.h - 공통 코드/상수 테이블 + */ +#ifndef CM_H_0008_H +#define CM_H_0008_H + +#define CM_H_0008_RC_OK 0 +#define CM_H_0008_RC_RETRY 1 +#define CM_H_0008_RC_SKIP 2 +#define CM_H_0008_RC_ERROR 9 + +#define CM_H_0008_LIMIT_DAILY 100000000L +#define CM_H_0008_LIMIT_SINGLE 50000000L +#define CM_H_0008_FEE_RATE_BP 250 /* 2.50% */ + +#define CM_H_0008_CHAN_ONLINE "01" +#define CM_H_0008_CHAN_BATCH "02" +#define CM_H_0008_CHAN_RECON "03" + +#endif /* CM_H_0008_H */ diff --git a/app/include/cm_h_0009.h b/app/include/cm_h_0009.h new file mode 100644 index 0000000..3d1cec9 --- /dev/null +++ b/app/include/cm_h_0009.h @@ -0,0 +1,19 @@ +/* + * cm_h_0009.h - 공통 고정길이 전문 레이아웃 (positional, 재배치 금지) + */ +#ifndef CM_H_0009_H +#define CM_H_0009_H + +typedef struct { + char msg_type[4]; /* 전문구분 4 */ + char merch_id[15]; /* 가맹점번호 15 */ + char key[9]; /* 처리키 9 */ + char amount[12]; /* 금액 12 zero-pad */ + char biz_date[8]; /* 영업일 8 */ + char resp_code[4]; /* 응답코드 4 */ + char filler[20]; /* 예비 20 */ +} cm_h_0009_msg_t; + +#define CM_H_0009_MSG_LEN ((int)sizeof(cm_h_0009_msg_t)) + +#endif /* CM_H_0009_H */ diff --git a/app/include/cm_h_0010.h b/app/include/cm_h_0010.h new file mode 100644 index 0000000..635f158 --- /dev/null +++ b/app/include/cm_h_0010.h @@ -0,0 +1,22 @@ +/* + * cm_h_0010.h - 공통 레코드/뷰 구조 정의 + */ +#ifndef CM_H_0010_H +#define CM_H_0010_H + +/* 공통 처리 뷰 레코드 */ +typedef struct { + char key[16]; + char merch_id[16]; + long amount; + long fee; + char biz_date[9]; + char status[2]; + char reserved[16]; +} cm_h_0010_view_t; + +#define CM_H_0010_STATUS_OPEN "O" +#define CM_H_0010_STATUS_HOLD "H" +#define CM_H_0010_STATUS_CLOSE "C" + +#endif /* CM_H_0010_H */ diff --git a/app/include/cm_h_0011.h b/app/include/cm_h_0011.h new file mode 100644 index 0000000..8de6467 --- /dev/null +++ b/app/include/cm_h_0011.h @@ -0,0 +1,13 @@ +/* + * cm_h_0011.h - 공통 내부 헬퍼 선언 + */ +#ifndef CM_H_0011_H +#define CM_H_0011_H + +#include "txcore.h" + +int cm_h_0011_check(const char *key, long amount); +int cm_h_0011_apply(TXBUF *in, TXBUF *out); +long cm_h_0011_eval(long amount, int factor); + +#endif /* CM_H_0011_H */ diff --git a/app/include/cm_h_0012.h b/app/include/cm_h_0012.h new file mode 100644 index 0000000..03fb87c --- /dev/null +++ b/app/include/cm_h_0012.h @@ -0,0 +1,20 @@ +/* + * cm_h_0012.h - 공통 코드/상수 테이블 + */ +#ifndef CM_H_0012_H +#define CM_H_0012_H + +#define CM_H_0012_RC_OK 0 +#define CM_H_0012_RC_RETRY 1 +#define CM_H_0012_RC_SKIP 2 +#define CM_H_0012_RC_ERROR 9 + +#define CM_H_0012_LIMIT_DAILY 100000000L +#define CM_H_0012_LIMIT_SINGLE 50000000L +#define CM_H_0012_FEE_RATE_BP 250 /* 2.50% */ + +#define CM_H_0012_CHAN_ONLINE "01" +#define CM_H_0012_CHAN_BATCH "02" +#define CM_H_0012_CHAN_RECON "03" + +#endif /* CM_H_0012_H */ diff --git a/app/include/cm_h_0013.h b/app/include/cm_h_0013.h new file mode 100644 index 0000000..8483c88 --- /dev/null +++ b/app/include/cm_h_0013.h @@ -0,0 +1,19 @@ +/* + * cm_h_0013.h - 공통 고정길이 전문 레이아웃 (positional, 재배치 금지) + */ +#ifndef CM_H_0013_H +#define CM_H_0013_H + +typedef struct { + char msg_type[4]; /* 전문구분 4 */ + char merch_id[15]; /* 가맹점번호 15 */ + char key[9]; /* 처리키 9 */ + char amount[12]; /* 금액 12 zero-pad */ + char biz_date[8]; /* 영업일 8 */ + char resp_code[4]; /* 응답코드 4 */ + char filler[20]; /* 예비 20 */ +} cm_h_0013_msg_t; + +#define CM_H_0013_MSG_LEN ((int)sizeof(cm_h_0013_msg_t)) + +#endif /* CM_H_0013_H */ diff --git a/app/include/cm_h_0014.h b/app/include/cm_h_0014.h new file mode 100644 index 0000000..cd8b5bd --- /dev/null +++ b/app/include/cm_h_0014.h @@ -0,0 +1,22 @@ +/* + * cm_h_0014.h - 공통 레코드/뷰 구조 정의 + */ +#ifndef CM_H_0014_H +#define CM_H_0014_H + +/* 공통 처리 뷰 레코드 */ +typedef struct { + char key[16]; + char merch_id[16]; + long amount; + long fee; + char biz_date[9]; + char status[2]; + char reserved[16]; +} cm_h_0014_view_t; + +#define CM_H_0014_STATUS_OPEN "O" +#define CM_H_0014_STATUS_HOLD "H" +#define CM_H_0014_STATUS_CLOSE "C" + +#endif /* CM_H_0014_H */ diff --git a/app/include/cm_h_0015.h b/app/include/cm_h_0015.h new file mode 100644 index 0000000..7d5f902 --- /dev/null +++ b/app/include/cm_h_0015.h @@ -0,0 +1,13 @@ +/* + * cm_h_0015.h - 공통 내부 헬퍼 선언 + */ +#ifndef CM_H_0015_H +#define CM_H_0015_H + +#include "txcore.h" + +int cm_h_0015_check(const char *key, long amount); +int cm_h_0015_apply(TXBUF *in, TXBUF *out); +long cm_h_0015_eval(long amount, int factor); + +#endif /* CM_H_0015_H */ diff --git a/app/include/cm_h_0016.h b/app/include/cm_h_0016.h new file mode 100644 index 0000000..bae4c87 --- /dev/null +++ b/app/include/cm_h_0016.h @@ -0,0 +1,20 @@ +/* + * cm_h_0016.h - 공통 코드/상수 테이블 + */ +#ifndef CM_H_0016_H +#define CM_H_0016_H + +#define CM_H_0016_RC_OK 0 +#define CM_H_0016_RC_RETRY 1 +#define CM_H_0016_RC_SKIP 2 +#define CM_H_0016_RC_ERROR 9 + +#define CM_H_0016_LIMIT_DAILY 100000000L +#define CM_H_0016_LIMIT_SINGLE 50000000L +#define CM_H_0016_FEE_RATE_BP 250 /* 2.50% */ + +#define CM_H_0016_CHAN_ONLINE "01" +#define CM_H_0016_CHAN_BATCH "02" +#define CM_H_0016_CHAN_RECON "03" + +#endif /* CM_H_0016_H */ diff --git a/app/include/cm_io_0001.h b/app/include/cm_io_0001.h new file mode 100644 index 0000000..bc19a02 --- /dev/null +++ b/app/include/cm_io_0001.h @@ -0,0 +1,14 @@ +/* + * cm_io_0001.h - 공통 보조 DBIO 선언 (cm_io_0001.pgc 구현) + */ +#ifndef CM_IO_0001_H +#define CM_IO_0001_H + +#include "txcore.h" + +/* cm_io_0001 전용 조회/갱신 (테이블 cm_io_0001_t) */ +int cm_io_0001_fetch(const char *key, long *out_amount); +int cm_io_0001_touch(const char *key, long amount); +long cm_io_0001_total(const char *biz_date); + +#endif /* CM_IO_0001_H */ diff --git a/app/include/cm_io_0002.h b/app/include/cm_io_0002.h new file mode 100644 index 0000000..4cfb292 --- /dev/null +++ b/app/include/cm_io_0002.h @@ -0,0 +1,14 @@ +/* + * cm_io_0002.h - 공통 보조 DBIO 선언 (cm_io_0002.pgc 구현) + */ +#ifndef CM_IO_0002_H +#define CM_IO_0002_H + +#include "txcore.h" + +/* cm_io_0002 전용 조회/갱신 (테이블 cm_io_0002_t) */ +int cm_io_0002_fetch(const char *key, long *out_amount); +int cm_io_0002_touch(const char *key, long amount); +long cm_io_0002_total(const char *biz_date); + +#endif /* CM_IO_0002_H */ diff --git a/app/include/cm_io_0003.h b/app/include/cm_io_0003.h new file mode 100644 index 0000000..2a24c71 --- /dev/null +++ b/app/include/cm_io_0003.h @@ -0,0 +1,14 @@ +/* + * cm_io_0003.h - 공통 보조 DBIO 선언 (cm_io_0003.pgc 구현) + */ +#ifndef CM_IO_0003_H +#define CM_IO_0003_H + +#include "txcore.h" + +/* cm_io_0003 전용 조회/갱신 (테이블 cm_io_0003_t) */ +int cm_io_0003_fetch(const char *key, long *out_amount); +int cm_io_0003_touch(const char *key, long amount); +long cm_io_0003_total(const char *biz_date); + +#endif /* CM_IO_0003_H */ diff --git a/app/include/cm_io_0004.h b/app/include/cm_io_0004.h new file mode 100644 index 0000000..222434c --- /dev/null +++ b/app/include/cm_io_0004.h @@ -0,0 +1,14 @@ +/* + * cm_io_0004.h - 공통 보조 DBIO 선언 (cm_io_0004.pgc 구현) + */ +#ifndef CM_IO_0004_H +#define CM_IO_0004_H + +#include "txcore.h" + +/* cm_io_0004 전용 조회/갱신 (테이블 cm_io_0004_t) */ +int cm_io_0004_fetch(const char *key, long *out_amount); +int cm_io_0004_touch(const char *key, long amount); +long cm_io_0004_total(const char *biz_date); + +#endif /* CM_IO_0004_H */ diff --git a/app/include/cm_io_0005.h b/app/include/cm_io_0005.h new file mode 100644 index 0000000..a7e325d --- /dev/null +++ b/app/include/cm_io_0005.h @@ -0,0 +1,14 @@ +/* + * cm_io_0005.h - 공통 보조 DBIO 선언 (cm_io_0005.pgc 구현) + */ +#ifndef CM_IO_0005_H +#define CM_IO_0005_H + +#include "txcore.h" + +/* cm_io_0005 전용 조회/갱신 (테이블 cm_io_0005_t) */ +int cm_io_0005_fetch(const char *key, long *out_amount); +int cm_io_0005_touch(const char *key, long amount); +long cm_io_0005_total(const char *biz_date); + +#endif /* CM_IO_0005_H */ diff --git a/app/include/cm_io_0006.h b/app/include/cm_io_0006.h new file mode 100644 index 0000000..4312ceb --- /dev/null +++ b/app/include/cm_io_0006.h @@ -0,0 +1,14 @@ +/* + * cm_io_0006.h - 공통 보조 DBIO 선언 (cm_io_0006.pgc 구현) + */ +#ifndef CM_IO_0006_H +#define CM_IO_0006_H + +#include "txcore.h" + +/* cm_io_0006 전용 조회/갱신 (테이블 cm_io_0006_t) */ +int cm_io_0006_fetch(const char *key, long *out_amount); +int cm_io_0006_touch(const char *key, long amount); +long cm_io_0006_total(const char *biz_date); + +#endif /* CM_IO_0006_H */ diff --git a/app/include/cm_io_0007.h b/app/include/cm_io_0007.h new file mode 100644 index 0000000..80beafb --- /dev/null +++ b/app/include/cm_io_0007.h @@ -0,0 +1,14 @@ +/* + * cm_io_0007.h - 공통 보조 DBIO 선언 (cm_io_0007.pgc 구현) + */ +#ifndef CM_IO_0007_H +#define CM_IO_0007_H + +#include "txcore.h" + +/* cm_io_0007 전용 조회/갱신 (테이블 cm_io_0007_t) */ +int cm_io_0007_fetch(const char *key, long *out_amount); +int cm_io_0007_touch(const char *key, long amount); +long cm_io_0007_total(const char *biz_date); + +#endif /* CM_IO_0007_H */ diff --git a/app/include/cm_io_0008.h b/app/include/cm_io_0008.h new file mode 100644 index 0000000..6569657 --- /dev/null +++ b/app/include/cm_io_0008.h @@ -0,0 +1,14 @@ +/* + * cm_io_0008.h - 공통 보조 DBIO 선언 (cm_io_0008.pgc 구현) + */ +#ifndef CM_IO_0008_H +#define CM_IO_0008_H + +#include "txcore.h" + +/* cm_io_0008 전용 조회/갱신 (테이블 cm_io_0008_t) */ +int cm_io_0008_fetch(const char *key, long *out_amount); +int cm_io_0008_touch(const char *key, long amount); +long cm_io_0008_total(const char *biz_date); + +#endif /* CM_IO_0008_H */ diff --git a/app/include/cm_io_0009.h b/app/include/cm_io_0009.h new file mode 100644 index 0000000..a684ed5 --- /dev/null +++ b/app/include/cm_io_0009.h @@ -0,0 +1,14 @@ +/* + * cm_io_0009.h - 공통 보조 DBIO 선언 (cm_io_0009.pgc 구현) + */ +#ifndef CM_IO_0009_H +#define CM_IO_0009_H + +#include "txcore.h" + +/* cm_io_0009 전용 조회/갱신 (테이블 cm_io_0009_t) */ +int cm_io_0009_fetch(const char *key, long *out_amount); +int cm_io_0009_touch(const char *key, long amount); +long cm_io_0009_total(const char *biz_date); + +#endif /* CM_IO_0009_H */ diff --git a/app/include/cm_io_0010.h b/app/include/cm_io_0010.h new file mode 100644 index 0000000..c285705 --- /dev/null +++ b/app/include/cm_io_0010.h @@ -0,0 +1,14 @@ +/* + * cm_io_0010.h - 공통 보조 DBIO 선언 (cm_io_0010.pgc 구현) + */ +#ifndef CM_IO_0010_H +#define CM_IO_0010_H + +#include "txcore.h" + +/* cm_io_0010 전용 조회/갱신 (테이블 cm_io_0010_t) */ +int cm_io_0010_fetch(const char *key, long *out_amount); +int cm_io_0010_touch(const char *key, long amount); +long cm_io_0010_total(const char *biz_date); + +#endif /* CM_IO_0010_H */ diff --git a/app/include/cm_io_0011.h b/app/include/cm_io_0011.h new file mode 100644 index 0000000..6cd9a5a --- /dev/null +++ b/app/include/cm_io_0011.h @@ -0,0 +1,14 @@ +/* + * cm_io_0011.h - 공통 보조 DBIO 선언 (cm_io_0011.pgc 구현) + */ +#ifndef CM_IO_0011_H +#define CM_IO_0011_H + +#include "txcore.h" + +/* cm_io_0011 전용 조회/갱신 (테이블 cm_io_0011_t) */ +int cm_io_0011_fetch(const char *key, long *out_amount); +int cm_io_0011_touch(const char *key, long amount); +long cm_io_0011_total(const char *biz_date); + +#endif /* CM_IO_0011_H */ diff --git a/app/include/cm_io_0012.h b/app/include/cm_io_0012.h new file mode 100644 index 0000000..e77da98 --- /dev/null +++ b/app/include/cm_io_0012.h @@ -0,0 +1,14 @@ +/* + * cm_io_0012.h - 공통 보조 DBIO 선언 (cm_io_0012.pgc 구현) + */ +#ifndef CM_IO_0012_H +#define CM_IO_0012_H + +#include "txcore.h" + +/* cm_io_0012 전용 조회/갱신 (테이블 cm_io_0012_t) */ +int cm_io_0012_fetch(const char *key, long *out_amount); +int cm_io_0012_touch(const char *key, long amount); +long cm_io_0012_total(const char *biz_date); + +#endif /* CM_IO_0012_H */ diff --git a/app/include/cm_io_0013.h b/app/include/cm_io_0013.h new file mode 100644 index 0000000..f85d4f6 --- /dev/null +++ b/app/include/cm_io_0013.h @@ -0,0 +1,14 @@ +/* + * cm_io_0013.h - 공통 보조 DBIO 선언 (cm_io_0013.pgc 구현) + */ +#ifndef CM_IO_0013_H +#define CM_IO_0013_H + +#include "txcore.h" + +/* cm_io_0013 전용 조회/갱신 (테이블 cm_io_0013_t) */ +int cm_io_0013_fetch(const char *key, long *out_amount); +int cm_io_0013_touch(const char *key, long amount); +long cm_io_0013_total(const char *biz_date); + +#endif /* CM_IO_0013_H */ diff --git a/app/include/cm_io_0014.h b/app/include/cm_io_0014.h new file mode 100644 index 0000000..838ee70 --- /dev/null +++ b/app/include/cm_io_0014.h @@ -0,0 +1,14 @@ +/* + * cm_io_0014.h - 공통 보조 DBIO 선언 (cm_io_0014.pgc 구현) + */ +#ifndef CM_IO_0014_H +#define CM_IO_0014_H + +#include "txcore.h" + +/* cm_io_0014 전용 조회/갱신 (테이블 cm_io_0014_t) */ +int cm_io_0014_fetch(const char *key, long *out_amount); +int cm_io_0014_touch(const char *key, long amount); +long cm_io_0014_total(const char *biz_date); + +#endif /* CM_IO_0014_H */ diff --git a/app/include/cm_io_0015.h b/app/include/cm_io_0015.h new file mode 100644 index 0000000..37c0f93 --- /dev/null +++ b/app/include/cm_io_0015.h @@ -0,0 +1,14 @@ +/* + * cm_io_0015.h - 공통 보조 DBIO 선언 (cm_io_0015.pgc 구현) + */ +#ifndef CM_IO_0015_H +#define CM_IO_0015_H + +#include "txcore.h" + +/* cm_io_0015 전용 조회/갱신 (테이블 cm_io_0015_t) */ +int cm_io_0015_fetch(const char *key, long *out_amount); +int cm_io_0015_touch(const char *key, long amount); +long cm_io_0015_total(const char *biz_date); + +#endif /* CM_IO_0015_H */ diff --git a/app/include/cm_io_0016.h b/app/include/cm_io_0016.h new file mode 100644 index 0000000..4109641 --- /dev/null +++ b/app/include/cm_io_0016.h @@ -0,0 +1,14 @@ +/* + * cm_io_0016.h - 공통 보조 DBIO 선언 (cm_io_0016.pgc 구현) + */ +#ifndef CM_IO_0016_H +#define CM_IO_0016_H + +#include "txcore.h" + +/* cm_io_0016 전용 조회/갱신 (테이블 cm_io_0016_t) */ +int cm_io_0016_fetch(const char *key, long *out_amount); +int cm_io_0016_touch(const char *key, long amount); +long cm_io_0016_total(const char *biz_date); + +#endif /* CM_IO_0016_H */ diff --git a/app/include/cm_io_0017.h b/app/include/cm_io_0017.h new file mode 100644 index 0000000..eaba72f --- /dev/null +++ b/app/include/cm_io_0017.h @@ -0,0 +1,14 @@ +/* + * cm_io_0017.h - 공통 보조 DBIO 선언 (cm_io_0017.pgc 구현) + */ +#ifndef CM_IO_0017_H +#define CM_IO_0017_H + +#include "txcore.h" + +/* cm_io_0017 전용 조회/갱신 (테이블 cm_io_0017_t) */ +int cm_io_0017_fetch(const char *key, long *out_amount); +int cm_io_0017_touch(const char *key, long amount); +long cm_io_0017_total(const char *biz_date); + +#endif /* CM_IO_0017_H */ diff --git a/app/include/cm_io_0018.h b/app/include/cm_io_0018.h new file mode 100644 index 0000000..9e4f5c8 --- /dev/null +++ b/app/include/cm_io_0018.h @@ -0,0 +1,14 @@ +/* + * cm_io_0018.h - 공통 보조 DBIO 선언 (cm_io_0018.pgc 구현) + */ +#ifndef CM_IO_0018_H +#define CM_IO_0018_H + +#include "txcore.h" + +/* cm_io_0018 전용 조회/갱신 (테이블 cm_io_0018_t) */ +int cm_io_0018_fetch(const char *key, long *out_amount); +int cm_io_0018_touch(const char *key, long amount); +long cm_io_0018_total(const char *biz_date); + +#endif /* CM_IO_0018_H */ diff --git a/app/include/cm_io_0019.h b/app/include/cm_io_0019.h new file mode 100644 index 0000000..4dfa538 --- /dev/null +++ b/app/include/cm_io_0019.h @@ -0,0 +1,14 @@ +/* + * cm_io_0019.h - 공통 보조 DBIO 선언 (cm_io_0019.pgc 구현) + */ +#ifndef CM_IO_0019_H +#define CM_IO_0019_H + +#include "txcore.h" + +/* cm_io_0019 전용 조회/갱신 (테이블 cm_io_0019_t) */ +int cm_io_0019_fetch(const char *key, long *out_amount); +int cm_io_0019_touch(const char *key, long amount); +long cm_io_0019_total(const char *biz_date); + +#endif /* CM_IO_0019_H */ diff --git a/app/include/cm_io_0020.h b/app/include/cm_io_0020.h new file mode 100644 index 0000000..48e6c56 --- /dev/null +++ b/app/include/cm_io_0020.h @@ -0,0 +1,14 @@ +/* + * cm_io_0020.h - 공통 보조 DBIO 선언 (cm_io_0020.pgc 구현) + */ +#ifndef CM_IO_0020_H +#define CM_IO_0020_H + +#include "txcore.h" + +/* cm_io_0020 전용 조회/갱신 (테이블 cm_io_0020_t) */ +int cm_io_0020_fetch(const char *key, long *out_amount); +int cm_io_0020_touch(const char *key, long amount); +long cm_io_0020_total(const char *biz_date); + +#endif /* CM_IO_0020_H */ diff --git a/app/include/cm_io_0021.h b/app/include/cm_io_0021.h new file mode 100644 index 0000000..1d02d2c --- /dev/null +++ b/app/include/cm_io_0021.h @@ -0,0 +1,14 @@ +/* + * cm_io_0021.h - 공통 보조 DBIO 선언 (cm_io_0021.pgc 구현) + */ +#ifndef CM_IO_0021_H +#define CM_IO_0021_H + +#include "txcore.h" + +/* cm_io_0021 전용 조회/갱신 (테이블 cm_io_0021_t) */ +int cm_io_0021_fetch(const char *key, long *out_amount); +int cm_io_0021_touch(const char *key, long amount); +long cm_io_0021_total(const char *biz_date); + +#endif /* CM_IO_0021_H */ diff --git a/app/include/cm_io_0022.h b/app/include/cm_io_0022.h new file mode 100644 index 0000000..764d85c --- /dev/null +++ b/app/include/cm_io_0022.h @@ -0,0 +1,14 @@ +/* + * cm_io_0022.h - 공통 보조 DBIO 선언 (cm_io_0022.pgc 구현) + */ +#ifndef CM_IO_0022_H +#define CM_IO_0022_H + +#include "txcore.h" + +/* cm_io_0022 전용 조회/갱신 (테이블 cm_io_0022_t) */ +int cm_io_0022_fetch(const char *key, long *out_amount); +int cm_io_0022_touch(const char *key, long amount); +long cm_io_0022_total(const char *biz_date); + +#endif /* CM_IO_0022_H */ diff --git a/app/include/cm_io_0023.h b/app/include/cm_io_0023.h new file mode 100644 index 0000000..815b30a --- /dev/null +++ b/app/include/cm_io_0023.h @@ -0,0 +1,14 @@ +/* + * cm_io_0023.h - 공통 보조 DBIO 선언 (cm_io_0023.pgc 구현) + */ +#ifndef CM_IO_0023_H +#define CM_IO_0023_H + +#include "txcore.h" + +/* cm_io_0023 전용 조회/갱신 (테이블 cm_io_0023_t) */ +int cm_io_0023_fetch(const char *key, long *out_amount); +int cm_io_0023_touch(const char *key, long amount); +long cm_io_0023_total(const char *biz_date); + +#endif /* CM_IO_0023_H */ diff --git a/app/include/cm_io_0024.h b/app/include/cm_io_0024.h new file mode 100644 index 0000000..2ec3854 --- /dev/null +++ b/app/include/cm_io_0024.h @@ -0,0 +1,14 @@ +/* + * cm_io_0024.h - 공통 보조 DBIO 선언 (cm_io_0024.pgc 구현) + */ +#ifndef CM_IO_0024_H +#define CM_IO_0024_H + +#include "txcore.h" + +/* cm_io_0024 전용 조회/갱신 (테이블 cm_io_0024_t) */ +int cm_io_0024_fetch(const char *key, long *out_amount); +int cm_io_0024_touch(const char *key, long amount); +long cm_io_0024_total(const char *biz_date); + +#endif /* CM_IO_0024_H */ diff --git a/app/include/cm_io_0025.h b/app/include/cm_io_0025.h new file mode 100644 index 0000000..4c6fe05 --- /dev/null +++ b/app/include/cm_io_0025.h @@ -0,0 +1,14 @@ +/* + * cm_io_0025.h - 공통 보조 DBIO 선언 (cm_io_0025.pgc 구현) + */ +#ifndef CM_IO_0025_H +#define CM_IO_0025_H + +#include "txcore.h" + +/* cm_io_0025 전용 조회/갱신 (테이블 cm_io_0025_t) */ +int cm_io_0025_fetch(const char *key, long *out_amount); +int cm_io_0025_touch(const char *key, long amount); +long cm_io_0025_total(const char *biz_date); + +#endif /* CM_IO_0025_H */ diff --git a/app/include/cm_io_0026.h b/app/include/cm_io_0026.h new file mode 100644 index 0000000..a44b961 --- /dev/null +++ b/app/include/cm_io_0026.h @@ -0,0 +1,14 @@ +/* + * cm_io_0026.h - 공통 보조 DBIO 선언 (cm_io_0026.pgc 구현) + */ +#ifndef CM_IO_0026_H +#define CM_IO_0026_H + +#include "txcore.h" + +/* cm_io_0026 전용 조회/갱신 (테이블 cm_io_0026_t) */ +int cm_io_0026_fetch(const char *key, long *out_amount); +int cm_io_0026_touch(const char *key, long amount); +long cm_io_0026_total(const char *biz_date); + +#endif /* CM_IO_0026_H */ diff --git a/app/include/lg_core.h b/app/include/lg_core.h new file mode 100644 index 0000000..b705be4 --- /dev/null +++ b/app/include/lg_core.h @@ -0,0 +1,38 @@ +/* + * lg_core.h - 원장 모듈 핵심 계약 (레코드/상태/표준 DBIO API) + * + * 이 모듈의 온라인/배치 프로그램은 SQL 을 직접 다루지 않고 아래 표준 + * DBIO API 만 호출한다. 구현은 app/dbio/lg_dbio_main.pgc (ECPG). + */ +#ifndef LG_CORE_H +#define LG_CORE_H + +#include "txcore.h" + +/* 원장 처리 상태코드 */ +#define LG_ST_RECV "R" /* 접수/수신 */ +#define LG_ST_DONE "M" /* 처리완료 */ +#define LG_ST_FAIL "U" /* 불일치/실패 */ +#define LG_ST_SETTLED "S" /* 정산완료 */ + +/* 원장 원장 레코드 (1행) */ +typedef struct { + char key[16]; /* 처리키(승인/거래 번호) PK */ + char merch_id[16]; /* 가맹점번호 */ + char card_no[20]; /* 카드번호(마스킹) */ + long amount; /* 거래금액(원) */ + char biz_date[9]; /* 영업일 YYYYMMDD */ + char status[2]; /* 상태코드 */ + long fee; /* 수수료(원) */ +} lg_rec_t; + +/* 표준 DBIO API (구현: lg_dbio_main.pgc) */ +int lg_dbio_connect(const char *target); +int lg_dbio_disconnect(void); +int lg_rec_insert(const lg_rec_t *rec); +int lg_rec_select(const char *key, lg_rec_t *out); +int lg_rec_update_status(const char *key, const char *status); +long lg_rec_count(const char *biz_date, const char *status); +int lg_rec_sum(const char *biz_date, long *out_sum); + +#endif /* LG_CORE_H */ diff --git a/app/include/lg_cu_0001.h b/app/include/lg_cu_0001.h new file mode 100644 index 0000000..eef3b2b --- /dev/null +++ b/app/include/lg_cu_0001.h @@ -0,0 +1,11 @@ +/* + * lg_cu_0001.h - 원장 공통 유틸 선언 (lg_cu_0001.c 구현) + */ +#ifndef LG_CU_0001_H +#define LG_CU_0001_H + +long lg_cu_0001_fee(long amount, int rate_bp); +long lg_cu_0001_round_unit(long amount, long unit); +int lg_cu_0001_classify(long amount); + +#endif /* LG_CU_0001_H */ diff --git a/app/include/lg_cu_0002.h b/app/include/lg_cu_0002.h new file mode 100644 index 0000000..0d8efb3 --- /dev/null +++ b/app/include/lg_cu_0002.h @@ -0,0 +1,11 @@ +/* + * lg_cu_0002.h - 원장 공통 유틸 선언 (lg_cu_0002.c 구현) + */ +#ifndef LG_CU_0002_H +#define LG_CU_0002_H + +long lg_cu_0002_fee(long amount, int rate_bp); +long lg_cu_0002_round_unit(long amount, long unit); +int lg_cu_0002_classify(long amount); + +#endif /* LG_CU_0002_H */ diff --git a/app/include/lg_cu_0003.h b/app/include/lg_cu_0003.h new file mode 100644 index 0000000..0e37645 --- /dev/null +++ b/app/include/lg_cu_0003.h @@ -0,0 +1,11 @@ +/* + * lg_cu_0003.h - 원장 공통 유틸 선언 (lg_cu_0003.c 구현) + */ +#ifndef LG_CU_0003_H +#define LG_CU_0003_H + +long lg_cu_0003_fee(long amount, int rate_bp); +long lg_cu_0003_round_unit(long amount, long unit); +int lg_cu_0003_classify(long amount); + +#endif /* LG_CU_0003_H */ diff --git a/app/include/lg_cu_0004.h b/app/include/lg_cu_0004.h new file mode 100644 index 0000000..7e3b485 --- /dev/null +++ b/app/include/lg_cu_0004.h @@ -0,0 +1,11 @@ +/* + * lg_cu_0004.h - 원장 공통 유틸 선언 (lg_cu_0004.c 구현) + */ +#ifndef LG_CU_0004_H +#define LG_CU_0004_H + +long lg_cu_0004_fee(long amount, int rate_bp); +long lg_cu_0004_round_unit(long amount, long unit); +int lg_cu_0004_classify(long amount); + +#endif /* LG_CU_0004_H */ diff --git a/app/include/lg_cu_0005.h b/app/include/lg_cu_0005.h new file mode 100644 index 0000000..31ff327 --- /dev/null +++ b/app/include/lg_cu_0005.h @@ -0,0 +1,11 @@ +/* + * lg_cu_0005.h - 원장 공통 유틸 선언 (lg_cu_0005.c 구현) + */ +#ifndef LG_CU_0005_H +#define LG_CU_0005_H + +long lg_cu_0005_fee(long amount, int rate_bp); +long lg_cu_0005_round_unit(long amount, long unit); +int lg_cu_0005_classify(long amount); + +#endif /* LG_CU_0005_H */ diff --git a/app/include/lg_cu_0006.h b/app/include/lg_cu_0006.h new file mode 100644 index 0000000..07c3d44 --- /dev/null +++ b/app/include/lg_cu_0006.h @@ -0,0 +1,11 @@ +/* + * lg_cu_0006.h - 원장 공통 유틸 선언 (lg_cu_0006.c 구현) + */ +#ifndef LG_CU_0006_H +#define LG_CU_0006_H + +long lg_cu_0006_fee(long amount, int rate_bp); +long lg_cu_0006_round_unit(long amount, long unit); +int lg_cu_0006_classify(long amount); + +#endif /* LG_CU_0006_H */ diff --git a/app/include/lg_cu_0007.h b/app/include/lg_cu_0007.h new file mode 100644 index 0000000..8fbe740 --- /dev/null +++ b/app/include/lg_cu_0007.h @@ -0,0 +1,11 @@ +/* + * lg_cu_0007.h - 원장 공통 유틸 선언 (lg_cu_0007.c 구현) + */ +#ifndef LG_CU_0007_H +#define LG_CU_0007_H + +long lg_cu_0007_fee(long amount, int rate_bp); +long lg_cu_0007_round_unit(long amount, long unit); +int lg_cu_0007_classify(long amount); + +#endif /* LG_CU_0007_H */ diff --git a/app/include/lg_cu_0008.h b/app/include/lg_cu_0008.h new file mode 100644 index 0000000..72c9ce7 --- /dev/null +++ b/app/include/lg_cu_0008.h @@ -0,0 +1,11 @@ +/* + * lg_cu_0008.h - 원장 공통 유틸 선언 (lg_cu_0008.c 구현) + */ +#ifndef LG_CU_0008_H +#define LG_CU_0008_H + +long lg_cu_0008_fee(long amount, int rate_bp); +long lg_cu_0008_round_unit(long amount, long unit); +int lg_cu_0008_classify(long amount); + +#endif /* LG_CU_0008_H */ diff --git a/app/include/lg_cu_0009.h b/app/include/lg_cu_0009.h new file mode 100644 index 0000000..96f1c3f --- /dev/null +++ b/app/include/lg_cu_0009.h @@ -0,0 +1,11 @@ +/* + * lg_cu_0009.h - 원장 공통 유틸 선언 (lg_cu_0009.c 구현) + */ +#ifndef LG_CU_0009_H +#define LG_CU_0009_H + +long lg_cu_0009_fee(long amount, int rate_bp); +long lg_cu_0009_round_unit(long amount, long unit); +int lg_cu_0009_classify(long amount); + +#endif /* LG_CU_0009_H */ diff --git a/app/include/lg_cu_0010.h b/app/include/lg_cu_0010.h new file mode 100644 index 0000000..142e767 --- /dev/null +++ b/app/include/lg_cu_0010.h @@ -0,0 +1,11 @@ +/* + * lg_cu_0010.h - 원장 공통 유틸 선언 (lg_cu_0010.c 구현) + */ +#ifndef LG_CU_0010_H +#define LG_CU_0010_H + +long lg_cu_0010_fee(long amount, int rate_bp); +long lg_cu_0010_round_unit(long amount, long unit); +int lg_cu_0010_classify(long amount); + +#endif /* LG_CU_0010_H */ diff --git a/app/include/lg_cu_0011.h b/app/include/lg_cu_0011.h new file mode 100644 index 0000000..7f72dde --- /dev/null +++ b/app/include/lg_cu_0011.h @@ -0,0 +1,11 @@ +/* + * lg_cu_0011.h - 원장 공통 유틸 선언 (lg_cu_0011.c 구현) + */ +#ifndef LG_CU_0011_H +#define LG_CU_0011_H + +long lg_cu_0011_fee(long amount, int rate_bp); +long lg_cu_0011_round_unit(long amount, long unit); +int lg_cu_0011_classify(long amount); + +#endif /* LG_CU_0011_H */ diff --git a/app/include/lg_h_0001.h b/app/include/lg_h_0001.h new file mode 100644 index 0000000..a3ce8bd --- /dev/null +++ b/app/include/lg_h_0001.h @@ -0,0 +1,13 @@ +/* + * lg_h_0001.h - 원장 내부 헬퍼 선언 + */ +#ifndef LG_H_0001_H +#define LG_H_0001_H + +#include "txcore.h" + +int lg_h_0001_check(const char *key, long amount); +int lg_h_0001_apply(TXBUF *in, TXBUF *out); +long lg_h_0001_eval(long amount, int factor); + +#endif /* LG_H_0001_H */ diff --git a/app/include/lg_h_0002.h b/app/include/lg_h_0002.h new file mode 100644 index 0000000..a11d2d8 --- /dev/null +++ b/app/include/lg_h_0002.h @@ -0,0 +1,20 @@ +/* + * lg_h_0002.h - 원장 코드/상수 테이블 + */ +#ifndef LG_H_0002_H +#define LG_H_0002_H + +#define LG_H_0002_RC_OK 0 +#define LG_H_0002_RC_RETRY 1 +#define LG_H_0002_RC_SKIP 2 +#define LG_H_0002_RC_ERROR 9 + +#define LG_H_0002_LIMIT_DAILY 100000000L +#define LG_H_0002_LIMIT_SINGLE 50000000L +#define LG_H_0002_FEE_RATE_BP 250 /* 2.50% */ + +#define LG_H_0002_CHAN_ONLINE "01" +#define LG_H_0002_CHAN_BATCH "02" +#define LG_H_0002_CHAN_RECON "03" + +#endif /* LG_H_0002_H */ diff --git a/app/include/lg_h_0003.h b/app/include/lg_h_0003.h new file mode 100644 index 0000000..9e782a2 --- /dev/null +++ b/app/include/lg_h_0003.h @@ -0,0 +1,19 @@ +/* + * lg_h_0003.h - 원장 고정길이 전문 레이아웃 (positional, 재배치 금지) + */ +#ifndef LG_H_0003_H +#define LG_H_0003_H + +typedef struct { + char msg_type[4]; /* 전문구분 4 */ + char merch_id[15]; /* 가맹점번호 15 */ + char key[9]; /* 처리키 9 */ + char amount[12]; /* 금액 12 zero-pad */ + char biz_date[8]; /* 영업일 8 */ + char resp_code[4]; /* 응답코드 4 */ + char filler[20]; /* 예비 20 */ +} lg_h_0003_msg_t; + +#define LG_H_0003_MSG_LEN ((int)sizeof(lg_h_0003_msg_t)) + +#endif /* LG_H_0003_H */ diff --git a/app/include/lg_h_0004.h b/app/include/lg_h_0004.h new file mode 100644 index 0000000..f2ebdb5 --- /dev/null +++ b/app/include/lg_h_0004.h @@ -0,0 +1,22 @@ +/* + * lg_h_0004.h - 원장 레코드/뷰 구조 정의 + */ +#ifndef LG_H_0004_H +#define LG_H_0004_H + +/* 원장 처리 뷰 레코드 */ +typedef struct { + char key[16]; + char merch_id[16]; + long amount; + long fee; + char biz_date[9]; + char status[2]; + char reserved[16]; +} lg_h_0004_view_t; + +#define LG_H_0004_STATUS_OPEN "O" +#define LG_H_0004_STATUS_HOLD "H" +#define LG_H_0004_STATUS_CLOSE "C" + +#endif /* LG_H_0004_H */ diff --git a/app/include/lg_h_0005.h b/app/include/lg_h_0005.h new file mode 100644 index 0000000..726f7d9 --- /dev/null +++ b/app/include/lg_h_0005.h @@ -0,0 +1,13 @@ +/* + * lg_h_0005.h - 원장 내부 헬퍼 선언 + */ +#ifndef LG_H_0005_H +#define LG_H_0005_H + +#include "txcore.h" + +int lg_h_0005_check(const char *key, long amount); +int lg_h_0005_apply(TXBUF *in, TXBUF *out); +long lg_h_0005_eval(long amount, int factor); + +#endif /* LG_H_0005_H */ diff --git a/app/include/lg_h_0006.h b/app/include/lg_h_0006.h new file mode 100644 index 0000000..43c1ce0 --- /dev/null +++ b/app/include/lg_h_0006.h @@ -0,0 +1,20 @@ +/* + * lg_h_0006.h - 원장 코드/상수 테이블 + */ +#ifndef LG_H_0006_H +#define LG_H_0006_H + +#define LG_H_0006_RC_OK 0 +#define LG_H_0006_RC_RETRY 1 +#define LG_H_0006_RC_SKIP 2 +#define LG_H_0006_RC_ERROR 9 + +#define LG_H_0006_LIMIT_DAILY 100000000L +#define LG_H_0006_LIMIT_SINGLE 50000000L +#define LG_H_0006_FEE_RATE_BP 250 /* 2.50% */ + +#define LG_H_0006_CHAN_ONLINE "01" +#define LG_H_0006_CHAN_BATCH "02" +#define LG_H_0006_CHAN_RECON "03" + +#endif /* LG_H_0006_H */ diff --git a/app/include/lg_h_0007.h b/app/include/lg_h_0007.h new file mode 100644 index 0000000..3739172 --- /dev/null +++ b/app/include/lg_h_0007.h @@ -0,0 +1,19 @@ +/* + * lg_h_0007.h - 원장 고정길이 전문 레이아웃 (positional, 재배치 금지) + */ +#ifndef LG_H_0007_H +#define LG_H_0007_H + +typedef struct { + char msg_type[4]; /* 전문구분 4 */ + char merch_id[15]; /* 가맹점번호 15 */ + char key[9]; /* 처리키 9 */ + char amount[12]; /* 금액 12 zero-pad */ + char biz_date[8]; /* 영업일 8 */ + char resp_code[4]; /* 응답코드 4 */ + char filler[20]; /* 예비 20 */ +} lg_h_0007_msg_t; + +#define LG_H_0007_MSG_LEN ((int)sizeof(lg_h_0007_msg_t)) + +#endif /* LG_H_0007_H */ diff --git a/app/include/lg_h_0008.h b/app/include/lg_h_0008.h new file mode 100644 index 0000000..78d5929 --- /dev/null +++ b/app/include/lg_h_0008.h @@ -0,0 +1,22 @@ +/* + * lg_h_0008.h - 원장 레코드/뷰 구조 정의 + */ +#ifndef LG_H_0008_H +#define LG_H_0008_H + +/* 원장 처리 뷰 레코드 */ +typedef struct { + char key[16]; + char merch_id[16]; + long amount; + long fee; + char biz_date[9]; + char status[2]; + char reserved[16]; +} lg_h_0008_view_t; + +#define LG_H_0008_STATUS_OPEN "O" +#define LG_H_0008_STATUS_HOLD "H" +#define LG_H_0008_STATUS_CLOSE "C" + +#endif /* LG_H_0008_H */ diff --git a/app/include/lg_h_0009.h b/app/include/lg_h_0009.h new file mode 100644 index 0000000..99d27f9 --- /dev/null +++ b/app/include/lg_h_0009.h @@ -0,0 +1,13 @@ +/* + * lg_h_0009.h - 원장 내부 헬퍼 선언 + */ +#ifndef LG_H_0009_H +#define LG_H_0009_H + +#include "txcore.h" + +int lg_h_0009_check(const char *key, long amount); +int lg_h_0009_apply(TXBUF *in, TXBUF *out); +long lg_h_0009_eval(long amount, int factor); + +#endif /* LG_H_0009_H */ diff --git a/app/include/lg_h_0010.h b/app/include/lg_h_0010.h new file mode 100644 index 0000000..d324ce7 --- /dev/null +++ b/app/include/lg_h_0010.h @@ -0,0 +1,20 @@ +/* + * lg_h_0010.h - 원장 코드/상수 테이블 + */ +#ifndef LG_H_0010_H +#define LG_H_0010_H + +#define LG_H_0010_RC_OK 0 +#define LG_H_0010_RC_RETRY 1 +#define LG_H_0010_RC_SKIP 2 +#define LG_H_0010_RC_ERROR 9 + +#define LG_H_0010_LIMIT_DAILY 100000000L +#define LG_H_0010_LIMIT_SINGLE 50000000L +#define LG_H_0010_FEE_RATE_BP 250 /* 2.50% */ + +#define LG_H_0010_CHAN_ONLINE "01" +#define LG_H_0010_CHAN_BATCH "02" +#define LG_H_0010_CHAN_RECON "03" + +#endif /* LG_H_0010_H */ diff --git a/app/include/lg_h_0011.h b/app/include/lg_h_0011.h new file mode 100644 index 0000000..ffa9ac3 --- /dev/null +++ b/app/include/lg_h_0011.h @@ -0,0 +1,19 @@ +/* + * lg_h_0011.h - 원장 고정길이 전문 레이아웃 (positional, 재배치 금지) + */ +#ifndef LG_H_0011_H +#define LG_H_0011_H + +typedef struct { + char msg_type[4]; /* 전문구분 4 */ + char merch_id[15]; /* 가맹점번호 15 */ + char key[9]; /* 처리키 9 */ + char amount[12]; /* 금액 12 zero-pad */ + char biz_date[8]; /* 영업일 8 */ + char resp_code[4]; /* 응답코드 4 */ + char filler[20]; /* 예비 20 */ +} lg_h_0011_msg_t; + +#define LG_H_0011_MSG_LEN ((int)sizeof(lg_h_0011_msg_t)) + +#endif /* LG_H_0011_H */ diff --git a/app/include/lg_h_0012.h b/app/include/lg_h_0012.h new file mode 100644 index 0000000..9dadc91 --- /dev/null +++ b/app/include/lg_h_0012.h @@ -0,0 +1,22 @@ +/* + * lg_h_0012.h - 원장 레코드/뷰 구조 정의 + */ +#ifndef LG_H_0012_H +#define LG_H_0012_H + +/* 원장 처리 뷰 레코드 */ +typedef struct { + char key[16]; + char merch_id[16]; + long amount; + long fee; + char biz_date[9]; + char status[2]; + char reserved[16]; +} lg_h_0012_view_t; + +#define LG_H_0012_STATUS_OPEN "O" +#define LG_H_0012_STATUS_HOLD "H" +#define LG_H_0012_STATUS_CLOSE "C" + +#endif /* LG_H_0012_H */ diff --git a/app/include/lg_h_0013.h b/app/include/lg_h_0013.h new file mode 100644 index 0000000..45617cf --- /dev/null +++ b/app/include/lg_h_0013.h @@ -0,0 +1,13 @@ +/* + * lg_h_0013.h - 원장 내부 헬퍼 선언 + */ +#ifndef LG_H_0013_H +#define LG_H_0013_H + +#include "txcore.h" + +int lg_h_0013_check(const char *key, long amount); +int lg_h_0013_apply(TXBUF *in, TXBUF *out); +long lg_h_0013_eval(long amount, int factor); + +#endif /* LG_H_0013_H */ diff --git a/app/include/lg_h_0014.h b/app/include/lg_h_0014.h new file mode 100644 index 0000000..7c6a6b0 --- /dev/null +++ b/app/include/lg_h_0014.h @@ -0,0 +1,20 @@ +/* + * lg_h_0014.h - 원장 코드/상수 테이블 + */ +#ifndef LG_H_0014_H +#define LG_H_0014_H + +#define LG_H_0014_RC_OK 0 +#define LG_H_0014_RC_RETRY 1 +#define LG_H_0014_RC_SKIP 2 +#define LG_H_0014_RC_ERROR 9 + +#define LG_H_0014_LIMIT_DAILY 100000000L +#define LG_H_0014_LIMIT_SINGLE 50000000L +#define LG_H_0014_FEE_RATE_BP 250 /* 2.50% */ + +#define LG_H_0014_CHAN_ONLINE "01" +#define LG_H_0014_CHAN_BATCH "02" +#define LG_H_0014_CHAN_RECON "03" + +#endif /* LG_H_0014_H */ diff --git a/app/include/lg_h_0015.h b/app/include/lg_h_0015.h new file mode 100644 index 0000000..a3afd22 --- /dev/null +++ b/app/include/lg_h_0015.h @@ -0,0 +1,19 @@ +/* + * lg_h_0015.h - 원장 고정길이 전문 레이아웃 (positional, 재배치 금지) + */ +#ifndef LG_H_0015_H +#define LG_H_0015_H + +typedef struct { + char msg_type[4]; /* 전문구분 4 */ + char merch_id[15]; /* 가맹점번호 15 */ + char key[9]; /* 처리키 9 */ + char amount[12]; /* 금액 12 zero-pad */ + char biz_date[8]; /* 영업일 8 */ + char resp_code[4]; /* 응답코드 4 */ + char filler[20]; /* 예비 20 */ +} lg_h_0015_msg_t; + +#define LG_H_0015_MSG_LEN ((int)sizeof(lg_h_0015_msg_t)) + +#endif /* LG_H_0015_H */ diff --git a/app/include/lg_h_0016.h b/app/include/lg_h_0016.h new file mode 100644 index 0000000..4e6611b --- /dev/null +++ b/app/include/lg_h_0016.h @@ -0,0 +1,22 @@ +/* + * lg_h_0016.h - 원장 레코드/뷰 구조 정의 + */ +#ifndef LG_H_0016_H +#define LG_H_0016_H + +/* 원장 처리 뷰 레코드 */ +typedef struct { + char key[16]; + char merch_id[16]; + long amount; + long fee; + char biz_date[9]; + char status[2]; + char reserved[16]; +} lg_h_0016_view_t; + +#define LG_H_0016_STATUS_OPEN "O" +#define LG_H_0016_STATUS_HOLD "H" +#define LG_H_0016_STATUS_CLOSE "C" + +#endif /* LG_H_0016_H */ diff --git a/app/include/lg_io_0001.h b/app/include/lg_io_0001.h new file mode 100644 index 0000000..544e8fa --- /dev/null +++ b/app/include/lg_io_0001.h @@ -0,0 +1,14 @@ +/* + * lg_io_0001.h - 원장 보조 DBIO 선언 (lg_io_0001.pgc 구현) + */ +#ifndef LG_IO_0001_H +#define LG_IO_0001_H + +#include "txcore.h" + +/* lg_io_0001 전용 조회/갱신 (테이블 lg_io_0001_t) */ +int lg_io_0001_fetch(const char *key, long *out_amount); +int lg_io_0001_touch(const char *key, long amount); +long lg_io_0001_total(const char *biz_date); + +#endif /* LG_IO_0001_H */ diff --git a/app/include/lg_io_0002.h b/app/include/lg_io_0002.h new file mode 100644 index 0000000..6b592f8 --- /dev/null +++ b/app/include/lg_io_0002.h @@ -0,0 +1,14 @@ +/* + * lg_io_0002.h - 원장 보조 DBIO 선언 (lg_io_0002.pgc 구현) + */ +#ifndef LG_IO_0002_H +#define LG_IO_0002_H + +#include "txcore.h" + +/* lg_io_0002 전용 조회/갱신 (테이블 lg_io_0002_t) */ +int lg_io_0002_fetch(const char *key, long *out_amount); +int lg_io_0002_touch(const char *key, long amount); +long lg_io_0002_total(const char *biz_date); + +#endif /* LG_IO_0002_H */ diff --git a/app/include/lg_io_0003.h b/app/include/lg_io_0003.h new file mode 100644 index 0000000..b9e02d4 --- /dev/null +++ b/app/include/lg_io_0003.h @@ -0,0 +1,14 @@ +/* + * lg_io_0003.h - 원장 보조 DBIO 선언 (lg_io_0003.pgc 구현) + */ +#ifndef LG_IO_0003_H +#define LG_IO_0003_H + +#include "txcore.h" + +/* lg_io_0003 전용 조회/갱신 (테이블 lg_io_0003_t) */ +int lg_io_0003_fetch(const char *key, long *out_amount); +int lg_io_0003_touch(const char *key, long amount); +long lg_io_0003_total(const char *biz_date); + +#endif /* LG_IO_0003_H */ diff --git a/app/include/lg_io_0004.h b/app/include/lg_io_0004.h new file mode 100644 index 0000000..c0e4e1e --- /dev/null +++ b/app/include/lg_io_0004.h @@ -0,0 +1,14 @@ +/* + * lg_io_0004.h - 원장 보조 DBIO 선언 (lg_io_0004.pgc 구현) + */ +#ifndef LG_IO_0004_H +#define LG_IO_0004_H + +#include "txcore.h" + +/* lg_io_0004 전용 조회/갱신 (테이블 lg_io_0004_t) */ +int lg_io_0004_fetch(const char *key, long *out_amount); +int lg_io_0004_touch(const char *key, long amount); +long lg_io_0004_total(const char *biz_date); + +#endif /* LG_IO_0004_H */ diff --git a/app/include/lg_io_0005.h b/app/include/lg_io_0005.h new file mode 100644 index 0000000..34b2c49 --- /dev/null +++ b/app/include/lg_io_0005.h @@ -0,0 +1,14 @@ +/* + * lg_io_0005.h - 원장 보조 DBIO 선언 (lg_io_0005.pgc 구현) + */ +#ifndef LG_IO_0005_H +#define LG_IO_0005_H + +#include "txcore.h" + +/* lg_io_0005 전용 조회/갱신 (테이블 lg_io_0005_t) */ +int lg_io_0005_fetch(const char *key, long *out_amount); +int lg_io_0005_touch(const char *key, long amount); +long lg_io_0005_total(const char *biz_date); + +#endif /* LG_IO_0005_H */ diff --git a/app/include/lg_io_0006.h b/app/include/lg_io_0006.h new file mode 100644 index 0000000..2b4e262 --- /dev/null +++ b/app/include/lg_io_0006.h @@ -0,0 +1,14 @@ +/* + * lg_io_0006.h - 원장 보조 DBIO 선언 (lg_io_0006.pgc 구현) + */ +#ifndef LG_IO_0006_H +#define LG_IO_0006_H + +#include "txcore.h" + +/* lg_io_0006 전용 조회/갱신 (테이블 lg_io_0006_t) */ +int lg_io_0006_fetch(const char *key, long *out_amount); +int lg_io_0006_touch(const char *key, long amount); +long lg_io_0006_total(const char *biz_date); + +#endif /* LG_IO_0006_H */ diff --git a/app/include/lg_io_0007.h b/app/include/lg_io_0007.h new file mode 100644 index 0000000..b50e8df --- /dev/null +++ b/app/include/lg_io_0007.h @@ -0,0 +1,14 @@ +/* + * lg_io_0007.h - 원장 보조 DBIO 선언 (lg_io_0007.pgc 구현) + */ +#ifndef LG_IO_0007_H +#define LG_IO_0007_H + +#include "txcore.h" + +/* lg_io_0007 전용 조회/갱신 (테이블 lg_io_0007_t) */ +int lg_io_0007_fetch(const char *key, long *out_amount); +int lg_io_0007_touch(const char *key, long amount); +long lg_io_0007_total(const char *biz_date); + +#endif /* LG_IO_0007_H */ diff --git a/app/include/lg_io_0008.h b/app/include/lg_io_0008.h new file mode 100644 index 0000000..df84029 --- /dev/null +++ b/app/include/lg_io_0008.h @@ -0,0 +1,14 @@ +/* + * lg_io_0008.h - 원장 보조 DBIO 선언 (lg_io_0008.pgc 구현) + */ +#ifndef LG_IO_0008_H +#define LG_IO_0008_H + +#include "txcore.h" + +/* lg_io_0008 전용 조회/갱신 (테이블 lg_io_0008_t) */ +int lg_io_0008_fetch(const char *key, long *out_amount); +int lg_io_0008_touch(const char *key, long amount); +long lg_io_0008_total(const char *biz_date); + +#endif /* LG_IO_0008_H */ diff --git a/app/include/lg_io_0009.h b/app/include/lg_io_0009.h new file mode 100644 index 0000000..8e512a7 --- /dev/null +++ b/app/include/lg_io_0009.h @@ -0,0 +1,14 @@ +/* + * lg_io_0009.h - 원장 보조 DBIO 선언 (lg_io_0009.pgc 구현) + */ +#ifndef LG_IO_0009_H +#define LG_IO_0009_H + +#include "txcore.h" + +/* lg_io_0009 전용 조회/갱신 (테이블 lg_io_0009_t) */ +int lg_io_0009_fetch(const char *key, long *out_amount); +int lg_io_0009_touch(const char *key, long amount); +long lg_io_0009_total(const char *biz_date); + +#endif /* LG_IO_0009_H */ diff --git a/app/include/lg_io_0010.h b/app/include/lg_io_0010.h new file mode 100644 index 0000000..203bec0 --- /dev/null +++ b/app/include/lg_io_0010.h @@ -0,0 +1,14 @@ +/* + * lg_io_0010.h - 원장 보조 DBIO 선언 (lg_io_0010.pgc 구현) + */ +#ifndef LG_IO_0010_H +#define LG_IO_0010_H + +#include "txcore.h" + +/* lg_io_0010 전용 조회/갱신 (테이블 lg_io_0010_t) */ +int lg_io_0010_fetch(const char *key, long *out_amount); +int lg_io_0010_touch(const char *key, long amount); +long lg_io_0010_total(const char *biz_date); + +#endif /* LG_IO_0010_H */ diff --git a/app/include/lg_io_0011.h b/app/include/lg_io_0011.h new file mode 100644 index 0000000..ab6ddfa --- /dev/null +++ b/app/include/lg_io_0011.h @@ -0,0 +1,14 @@ +/* + * lg_io_0011.h - 원장 보조 DBIO 선언 (lg_io_0011.pgc 구현) + */ +#ifndef LG_IO_0011_H +#define LG_IO_0011_H + +#include "txcore.h" + +/* lg_io_0011 전용 조회/갱신 (테이블 lg_io_0011_t) */ +int lg_io_0011_fetch(const char *key, long *out_amount); +int lg_io_0011_touch(const char *key, long amount); +long lg_io_0011_total(const char *biz_date); + +#endif /* LG_IO_0011_H */ diff --git a/app/include/lg_io_0012.h b/app/include/lg_io_0012.h new file mode 100644 index 0000000..0f28f76 --- /dev/null +++ b/app/include/lg_io_0012.h @@ -0,0 +1,14 @@ +/* + * lg_io_0012.h - 원장 보조 DBIO 선언 (lg_io_0012.pgc 구현) + */ +#ifndef LG_IO_0012_H +#define LG_IO_0012_H + +#include "txcore.h" + +/* lg_io_0012 전용 조회/갱신 (테이블 lg_io_0012_t) */ +int lg_io_0012_fetch(const char *key, long *out_amount); +int lg_io_0012_touch(const char *key, long amount); +long lg_io_0012_total(const char *biz_date); + +#endif /* LG_IO_0012_H */ diff --git a/app/include/lg_io_0013.h b/app/include/lg_io_0013.h new file mode 100644 index 0000000..8b53c43 --- /dev/null +++ b/app/include/lg_io_0013.h @@ -0,0 +1,14 @@ +/* + * lg_io_0013.h - 원장 보조 DBIO 선언 (lg_io_0013.pgc 구현) + */ +#ifndef LG_IO_0013_H +#define LG_IO_0013_H + +#include "txcore.h" + +/* lg_io_0013 전용 조회/갱신 (테이블 lg_io_0013_t) */ +int lg_io_0013_fetch(const char *key, long *out_amount); +int lg_io_0013_touch(const char *key, long amount); +long lg_io_0013_total(const char *biz_date); + +#endif /* LG_IO_0013_H */ diff --git a/app/include/lg_io_0014.h b/app/include/lg_io_0014.h new file mode 100644 index 0000000..596f748 --- /dev/null +++ b/app/include/lg_io_0014.h @@ -0,0 +1,14 @@ +/* + * lg_io_0014.h - 원장 보조 DBIO 선언 (lg_io_0014.pgc 구현) + */ +#ifndef LG_IO_0014_H +#define LG_IO_0014_H + +#include "txcore.h" + +/* lg_io_0014 전용 조회/갱신 (테이블 lg_io_0014_t) */ +int lg_io_0014_fetch(const char *key, long *out_amount); +int lg_io_0014_touch(const char *key, long amount); +long lg_io_0014_total(const char *biz_date); + +#endif /* LG_IO_0014_H */ diff --git a/app/include/lg_io_0015.h b/app/include/lg_io_0015.h new file mode 100644 index 0000000..04521e9 --- /dev/null +++ b/app/include/lg_io_0015.h @@ -0,0 +1,14 @@ +/* + * lg_io_0015.h - 원장 보조 DBIO 선언 (lg_io_0015.pgc 구현) + */ +#ifndef LG_IO_0015_H +#define LG_IO_0015_H + +#include "txcore.h" + +/* lg_io_0015 전용 조회/갱신 (테이블 lg_io_0015_t) */ +int lg_io_0015_fetch(const char *key, long *out_amount); +int lg_io_0015_touch(const char *key, long amount); +long lg_io_0015_total(const char *biz_date); + +#endif /* LG_IO_0015_H */ diff --git a/app/include/lg_io_0016.h b/app/include/lg_io_0016.h new file mode 100644 index 0000000..a75377d --- /dev/null +++ b/app/include/lg_io_0016.h @@ -0,0 +1,14 @@ +/* + * lg_io_0016.h - 원장 보조 DBIO 선언 (lg_io_0016.pgc 구현) + */ +#ifndef LG_IO_0016_H +#define LG_IO_0016_H + +#include "txcore.h" + +/* lg_io_0016 전용 조회/갱신 (테이블 lg_io_0016_t) */ +int lg_io_0016_fetch(const char *key, long *out_amount); +int lg_io_0016_touch(const char *key, long amount); +long lg_io_0016_total(const char *biz_date); + +#endif /* LG_IO_0016_H */ diff --git a/app/include/lg_io_0017.h b/app/include/lg_io_0017.h new file mode 100644 index 0000000..c9de225 --- /dev/null +++ b/app/include/lg_io_0017.h @@ -0,0 +1,14 @@ +/* + * lg_io_0017.h - 원장 보조 DBIO 선언 (lg_io_0017.pgc 구현) + */ +#ifndef LG_IO_0017_H +#define LG_IO_0017_H + +#include "txcore.h" + +/* lg_io_0017 전용 조회/갱신 (테이블 lg_io_0017_t) */ +int lg_io_0017_fetch(const char *key, long *out_amount); +int lg_io_0017_touch(const char *key, long amount); +long lg_io_0017_total(const char *biz_date); + +#endif /* LG_IO_0017_H */ diff --git a/app/include/lg_io_0018.h b/app/include/lg_io_0018.h new file mode 100644 index 0000000..bb9a5b1 --- /dev/null +++ b/app/include/lg_io_0018.h @@ -0,0 +1,14 @@ +/* + * lg_io_0018.h - 원장 보조 DBIO 선언 (lg_io_0018.pgc 구현) + */ +#ifndef LG_IO_0018_H +#define LG_IO_0018_H + +#include "txcore.h" + +/* lg_io_0018 전용 조회/갱신 (테이블 lg_io_0018_t) */ +int lg_io_0018_fetch(const char *key, long *out_amount); +int lg_io_0018_touch(const char *key, long amount); +long lg_io_0018_total(const char *biz_date); + +#endif /* LG_IO_0018_H */ diff --git a/app/include/lg_io_0019.h b/app/include/lg_io_0019.h new file mode 100644 index 0000000..3ab6258 --- /dev/null +++ b/app/include/lg_io_0019.h @@ -0,0 +1,14 @@ +/* + * lg_io_0019.h - 원장 보조 DBIO 선언 (lg_io_0019.pgc 구현) + */ +#ifndef LG_IO_0019_H +#define LG_IO_0019_H + +#include "txcore.h" + +/* lg_io_0019 전용 조회/갱신 (테이블 lg_io_0019_t) */ +int lg_io_0019_fetch(const char *key, long *out_amount); +int lg_io_0019_touch(const char *key, long amount); +long lg_io_0019_total(const char *biz_date); + +#endif /* LG_IO_0019_H */ diff --git a/app/include/lg_io_0020.h b/app/include/lg_io_0020.h new file mode 100644 index 0000000..b65f1c6 --- /dev/null +++ b/app/include/lg_io_0020.h @@ -0,0 +1,14 @@ +/* + * lg_io_0020.h - 원장 보조 DBIO 선언 (lg_io_0020.pgc 구현) + */ +#ifndef LG_IO_0020_H +#define LG_IO_0020_H + +#include "txcore.h" + +/* lg_io_0020 전용 조회/갱신 (테이블 lg_io_0020_t) */ +int lg_io_0020_fetch(const char *key, long *out_amount); +int lg_io_0020_touch(const char *key, long amount); +long lg_io_0020_total(const char *biz_date); + +#endif /* LG_IO_0020_H */ diff --git a/app/include/lg_io_0021.h b/app/include/lg_io_0021.h new file mode 100644 index 0000000..e0c3adc --- /dev/null +++ b/app/include/lg_io_0021.h @@ -0,0 +1,14 @@ +/* + * lg_io_0021.h - 원장 보조 DBIO 선언 (lg_io_0021.pgc 구현) + */ +#ifndef LG_IO_0021_H +#define LG_IO_0021_H + +#include "txcore.h" + +/* lg_io_0021 전용 조회/갱신 (테이블 lg_io_0021_t) */ +int lg_io_0021_fetch(const char *key, long *out_amount); +int lg_io_0021_touch(const char *key, long amount); +long lg_io_0021_total(const char *biz_date); + +#endif /* LG_IO_0021_H */ diff --git a/app/include/lg_io_0022.h b/app/include/lg_io_0022.h new file mode 100644 index 0000000..0791ade --- /dev/null +++ b/app/include/lg_io_0022.h @@ -0,0 +1,14 @@ +/* + * lg_io_0022.h - 원장 보조 DBIO 선언 (lg_io_0022.pgc 구현) + */ +#ifndef LG_IO_0022_H +#define LG_IO_0022_H + +#include "txcore.h" + +/* lg_io_0022 전용 조회/갱신 (테이블 lg_io_0022_t) */ +int lg_io_0022_fetch(const char *key, long *out_amount); +int lg_io_0022_touch(const char *key, long amount); +long lg_io_0022_total(const char *biz_date); + +#endif /* LG_IO_0022_H */ diff --git a/app/include/lg_io_0023.h b/app/include/lg_io_0023.h new file mode 100644 index 0000000..a7db514 --- /dev/null +++ b/app/include/lg_io_0023.h @@ -0,0 +1,14 @@ +/* + * lg_io_0023.h - 원장 보조 DBIO 선언 (lg_io_0023.pgc 구현) + */ +#ifndef LG_IO_0023_H +#define LG_IO_0023_H + +#include "txcore.h" + +/* lg_io_0023 전용 조회/갱신 (테이블 lg_io_0023_t) */ +int lg_io_0023_fetch(const char *key, long *out_amount); +int lg_io_0023_touch(const char *key, long amount); +long lg_io_0023_total(const char *biz_date); + +#endif /* LG_IO_0023_H */ diff --git a/app/include/lg_io_0024.h b/app/include/lg_io_0024.h new file mode 100644 index 0000000..2dabfce --- /dev/null +++ b/app/include/lg_io_0024.h @@ -0,0 +1,14 @@ +/* + * lg_io_0024.h - 원장 보조 DBIO 선언 (lg_io_0024.pgc 구현) + */ +#ifndef LG_IO_0024_H +#define LG_IO_0024_H + +#include "txcore.h" + +/* lg_io_0024 전용 조회/갱신 (테이블 lg_io_0024_t) */ +int lg_io_0024_fetch(const char *key, long *out_amount); +int lg_io_0024_touch(const char *key, long amount); +long lg_io_0024_total(const char *biz_date); + +#endif /* LG_IO_0024_H */ diff --git a/app/include/lg_io_0025.h b/app/include/lg_io_0025.h new file mode 100644 index 0000000..3bf6a58 --- /dev/null +++ b/app/include/lg_io_0025.h @@ -0,0 +1,14 @@ +/* + * lg_io_0025.h - 원장 보조 DBIO 선언 (lg_io_0025.pgc 구현) + */ +#ifndef LG_IO_0025_H +#define LG_IO_0025_H + +#include "txcore.h" + +/* lg_io_0025 전용 조회/갱신 (테이블 lg_io_0025_t) */ +int lg_io_0025_fetch(const char *key, long *out_amount); +int lg_io_0025_touch(const char *key, long amount); +long lg_io_0025_total(const char *biz_date); + +#endif /* LG_IO_0025_H */ diff --git a/app/include/lg_io_0026.h b/app/include/lg_io_0026.h new file mode 100644 index 0000000..d317551 --- /dev/null +++ b/app/include/lg_io_0026.h @@ -0,0 +1,14 @@ +/* + * lg_io_0026.h - 원장 보조 DBIO 선언 (lg_io_0026.pgc 구현) + */ +#ifndef LG_IO_0026_H +#define LG_IO_0026_H + +#include "txcore.h" + +/* lg_io_0026 전용 조회/갱신 (테이블 lg_io_0026_t) */ +int lg_io_0026_fetch(const char *key, long *out_amount); +int lg_io_0026_touch(const char *key, long amount); +long lg_io_0026_total(const char *biz_date); + +#endif /* LG_IO_0026_H */ diff --git a/app/include/mg_core.h b/app/include/mg_core.h new file mode 100644 index 0000000..e71b2bf --- /dev/null +++ b/app/include/mg_core.h @@ -0,0 +1,38 @@ +/* + * mg_core.h - 전문게이트웨이 모듈 핵심 계약 (레코드/상태/표준 DBIO API) + * + * 이 모듈의 온라인/배치 프로그램은 SQL 을 직접 다루지 않고 아래 표준 + * DBIO API 만 호출한다. 구현은 app/dbio/mg_dbio_main.pgc (ECPG). + */ +#ifndef MG_CORE_H +#define MG_CORE_H + +#include "txcore.h" + +/* 전문게이트웨이 처리 상태코드 */ +#define MG_ST_RECV "R" /* 접수/수신 */ +#define MG_ST_DONE "M" /* 처리완료 */ +#define MG_ST_FAIL "U" /* 불일치/실패 */ +#define MG_ST_SETTLED "S" /* 정산완료 */ + +/* 전문게이트웨이 원장 레코드 (1행) */ +typedef struct { + char key[16]; /* 처리키(승인/거래 번호) PK */ + char merch_id[16]; /* 가맹점번호 */ + char card_no[20]; /* 카드번호(마스킹) */ + long amount; /* 거래금액(원) */ + char biz_date[9]; /* 영업일 YYYYMMDD */ + char status[2]; /* 상태코드 */ + long fee; /* 수수료(원) */ +} mg_rec_t; + +/* 표준 DBIO API (구현: mg_dbio_main.pgc) */ +int mg_dbio_connect(const char *target); +int mg_dbio_disconnect(void); +int mg_rec_insert(const mg_rec_t *rec); +int mg_rec_select(const char *key, mg_rec_t *out); +int mg_rec_update_status(const char *key, const char *status); +long mg_rec_count(const char *biz_date, const char *status); +int mg_rec_sum(const char *biz_date, long *out_sum); + +#endif /* MG_CORE_H */ diff --git a/app/include/mg_cu_0001.h b/app/include/mg_cu_0001.h new file mode 100644 index 0000000..784fd41 --- /dev/null +++ b/app/include/mg_cu_0001.h @@ -0,0 +1,11 @@ +/* + * mg_cu_0001.h - 전문게이트웨이 공통 유틸 선언 (mg_cu_0001.c 구현) + */ +#ifndef MG_CU_0001_H +#define MG_CU_0001_H + +long mg_cu_0001_fee(long amount, int rate_bp); +long mg_cu_0001_round_unit(long amount, long unit); +int mg_cu_0001_classify(long amount); + +#endif /* MG_CU_0001_H */ diff --git a/app/include/mg_cu_0002.h b/app/include/mg_cu_0002.h new file mode 100644 index 0000000..77c8cb9 --- /dev/null +++ b/app/include/mg_cu_0002.h @@ -0,0 +1,11 @@ +/* + * mg_cu_0002.h - 전문게이트웨이 공통 유틸 선언 (mg_cu_0002.c 구현) + */ +#ifndef MG_CU_0002_H +#define MG_CU_0002_H + +long mg_cu_0002_fee(long amount, int rate_bp); +long mg_cu_0002_round_unit(long amount, long unit); +int mg_cu_0002_classify(long amount); + +#endif /* MG_CU_0002_H */ diff --git a/app/include/mg_cu_0003.h b/app/include/mg_cu_0003.h new file mode 100644 index 0000000..23aec63 --- /dev/null +++ b/app/include/mg_cu_0003.h @@ -0,0 +1,11 @@ +/* + * mg_cu_0003.h - 전문게이트웨이 공통 유틸 선언 (mg_cu_0003.c 구현) + */ +#ifndef MG_CU_0003_H +#define MG_CU_0003_H + +long mg_cu_0003_fee(long amount, int rate_bp); +long mg_cu_0003_round_unit(long amount, long unit); +int mg_cu_0003_classify(long amount); + +#endif /* MG_CU_0003_H */ diff --git a/app/include/mg_cu_0004.h b/app/include/mg_cu_0004.h new file mode 100644 index 0000000..065006d --- /dev/null +++ b/app/include/mg_cu_0004.h @@ -0,0 +1,11 @@ +/* + * mg_cu_0004.h - 전문게이트웨이 공통 유틸 선언 (mg_cu_0004.c 구현) + */ +#ifndef MG_CU_0004_H +#define MG_CU_0004_H + +long mg_cu_0004_fee(long amount, int rate_bp); +long mg_cu_0004_round_unit(long amount, long unit); +int mg_cu_0004_classify(long amount); + +#endif /* MG_CU_0004_H */ diff --git a/app/include/mg_cu_0005.h b/app/include/mg_cu_0005.h new file mode 100644 index 0000000..83d1348 --- /dev/null +++ b/app/include/mg_cu_0005.h @@ -0,0 +1,11 @@ +/* + * mg_cu_0005.h - 전문게이트웨이 공통 유틸 선언 (mg_cu_0005.c 구현) + */ +#ifndef MG_CU_0005_H +#define MG_CU_0005_H + +long mg_cu_0005_fee(long amount, int rate_bp); +long mg_cu_0005_round_unit(long amount, long unit); +int mg_cu_0005_classify(long amount); + +#endif /* MG_CU_0005_H */ diff --git a/app/include/mg_cu_0006.h b/app/include/mg_cu_0006.h new file mode 100644 index 0000000..d65244c --- /dev/null +++ b/app/include/mg_cu_0006.h @@ -0,0 +1,11 @@ +/* + * mg_cu_0006.h - 전문게이트웨이 공통 유틸 선언 (mg_cu_0006.c 구현) + */ +#ifndef MG_CU_0006_H +#define MG_CU_0006_H + +long mg_cu_0006_fee(long amount, int rate_bp); +long mg_cu_0006_round_unit(long amount, long unit); +int mg_cu_0006_classify(long amount); + +#endif /* MG_CU_0006_H */ diff --git a/app/include/mg_cu_0007.h b/app/include/mg_cu_0007.h new file mode 100644 index 0000000..e9e12b2 --- /dev/null +++ b/app/include/mg_cu_0007.h @@ -0,0 +1,11 @@ +/* + * mg_cu_0007.h - 전문게이트웨이 공통 유틸 선언 (mg_cu_0007.c 구현) + */ +#ifndef MG_CU_0007_H +#define MG_CU_0007_H + +long mg_cu_0007_fee(long amount, int rate_bp); +long mg_cu_0007_round_unit(long amount, long unit); +int mg_cu_0007_classify(long amount); + +#endif /* MG_CU_0007_H */ diff --git a/app/include/mg_cu_0008.h b/app/include/mg_cu_0008.h new file mode 100644 index 0000000..0f740fa --- /dev/null +++ b/app/include/mg_cu_0008.h @@ -0,0 +1,11 @@ +/* + * mg_cu_0008.h - 전문게이트웨이 공통 유틸 선언 (mg_cu_0008.c 구현) + */ +#ifndef MG_CU_0008_H +#define MG_CU_0008_H + +long mg_cu_0008_fee(long amount, int rate_bp); +long mg_cu_0008_round_unit(long amount, long unit); +int mg_cu_0008_classify(long amount); + +#endif /* MG_CU_0008_H */ diff --git a/app/include/mg_cu_0009.h b/app/include/mg_cu_0009.h new file mode 100644 index 0000000..a15bde1 --- /dev/null +++ b/app/include/mg_cu_0009.h @@ -0,0 +1,11 @@ +/* + * mg_cu_0009.h - 전문게이트웨이 공통 유틸 선언 (mg_cu_0009.c 구현) + */ +#ifndef MG_CU_0009_H +#define MG_CU_0009_H + +long mg_cu_0009_fee(long amount, int rate_bp); +long mg_cu_0009_round_unit(long amount, long unit); +int mg_cu_0009_classify(long amount); + +#endif /* MG_CU_0009_H */ diff --git a/app/include/mg_cu_0010.h b/app/include/mg_cu_0010.h new file mode 100644 index 0000000..fea6954 --- /dev/null +++ b/app/include/mg_cu_0010.h @@ -0,0 +1,11 @@ +/* + * mg_cu_0010.h - 전문게이트웨이 공통 유틸 선언 (mg_cu_0010.c 구현) + */ +#ifndef MG_CU_0010_H +#define MG_CU_0010_H + +long mg_cu_0010_fee(long amount, int rate_bp); +long mg_cu_0010_round_unit(long amount, long unit); +int mg_cu_0010_classify(long amount); + +#endif /* MG_CU_0010_H */ diff --git a/app/include/mg_cu_0011.h b/app/include/mg_cu_0011.h new file mode 100644 index 0000000..6e336c9 --- /dev/null +++ b/app/include/mg_cu_0011.h @@ -0,0 +1,11 @@ +/* + * mg_cu_0011.h - 전문게이트웨이 공통 유틸 선언 (mg_cu_0011.c 구현) + */ +#ifndef MG_CU_0011_H +#define MG_CU_0011_H + +long mg_cu_0011_fee(long amount, int rate_bp); +long mg_cu_0011_round_unit(long amount, long unit); +int mg_cu_0011_classify(long amount); + +#endif /* MG_CU_0011_H */ diff --git a/app/include/mg_h_0001.h b/app/include/mg_h_0001.h new file mode 100644 index 0000000..f16abe6 --- /dev/null +++ b/app/include/mg_h_0001.h @@ -0,0 +1,22 @@ +/* + * mg_h_0001.h - 전문게이트웨이 레코드/뷰 구조 정의 + */ +#ifndef MG_H_0001_H +#define MG_H_0001_H + +/* 전문게이트웨이 처리 뷰 레코드 */ +typedef struct { + char key[16]; + char merch_id[16]; + long amount; + long fee; + char biz_date[9]; + char status[2]; + char reserved[16]; +} mg_h_0001_view_t; + +#define MG_H_0001_STATUS_OPEN "O" +#define MG_H_0001_STATUS_HOLD "H" +#define MG_H_0001_STATUS_CLOSE "C" + +#endif /* MG_H_0001_H */ diff --git a/app/include/mg_h_0002.h b/app/include/mg_h_0002.h new file mode 100644 index 0000000..d3c3e64 --- /dev/null +++ b/app/include/mg_h_0002.h @@ -0,0 +1,13 @@ +/* + * mg_h_0002.h - 전문게이트웨이 내부 헬퍼 선언 + */ +#ifndef MG_H_0002_H +#define MG_H_0002_H + +#include "txcore.h" + +int mg_h_0002_check(const char *key, long amount); +int mg_h_0002_apply(TXBUF *in, TXBUF *out); +long mg_h_0002_eval(long amount, int factor); + +#endif /* MG_H_0002_H */ diff --git a/app/include/mg_h_0003.h b/app/include/mg_h_0003.h new file mode 100644 index 0000000..65db4d5 --- /dev/null +++ b/app/include/mg_h_0003.h @@ -0,0 +1,20 @@ +/* + * mg_h_0003.h - 전문게이트웨이 코드/상수 테이블 + */ +#ifndef MG_H_0003_H +#define MG_H_0003_H + +#define MG_H_0003_RC_OK 0 +#define MG_H_0003_RC_RETRY 1 +#define MG_H_0003_RC_SKIP 2 +#define MG_H_0003_RC_ERROR 9 + +#define MG_H_0003_LIMIT_DAILY 100000000L +#define MG_H_0003_LIMIT_SINGLE 50000000L +#define MG_H_0003_FEE_RATE_BP 250 /* 2.50% */ + +#define MG_H_0003_CHAN_ONLINE "01" +#define MG_H_0003_CHAN_BATCH "02" +#define MG_H_0003_CHAN_RECON "03" + +#endif /* MG_H_0003_H */ diff --git a/app/include/mg_h_0004.h b/app/include/mg_h_0004.h new file mode 100644 index 0000000..8b3cc80 --- /dev/null +++ b/app/include/mg_h_0004.h @@ -0,0 +1,19 @@ +/* + * mg_h_0004.h - 전문게이트웨이 고정길이 전문 레이아웃 (positional, 재배치 금지) + */ +#ifndef MG_H_0004_H +#define MG_H_0004_H + +typedef struct { + char msg_type[4]; /* 전문구분 4 */ + char merch_id[15]; /* 가맹점번호 15 */ + char key[9]; /* 처리키 9 */ + char amount[12]; /* 금액 12 zero-pad */ + char biz_date[8]; /* 영업일 8 */ + char resp_code[4]; /* 응답코드 4 */ + char filler[20]; /* 예비 20 */ +} mg_h_0004_msg_t; + +#define MG_H_0004_MSG_LEN ((int)sizeof(mg_h_0004_msg_t)) + +#endif /* MG_H_0004_H */ diff --git a/app/include/mg_h_0005.h b/app/include/mg_h_0005.h new file mode 100644 index 0000000..14c40ed --- /dev/null +++ b/app/include/mg_h_0005.h @@ -0,0 +1,22 @@ +/* + * mg_h_0005.h - 전문게이트웨이 레코드/뷰 구조 정의 + */ +#ifndef MG_H_0005_H +#define MG_H_0005_H + +/* 전문게이트웨이 처리 뷰 레코드 */ +typedef struct { + char key[16]; + char merch_id[16]; + long amount; + long fee; + char biz_date[9]; + char status[2]; + char reserved[16]; +} mg_h_0005_view_t; + +#define MG_H_0005_STATUS_OPEN "O" +#define MG_H_0005_STATUS_HOLD "H" +#define MG_H_0005_STATUS_CLOSE "C" + +#endif /* MG_H_0005_H */ diff --git a/app/include/mg_h_0006.h b/app/include/mg_h_0006.h new file mode 100644 index 0000000..51e624b --- /dev/null +++ b/app/include/mg_h_0006.h @@ -0,0 +1,13 @@ +/* + * mg_h_0006.h - 전문게이트웨이 내부 헬퍼 선언 + */ +#ifndef MG_H_0006_H +#define MG_H_0006_H + +#include "txcore.h" + +int mg_h_0006_check(const char *key, long amount); +int mg_h_0006_apply(TXBUF *in, TXBUF *out); +long mg_h_0006_eval(long amount, int factor); + +#endif /* MG_H_0006_H */ diff --git a/app/include/mg_h_0007.h b/app/include/mg_h_0007.h new file mode 100644 index 0000000..9cb1b8e --- /dev/null +++ b/app/include/mg_h_0007.h @@ -0,0 +1,20 @@ +/* + * mg_h_0007.h - 전문게이트웨이 코드/상수 테이블 + */ +#ifndef MG_H_0007_H +#define MG_H_0007_H + +#define MG_H_0007_RC_OK 0 +#define MG_H_0007_RC_RETRY 1 +#define MG_H_0007_RC_SKIP 2 +#define MG_H_0007_RC_ERROR 9 + +#define MG_H_0007_LIMIT_DAILY 100000000L +#define MG_H_0007_LIMIT_SINGLE 50000000L +#define MG_H_0007_FEE_RATE_BP 250 /* 2.50% */ + +#define MG_H_0007_CHAN_ONLINE "01" +#define MG_H_0007_CHAN_BATCH "02" +#define MG_H_0007_CHAN_RECON "03" + +#endif /* MG_H_0007_H */ diff --git a/app/include/mg_h_0008.h b/app/include/mg_h_0008.h new file mode 100644 index 0000000..f8d39d2 --- /dev/null +++ b/app/include/mg_h_0008.h @@ -0,0 +1,19 @@ +/* + * mg_h_0008.h - 전문게이트웨이 고정길이 전문 레이아웃 (positional, 재배치 금지) + */ +#ifndef MG_H_0008_H +#define MG_H_0008_H + +typedef struct { + char msg_type[4]; /* 전문구분 4 */ + char merch_id[15]; /* 가맹점번호 15 */ + char key[9]; /* 처리키 9 */ + char amount[12]; /* 금액 12 zero-pad */ + char biz_date[8]; /* 영업일 8 */ + char resp_code[4]; /* 응답코드 4 */ + char filler[20]; /* 예비 20 */ +} mg_h_0008_msg_t; + +#define MG_H_0008_MSG_LEN ((int)sizeof(mg_h_0008_msg_t)) + +#endif /* MG_H_0008_H */ diff --git a/app/include/mg_h_0009.h b/app/include/mg_h_0009.h new file mode 100644 index 0000000..971f74f --- /dev/null +++ b/app/include/mg_h_0009.h @@ -0,0 +1,22 @@ +/* + * mg_h_0009.h - 전문게이트웨이 레코드/뷰 구조 정의 + */ +#ifndef MG_H_0009_H +#define MG_H_0009_H + +/* 전문게이트웨이 처리 뷰 레코드 */ +typedef struct { + char key[16]; + char merch_id[16]; + long amount; + long fee; + char biz_date[9]; + char status[2]; + char reserved[16]; +} mg_h_0009_view_t; + +#define MG_H_0009_STATUS_OPEN "O" +#define MG_H_0009_STATUS_HOLD "H" +#define MG_H_0009_STATUS_CLOSE "C" + +#endif /* MG_H_0009_H */ diff --git a/app/include/mg_h_0010.h b/app/include/mg_h_0010.h new file mode 100644 index 0000000..a1b57bd --- /dev/null +++ b/app/include/mg_h_0010.h @@ -0,0 +1,13 @@ +/* + * mg_h_0010.h - 전문게이트웨이 내부 헬퍼 선언 + */ +#ifndef MG_H_0010_H +#define MG_H_0010_H + +#include "txcore.h" + +int mg_h_0010_check(const char *key, long amount); +int mg_h_0010_apply(TXBUF *in, TXBUF *out); +long mg_h_0010_eval(long amount, int factor); + +#endif /* MG_H_0010_H */ diff --git a/app/include/mg_h_0011.h b/app/include/mg_h_0011.h new file mode 100644 index 0000000..1d17c27 --- /dev/null +++ b/app/include/mg_h_0011.h @@ -0,0 +1,20 @@ +/* + * mg_h_0011.h - 전문게이트웨이 코드/상수 테이블 + */ +#ifndef MG_H_0011_H +#define MG_H_0011_H + +#define MG_H_0011_RC_OK 0 +#define MG_H_0011_RC_RETRY 1 +#define MG_H_0011_RC_SKIP 2 +#define MG_H_0011_RC_ERROR 9 + +#define MG_H_0011_LIMIT_DAILY 100000000L +#define MG_H_0011_LIMIT_SINGLE 50000000L +#define MG_H_0011_FEE_RATE_BP 250 /* 2.50% */ + +#define MG_H_0011_CHAN_ONLINE "01" +#define MG_H_0011_CHAN_BATCH "02" +#define MG_H_0011_CHAN_RECON "03" + +#endif /* MG_H_0011_H */ diff --git a/app/include/mg_h_0012.h b/app/include/mg_h_0012.h new file mode 100644 index 0000000..cb6a437 --- /dev/null +++ b/app/include/mg_h_0012.h @@ -0,0 +1,19 @@ +/* + * mg_h_0012.h - 전문게이트웨이 고정길이 전문 레이아웃 (positional, 재배치 금지) + */ +#ifndef MG_H_0012_H +#define MG_H_0012_H + +typedef struct { + char msg_type[4]; /* 전문구분 4 */ + char merch_id[15]; /* 가맹점번호 15 */ + char key[9]; /* 처리키 9 */ + char amount[12]; /* 금액 12 zero-pad */ + char biz_date[8]; /* 영업일 8 */ + char resp_code[4]; /* 응답코드 4 */ + char filler[20]; /* 예비 20 */ +} mg_h_0012_msg_t; + +#define MG_H_0012_MSG_LEN ((int)sizeof(mg_h_0012_msg_t)) + +#endif /* MG_H_0012_H */ diff --git a/app/include/mg_h_0013.h b/app/include/mg_h_0013.h new file mode 100644 index 0000000..4a3a9a1 --- /dev/null +++ b/app/include/mg_h_0013.h @@ -0,0 +1,22 @@ +/* + * mg_h_0013.h - 전문게이트웨이 레코드/뷰 구조 정의 + */ +#ifndef MG_H_0013_H +#define MG_H_0013_H + +/* 전문게이트웨이 처리 뷰 레코드 */ +typedef struct { + char key[16]; + char merch_id[16]; + long amount; + long fee; + char biz_date[9]; + char status[2]; + char reserved[16]; +} mg_h_0013_view_t; + +#define MG_H_0013_STATUS_OPEN "O" +#define MG_H_0013_STATUS_HOLD "H" +#define MG_H_0013_STATUS_CLOSE "C" + +#endif /* MG_H_0013_H */ diff --git a/app/include/mg_h_0014.h b/app/include/mg_h_0014.h new file mode 100644 index 0000000..43b4956 --- /dev/null +++ b/app/include/mg_h_0014.h @@ -0,0 +1,13 @@ +/* + * mg_h_0014.h - 전문게이트웨이 내부 헬퍼 선언 + */ +#ifndef MG_H_0014_H +#define MG_H_0014_H + +#include "txcore.h" + +int mg_h_0014_check(const char *key, long amount); +int mg_h_0014_apply(TXBUF *in, TXBUF *out); +long mg_h_0014_eval(long amount, int factor); + +#endif /* MG_H_0014_H */ diff --git a/app/include/mg_h_0015.h b/app/include/mg_h_0015.h new file mode 100644 index 0000000..ca5cdae --- /dev/null +++ b/app/include/mg_h_0015.h @@ -0,0 +1,20 @@ +/* + * mg_h_0015.h - 전문게이트웨이 코드/상수 테이블 + */ +#ifndef MG_H_0015_H +#define MG_H_0015_H + +#define MG_H_0015_RC_OK 0 +#define MG_H_0015_RC_RETRY 1 +#define MG_H_0015_RC_SKIP 2 +#define MG_H_0015_RC_ERROR 9 + +#define MG_H_0015_LIMIT_DAILY 100000000L +#define MG_H_0015_LIMIT_SINGLE 50000000L +#define MG_H_0015_FEE_RATE_BP 250 /* 2.50% */ + +#define MG_H_0015_CHAN_ONLINE "01" +#define MG_H_0015_CHAN_BATCH "02" +#define MG_H_0015_CHAN_RECON "03" + +#endif /* MG_H_0015_H */ diff --git a/app/include/mg_h_0016.h b/app/include/mg_h_0016.h new file mode 100644 index 0000000..7c1d8cf --- /dev/null +++ b/app/include/mg_h_0016.h @@ -0,0 +1,19 @@ +/* + * mg_h_0016.h - 전문게이트웨이 고정길이 전문 레이아웃 (positional, 재배치 금지) + */ +#ifndef MG_H_0016_H +#define MG_H_0016_H + +typedef struct { + char msg_type[4]; /* 전문구분 4 */ + char merch_id[15]; /* 가맹점번호 15 */ + char key[9]; /* 처리키 9 */ + char amount[12]; /* 금액 12 zero-pad */ + char biz_date[8]; /* 영업일 8 */ + char resp_code[4]; /* 응답코드 4 */ + char filler[20]; /* 예비 20 */ +} mg_h_0016_msg_t; + +#define MG_H_0016_MSG_LEN ((int)sizeof(mg_h_0016_msg_t)) + +#endif /* MG_H_0016_H */ diff --git a/app/include/mg_h_0017.h b/app/include/mg_h_0017.h new file mode 100644 index 0000000..318ac6d --- /dev/null +++ b/app/include/mg_h_0017.h @@ -0,0 +1,22 @@ +/* + * mg_h_0017.h - 전문게이트웨이 레코드/뷰 구조 정의 + */ +#ifndef MG_H_0017_H +#define MG_H_0017_H + +/* 전문게이트웨이 처리 뷰 레코드 */ +typedef struct { + char key[16]; + char merch_id[16]; + long amount; + long fee; + char biz_date[9]; + char status[2]; + char reserved[16]; +} mg_h_0017_view_t; + +#define MG_H_0017_STATUS_OPEN "O" +#define MG_H_0017_STATUS_HOLD "H" +#define MG_H_0017_STATUS_CLOSE "C" + +#endif /* MG_H_0017_H */ diff --git a/app/include/mg_io_0001.h b/app/include/mg_io_0001.h new file mode 100644 index 0000000..6e2237d --- /dev/null +++ b/app/include/mg_io_0001.h @@ -0,0 +1,14 @@ +/* + * mg_io_0001.h - 전문게이트웨이 보조 DBIO 선언 (mg_io_0001.pgc 구현) + */ +#ifndef MG_IO_0001_H +#define MG_IO_0001_H + +#include "txcore.h" + +/* mg_io_0001 전용 조회/갱신 (테이블 mg_io_0001_t) */ +int mg_io_0001_fetch(const char *key, long *out_amount); +int mg_io_0001_touch(const char *key, long amount); +long mg_io_0001_total(const char *biz_date); + +#endif /* MG_IO_0001_H */ diff --git a/app/include/mg_io_0002.h b/app/include/mg_io_0002.h new file mode 100644 index 0000000..3dced41 --- /dev/null +++ b/app/include/mg_io_0002.h @@ -0,0 +1,14 @@ +/* + * mg_io_0002.h - 전문게이트웨이 보조 DBIO 선언 (mg_io_0002.pgc 구현) + */ +#ifndef MG_IO_0002_H +#define MG_IO_0002_H + +#include "txcore.h" + +/* mg_io_0002 전용 조회/갱신 (테이블 mg_io_0002_t) */ +int mg_io_0002_fetch(const char *key, long *out_amount); +int mg_io_0002_touch(const char *key, long amount); +long mg_io_0002_total(const char *biz_date); + +#endif /* MG_IO_0002_H */ diff --git a/app/include/mg_io_0003.h b/app/include/mg_io_0003.h new file mode 100644 index 0000000..de4f4ee --- /dev/null +++ b/app/include/mg_io_0003.h @@ -0,0 +1,14 @@ +/* + * mg_io_0003.h - 전문게이트웨이 보조 DBIO 선언 (mg_io_0003.pgc 구현) + */ +#ifndef MG_IO_0003_H +#define MG_IO_0003_H + +#include "txcore.h" + +/* mg_io_0003 전용 조회/갱신 (테이블 mg_io_0003_t) */ +int mg_io_0003_fetch(const char *key, long *out_amount); +int mg_io_0003_touch(const char *key, long amount); +long mg_io_0003_total(const char *biz_date); + +#endif /* MG_IO_0003_H */ diff --git a/app/include/mg_io_0004.h b/app/include/mg_io_0004.h new file mode 100644 index 0000000..dacb4b8 --- /dev/null +++ b/app/include/mg_io_0004.h @@ -0,0 +1,14 @@ +/* + * mg_io_0004.h - 전문게이트웨이 보조 DBIO 선언 (mg_io_0004.pgc 구현) + */ +#ifndef MG_IO_0004_H +#define MG_IO_0004_H + +#include "txcore.h" + +/* mg_io_0004 전용 조회/갱신 (테이블 mg_io_0004_t) */ +int mg_io_0004_fetch(const char *key, long *out_amount); +int mg_io_0004_touch(const char *key, long amount); +long mg_io_0004_total(const char *biz_date); + +#endif /* MG_IO_0004_H */ diff --git a/app/include/mg_io_0005.h b/app/include/mg_io_0005.h new file mode 100644 index 0000000..ea21b2e --- /dev/null +++ b/app/include/mg_io_0005.h @@ -0,0 +1,14 @@ +/* + * mg_io_0005.h - 전문게이트웨이 보조 DBIO 선언 (mg_io_0005.pgc 구현) + */ +#ifndef MG_IO_0005_H +#define MG_IO_0005_H + +#include "txcore.h" + +/* mg_io_0005 전용 조회/갱신 (테이블 mg_io_0005_t) */ +int mg_io_0005_fetch(const char *key, long *out_amount); +int mg_io_0005_touch(const char *key, long amount); +long mg_io_0005_total(const char *biz_date); + +#endif /* MG_IO_0005_H */ diff --git a/app/include/mg_io_0006.h b/app/include/mg_io_0006.h new file mode 100644 index 0000000..87358ae --- /dev/null +++ b/app/include/mg_io_0006.h @@ -0,0 +1,14 @@ +/* + * mg_io_0006.h - 전문게이트웨이 보조 DBIO 선언 (mg_io_0006.pgc 구현) + */ +#ifndef MG_IO_0006_H +#define MG_IO_0006_H + +#include "txcore.h" + +/* mg_io_0006 전용 조회/갱신 (테이블 mg_io_0006_t) */ +int mg_io_0006_fetch(const char *key, long *out_amount); +int mg_io_0006_touch(const char *key, long amount); +long mg_io_0006_total(const char *biz_date); + +#endif /* MG_IO_0006_H */ diff --git a/app/include/mg_io_0007.h b/app/include/mg_io_0007.h new file mode 100644 index 0000000..3639f2a --- /dev/null +++ b/app/include/mg_io_0007.h @@ -0,0 +1,14 @@ +/* + * mg_io_0007.h - 전문게이트웨이 보조 DBIO 선언 (mg_io_0007.pgc 구현) + */ +#ifndef MG_IO_0007_H +#define MG_IO_0007_H + +#include "txcore.h" + +/* mg_io_0007 전용 조회/갱신 (테이블 mg_io_0007_t) */ +int mg_io_0007_fetch(const char *key, long *out_amount); +int mg_io_0007_touch(const char *key, long amount); +long mg_io_0007_total(const char *biz_date); + +#endif /* MG_IO_0007_H */ diff --git a/app/include/mg_io_0008.h b/app/include/mg_io_0008.h new file mode 100644 index 0000000..a62d1f4 --- /dev/null +++ b/app/include/mg_io_0008.h @@ -0,0 +1,14 @@ +/* + * mg_io_0008.h - 전문게이트웨이 보조 DBIO 선언 (mg_io_0008.pgc 구현) + */ +#ifndef MG_IO_0008_H +#define MG_IO_0008_H + +#include "txcore.h" + +/* mg_io_0008 전용 조회/갱신 (테이블 mg_io_0008_t) */ +int mg_io_0008_fetch(const char *key, long *out_amount); +int mg_io_0008_touch(const char *key, long amount); +long mg_io_0008_total(const char *biz_date); + +#endif /* MG_IO_0008_H */ diff --git a/app/include/mg_io_0009.h b/app/include/mg_io_0009.h new file mode 100644 index 0000000..3071828 --- /dev/null +++ b/app/include/mg_io_0009.h @@ -0,0 +1,14 @@ +/* + * mg_io_0009.h - 전문게이트웨이 보조 DBIO 선언 (mg_io_0009.pgc 구현) + */ +#ifndef MG_IO_0009_H +#define MG_IO_0009_H + +#include "txcore.h" + +/* mg_io_0009 전용 조회/갱신 (테이블 mg_io_0009_t) */ +int mg_io_0009_fetch(const char *key, long *out_amount); +int mg_io_0009_touch(const char *key, long amount); +long mg_io_0009_total(const char *biz_date); + +#endif /* MG_IO_0009_H */ diff --git a/app/include/mg_io_0010.h b/app/include/mg_io_0010.h new file mode 100644 index 0000000..4ab6ad2 --- /dev/null +++ b/app/include/mg_io_0010.h @@ -0,0 +1,14 @@ +/* + * mg_io_0010.h - 전문게이트웨이 보조 DBIO 선언 (mg_io_0010.pgc 구현) + */ +#ifndef MG_IO_0010_H +#define MG_IO_0010_H + +#include "txcore.h" + +/* mg_io_0010 전용 조회/갱신 (테이블 mg_io_0010_t) */ +int mg_io_0010_fetch(const char *key, long *out_amount); +int mg_io_0010_touch(const char *key, long amount); +long mg_io_0010_total(const char *biz_date); + +#endif /* MG_IO_0010_H */ diff --git a/app/include/mg_io_0011.h b/app/include/mg_io_0011.h new file mode 100644 index 0000000..aa5e5ae --- /dev/null +++ b/app/include/mg_io_0011.h @@ -0,0 +1,14 @@ +/* + * mg_io_0011.h - 전문게이트웨이 보조 DBIO 선언 (mg_io_0011.pgc 구현) + */ +#ifndef MG_IO_0011_H +#define MG_IO_0011_H + +#include "txcore.h" + +/* mg_io_0011 전용 조회/갱신 (테이블 mg_io_0011_t) */ +int mg_io_0011_fetch(const char *key, long *out_amount); +int mg_io_0011_touch(const char *key, long amount); +long mg_io_0011_total(const char *biz_date); + +#endif /* MG_IO_0011_H */ diff --git a/app/include/mg_io_0012.h b/app/include/mg_io_0012.h new file mode 100644 index 0000000..37ba586 --- /dev/null +++ b/app/include/mg_io_0012.h @@ -0,0 +1,14 @@ +/* + * mg_io_0012.h - 전문게이트웨이 보조 DBIO 선언 (mg_io_0012.pgc 구현) + */ +#ifndef MG_IO_0012_H +#define MG_IO_0012_H + +#include "txcore.h" + +/* mg_io_0012 전용 조회/갱신 (테이블 mg_io_0012_t) */ +int mg_io_0012_fetch(const char *key, long *out_amount); +int mg_io_0012_touch(const char *key, long amount); +long mg_io_0012_total(const char *biz_date); + +#endif /* MG_IO_0012_H */ diff --git a/app/include/mg_io_0013.h b/app/include/mg_io_0013.h new file mode 100644 index 0000000..b52880e --- /dev/null +++ b/app/include/mg_io_0013.h @@ -0,0 +1,14 @@ +/* + * mg_io_0013.h - 전문게이트웨이 보조 DBIO 선언 (mg_io_0013.pgc 구현) + */ +#ifndef MG_IO_0013_H +#define MG_IO_0013_H + +#include "txcore.h" + +/* mg_io_0013 전용 조회/갱신 (테이블 mg_io_0013_t) */ +int mg_io_0013_fetch(const char *key, long *out_amount); +int mg_io_0013_touch(const char *key, long amount); +long mg_io_0013_total(const char *biz_date); + +#endif /* MG_IO_0013_H */ diff --git a/app/include/mg_io_0014.h b/app/include/mg_io_0014.h new file mode 100644 index 0000000..6c60d17 --- /dev/null +++ b/app/include/mg_io_0014.h @@ -0,0 +1,14 @@ +/* + * mg_io_0014.h - 전문게이트웨이 보조 DBIO 선언 (mg_io_0014.pgc 구현) + */ +#ifndef MG_IO_0014_H +#define MG_IO_0014_H + +#include "txcore.h" + +/* mg_io_0014 전용 조회/갱신 (테이블 mg_io_0014_t) */ +int mg_io_0014_fetch(const char *key, long *out_amount); +int mg_io_0014_touch(const char *key, long amount); +long mg_io_0014_total(const char *biz_date); + +#endif /* MG_IO_0014_H */ diff --git a/app/include/mg_io_0015.h b/app/include/mg_io_0015.h new file mode 100644 index 0000000..cc2d7bb --- /dev/null +++ b/app/include/mg_io_0015.h @@ -0,0 +1,14 @@ +/* + * mg_io_0015.h - 전문게이트웨이 보조 DBIO 선언 (mg_io_0015.pgc 구현) + */ +#ifndef MG_IO_0015_H +#define MG_IO_0015_H + +#include "txcore.h" + +/* mg_io_0015 전용 조회/갱신 (테이블 mg_io_0015_t) */ +int mg_io_0015_fetch(const char *key, long *out_amount); +int mg_io_0015_touch(const char *key, long amount); +long mg_io_0015_total(const char *biz_date); + +#endif /* MG_IO_0015_H */ diff --git a/app/include/mg_io_0016.h b/app/include/mg_io_0016.h new file mode 100644 index 0000000..933b292 --- /dev/null +++ b/app/include/mg_io_0016.h @@ -0,0 +1,14 @@ +/* + * mg_io_0016.h - 전문게이트웨이 보조 DBIO 선언 (mg_io_0016.pgc 구현) + */ +#ifndef MG_IO_0016_H +#define MG_IO_0016_H + +#include "txcore.h" + +/* mg_io_0016 전용 조회/갱신 (테이블 mg_io_0016_t) */ +int mg_io_0016_fetch(const char *key, long *out_amount); +int mg_io_0016_touch(const char *key, long amount); +long mg_io_0016_total(const char *biz_date); + +#endif /* MG_IO_0016_H */ diff --git a/app/include/mg_io_0017.h b/app/include/mg_io_0017.h new file mode 100644 index 0000000..6278054 --- /dev/null +++ b/app/include/mg_io_0017.h @@ -0,0 +1,14 @@ +/* + * mg_io_0017.h - 전문게이트웨이 보조 DBIO 선언 (mg_io_0017.pgc 구현) + */ +#ifndef MG_IO_0017_H +#define MG_IO_0017_H + +#include "txcore.h" + +/* mg_io_0017 전용 조회/갱신 (테이블 mg_io_0017_t) */ +int mg_io_0017_fetch(const char *key, long *out_amount); +int mg_io_0017_touch(const char *key, long amount); +long mg_io_0017_total(const char *biz_date); + +#endif /* MG_IO_0017_H */ diff --git a/app/include/mg_io_0018.h b/app/include/mg_io_0018.h new file mode 100644 index 0000000..4f45950 --- /dev/null +++ b/app/include/mg_io_0018.h @@ -0,0 +1,14 @@ +/* + * mg_io_0018.h - 전문게이트웨이 보조 DBIO 선언 (mg_io_0018.pgc 구현) + */ +#ifndef MG_IO_0018_H +#define MG_IO_0018_H + +#include "txcore.h" + +/* mg_io_0018 전용 조회/갱신 (테이블 mg_io_0018_t) */ +int mg_io_0018_fetch(const char *key, long *out_amount); +int mg_io_0018_touch(const char *key, long amount); +long mg_io_0018_total(const char *biz_date); + +#endif /* MG_IO_0018_H */ diff --git a/app/include/mg_io_0019.h b/app/include/mg_io_0019.h new file mode 100644 index 0000000..d6f15f5 --- /dev/null +++ b/app/include/mg_io_0019.h @@ -0,0 +1,14 @@ +/* + * mg_io_0019.h - 전문게이트웨이 보조 DBIO 선언 (mg_io_0019.pgc 구현) + */ +#ifndef MG_IO_0019_H +#define MG_IO_0019_H + +#include "txcore.h" + +/* mg_io_0019 전용 조회/갱신 (테이블 mg_io_0019_t) */ +int mg_io_0019_fetch(const char *key, long *out_amount); +int mg_io_0019_touch(const char *key, long amount); +long mg_io_0019_total(const char *biz_date); + +#endif /* MG_IO_0019_H */ diff --git a/app/include/mg_io_0020.h b/app/include/mg_io_0020.h new file mode 100644 index 0000000..c3e6ea9 --- /dev/null +++ b/app/include/mg_io_0020.h @@ -0,0 +1,14 @@ +/* + * mg_io_0020.h - 전문게이트웨이 보조 DBIO 선언 (mg_io_0020.pgc 구현) + */ +#ifndef MG_IO_0020_H +#define MG_IO_0020_H + +#include "txcore.h" + +/* mg_io_0020 전용 조회/갱신 (테이블 mg_io_0020_t) */ +int mg_io_0020_fetch(const char *key, long *out_amount); +int mg_io_0020_touch(const char *key, long amount); +long mg_io_0020_total(const char *biz_date); + +#endif /* MG_IO_0020_H */ diff --git a/app/include/mg_io_0021.h b/app/include/mg_io_0021.h new file mode 100644 index 0000000..2b34d90 --- /dev/null +++ b/app/include/mg_io_0021.h @@ -0,0 +1,14 @@ +/* + * mg_io_0021.h - 전문게이트웨이 보조 DBIO 선언 (mg_io_0021.pgc 구현) + */ +#ifndef MG_IO_0021_H +#define MG_IO_0021_H + +#include "txcore.h" + +/* mg_io_0021 전용 조회/갱신 (테이블 mg_io_0021_t) */ +int mg_io_0021_fetch(const char *key, long *out_amount); +int mg_io_0021_touch(const char *key, long amount); +long mg_io_0021_total(const char *biz_date); + +#endif /* MG_IO_0021_H */ diff --git a/app/include/mg_io_0022.h b/app/include/mg_io_0022.h new file mode 100644 index 0000000..a50c5b0 --- /dev/null +++ b/app/include/mg_io_0022.h @@ -0,0 +1,14 @@ +/* + * mg_io_0022.h - 전문게이트웨이 보조 DBIO 선언 (mg_io_0022.pgc 구현) + */ +#ifndef MG_IO_0022_H +#define MG_IO_0022_H + +#include "txcore.h" + +/* mg_io_0022 전용 조회/갱신 (테이블 mg_io_0022_t) */ +int mg_io_0022_fetch(const char *key, long *out_amount); +int mg_io_0022_touch(const char *key, long amount); +long mg_io_0022_total(const char *biz_date); + +#endif /* MG_IO_0022_H */ diff --git a/app/include/mg_io_0023.h b/app/include/mg_io_0023.h new file mode 100644 index 0000000..9e1bc60 --- /dev/null +++ b/app/include/mg_io_0023.h @@ -0,0 +1,14 @@ +/* + * mg_io_0023.h - 전문게이트웨이 보조 DBIO 선언 (mg_io_0023.pgc 구현) + */ +#ifndef MG_IO_0023_H +#define MG_IO_0023_H + +#include "txcore.h" + +/* mg_io_0023 전용 조회/갱신 (테이블 mg_io_0023_t) */ +int mg_io_0023_fetch(const char *key, long *out_amount); +int mg_io_0023_touch(const char *key, long amount); +long mg_io_0023_total(const char *biz_date); + +#endif /* MG_IO_0023_H */ diff --git a/app/include/mg_io_0024.h b/app/include/mg_io_0024.h new file mode 100644 index 0000000..0a0d44e --- /dev/null +++ b/app/include/mg_io_0024.h @@ -0,0 +1,14 @@ +/* + * mg_io_0024.h - 전문게이트웨이 보조 DBIO 선언 (mg_io_0024.pgc 구현) + */ +#ifndef MG_IO_0024_H +#define MG_IO_0024_H + +#include "txcore.h" + +/* mg_io_0024 전용 조회/갱신 (테이블 mg_io_0024_t) */ +int mg_io_0024_fetch(const char *key, long *out_amount); +int mg_io_0024_touch(const char *key, long amount); +long mg_io_0024_total(const char *biz_date); + +#endif /* MG_IO_0024_H */ diff --git a/app/include/mg_io_0025.h b/app/include/mg_io_0025.h new file mode 100644 index 0000000..0bc5548 --- /dev/null +++ b/app/include/mg_io_0025.h @@ -0,0 +1,14 @@ +/* + * mg_io_0025.h - 전문게이트웨이 보조 DBIO 선언 (mg_io_0025.pgc 구현) + */ +#ifndef MG_IO_0025_H +#define MG_IO_0025_H + +#include "txcore.h" + +/* mg_io_0025 전용 조회/갱신 (테이블 mg_io_0025_t) */ +int mg_io_0025_fetch(const char *key, long *out_amount); +int mg_io_0025_touch(const char *key, long amount); +long mg_io_0025_total(const char *biz_date); + +#endif /* MG_IO_0025_H */ diff --git a/app/include/mg_io_0026.h b/app/include/mg_io_0026.h new file mode 100644 index 0000000..6515691 --- /dev/null +++ b/app/include/mg_io_0026.h @@ -0,0 +1,14 @@ +/* + * mg_io_0026.h - 전문게이트웨이 보조 DBIO 선언 (mg_io_0026.pgc 구현) + */ +#ifndef MG_IO_0026_H +#define MG_IO_0026_H + +#include "txcore.h" + +/* mg_io_0026 전용 조회/갱신 (테이블 mg_io_0026_t) */ +int mg_io_0026_fetch(const char *key, long *out_amount); +int mg_io_0026_touch(const char *key, long amount); +long mg_io_0026_total(const char *biz_date); + +#endif /* MG_IO_0026_H */ diff --git a/app/include/mg_io_0027.h b/app/include/mg_io_0027.h new file mode 100644 index 0000000..91a4c8b --- /dev/null +++ b/app/include/mg_io_0027.h @@ -0,0 +1,14 @@ +/* + * mg_io_0027.h - 전문게이트웨이 보조 DBIO 선언 (mg_io_0027.pgc 구현) + */ +#ifndef MG_IO_0027_H +#define MG_IO_0027_H + +#include "txcore.h" + +/* mg_io_0027 전용 조회/갱신 (테이블 mg_io_0027_t) */ +int mg_io_0027_fetch(const char *key, long *out_amount); +int mg_io_0027_touch(const char *key, long amount); +long mg_io_0027_total(const char *biz_date); + +#endif /* MG_IO_0027_H */ diff --git a/app/include/mm_core.h b/app/include/mm_core.h new file mode 100644 index 0000000..bbabe86 --- /dev/null +++ b/app/include/mm_core.h @@ -0,0 +1,38 @@ +/* + * mm_core.h - 마스터 모듈 핵심 계약 (레코드/상태/표준 DBIO API) + * + * 이 모듈의 온라인/배치 프로그램은 SQL 을 직접 다루지 않고 아래 표준 + * DBIO API 만 호출한다. 구현은 app/dbio/mm_dbio_main.pgc (ECPG). + */ +#ifndef MM_CORE_H +#define MM_CORE_H + +#include "txcore.h" + +/* 마스터 처리 상태코드 */ +#define MM_ST_RECV "R" /* 접수/수신 */ +#define MM_ST_DONE "M" /* 처리완료 */ +#define MM_ST_FAIL "U" /* 불일치/실패 */ +#define MM_ST_SETTLED "S" /* 정산완료 */ + +/* 마스터 원장 레코드 (1행) */ +typedef struct { + char key[16]; /* 처리키(승인/거래 번호) PK */ + char merch_id[16]; /* 가맹점번호 */ + char card_no[20]; /* 카드번호(마스킹) */ + long amount; /* 거래금액(원) */ + char biz_date[9]; /* 영업일 YYYYMMDD */ + char status[2]; /* 상태코드 */ + long fee; /* 수수료(원) */ +} mm_rec_t; + +/* 표준 DBIO API (구현: mm_dbio_main.pgc) */ +int mm_dbio_connect(const char *target); +int mm_dbio_disconnect(void); +int mm_rec_insert(const mm_rec_t *rec); +int mm_rec_select(const char *key, mm_rec_t *out); +int mm_rec_update_status(const char *key, const char *status); +long mm_rec_count(const char *biz_date, const char *status); +int mm_rec_sum(const char *biz_date, long *out_sum); + +#endif /* MM_CORE_H */ diff --git a/app/include/mm_cu_0001.h b/app/include/mm_cu_0001.h new file mode 100644 index 0000000..923bafd --- /dev/null +++ b/app/include/mm_cu_0001.h @@ -0,0 +1,11 @@ +/* + * mm_cu_0001.h - 마스터 공통 유틸 선언 (mm_cu_0001.c 구현) + */ +#ifndef MM_CU_0001_H +#define MM_CU_0001_H + +long mm_cu_0001_fee(long amount, int rate_bp); +long mm_cu_0001_round_unit(long amount, long unit); +int mm_cu_0001_classify(long amount); + +#endif /* MM_CU_0001_H */ diff --git a/app/include/mm_cu_0002.h b/app/include/mm_cu_0002.h new file mode 100644 index 0000000..c2660d6 --- /dev/null +++ b/app/include/mm_cu_0002.h @@ -0,0 +1,11 @@ +/* + * mm_cu_0002.h - 마스터 공통 유틸 선언 (mm_cu_0002.c 구현) + */ +#ifndef MM_CU_0002_H +#define MM_CU_0002_H + +long mm_cu_0002_fee(long amount, int rate_bp); +long mm_cu_0002_round_unit(long amount, long unit); +int mm_cu_0002_classify(long amount); + +#endif /* MM_CU_0002_H */ diff --git a/app/include/mm_cu_0003.h b/app/include/mm_cu_0003.h new file mode 100644 index 0000000..32d5d8d --- /dev/null +++ b/app/include/mm_cu_0003.h @@ -0,0 +1,11 @@ +/* + * mm_cu_0003.h - 마스터 공통 유틸 선언 (mm_cu_0003.c 구현) + */ +#ifndef MM_CU_0003_H +#define MM_CU_0003_H + +long mm_cu_0003_fee(long amount, int rate_bp); +long mm_cu_0003_round_unit(long amount, long unit); +int mm_cu_0003_classify(long amount); + +#endif /* MM_CU_0003_H */ diff --git a/app/include/mm_cu_0004.h b/app/include/mm_cu_0004.h new file mode 100644 index 0000000..598f1ab --- /dev/null +++ b/app/include/mm_cu_0004.h @@ -0,0 +1,11 @@ +/* + * mm_cu_0004.h - 마스터 공통 유틸 선언 (mm_cu_0004.c 구현) + */ +#ifndef MM_CU_0004_H +#define MM_CU_0004_H + +long mm_cu_0004_fee(long amount, int rate_bp); +long mm_cu_0004_round_unit(long amount, long unit); +int mm_cu_0004_classify(long amount); + +#endif /* MM_CU_0004_H */ diff --git a/app/include/mm_cu_0005.h b/app/include/mm_cu_0005.h new file mode 100644 index 0000000..3d4097d --- /dev/null +++ b/app/include/mm_cu_0005.h @@ -0,0 +1,11 @@ +/* + * mm_cu_0005.h - 마스터 공통 유틸 선언 (mm_cu_0005.c 구현) + */ +#ifndef MM_CU_0005_H +#define MM_CU_0005_H + +long mm_cu_0005_fee(long amount, int rate_bp); +long mm_cu_0005_round_unit(long amount, long unit); +int mm_cu_0005_classify(long amount); + +#endif /* MM_CU_0005_H */ diff --git a/app/include/mm_cu_0006.h b/app/include/mm_cu_0006.h new file mode 100644 index 0000000..69007d8 --- /dev/null +++ b/app/include/mm_cu_0006.h @@ -0,0 +1,11 @@ +/* + * mm_cu_0006.h - 마스터 공통 유틸 선언 (mm_cu_0006.c 구현) + */ +#ifndef MM_CU_0006_H +#define MM_CU_0006_H + +long mm_cu_0006_fee(long amount, int rate_bp); +long mm_cu_0006_round_unit(long amount, long unit); +int mm_cu_0006_classify(long amount); + +#endif /* MM_CU_0006_H */ diff --git a/app/include/mm_cu_0007.h b/app/include/mm_cu_0007.h new file mode 100644 index 0000000..fd5f608 --- /dev/null +++ b/app/include/mm_cu_0007.h @@ -0,0 +1,11 @@ +/* + * mm_cu_0007.h - 마스터 공통 유틸 선언 (mm_cu_0007.c 구현) + */ +#ifndef MM_CU_0007_H +#define MM_CU_0007_H + +long mm_cu_0007_fee(long amount, int rate_bp); +long mm_cu_0007_round_unit(long amount, long unit); +int mm_cu_0007_classify(long amount); + +#endif /* MM_CU_0007_H */ diff --git a/app/include/mm_cu_0008.h b/app/include/mm_cu_0008.h new file mode 100644 index 0000000..a000686 --- /dev/null +++ b/app/include/mm_cu_0008.h @@ -0,0 +1,11 @@ +/* + * mm_cu_0008.h - 마스터 공통 유틸 선언 (mm_cu_0008.c 구현) + */ +#ifndef MM_CU_0008_H +#define MM_CU_0008_H + +long mm_cu_0008_fee(long amount, int rate_bp); +long mm_cu_0008_round_unit(long amount, long unit); +int mm_cu_0008_classify(long amount); + +#endif /* MM_CU_0008_H */ diff --git a/app/include/mm_cu_0009.h b/app/include/mm_cu_0009.h new file mode 100644 index 0000000..4f2d1fe --- /dev/null +++ b/app/include/mm_cu_0009.h @@ -0,0 +1,11 @@ +/* + * mm_cu_0009.h - 마스터 공통 유틸 선언 (mm_cu_0009.c 구현) + */ +#ifndef MM_CU_0009_H +#define MM_CU_0009_H + +long mm_cu_0009_fee(long amount, int rate_bp); +long mm_cu_0009_round_unit(long amount, long unit); +int mm_cu_0009_classify(long amount); + +#endif /* MM_CU_0009_H */ diff --git a/app/include/mm_cu_0010.h b/app/include/mm_cu_0010.h new file mode 100644 index 0000000..e3c845c --- /dev/null +++ b/app/include/mm_cu_0010.h @@ -0,0 +1,11 @@ +/* + * mm_cu_0010.h - 마스터 공통 유틸 선언 (mm_cu_0010.c 구현) + */ +#ifndef MM_CU_0010_H +#define MM_CU_0010_H + +long mm_cu_0010_fee(long amount, int rate_bp); +long mm_cu_0010_round_unit(long amount, long unit); +int mm_cu_0010_classify(long amount); + +#endif /* MM_CU_0010_H */ diff --git a/app/include/mm_cu_0011.h b/app/include/mm_cu_0011.h new file mode 100644 index 0000000..4e86efb --- /dev/null +++ b/app/include/mm_cu_0011.h @@ -0,0 +1,11 @@ +/* + * mm_cu_0011.h - 마스터 공통 유틸 선언 (mm_cu_0011.c 구현) + */ +#ifndef MM_CU_0011_H +#define MM_CU_0011_H + +long mm_cu_0011_fee(long amount, int rate_bp); +long mm_cu_0011_round_unit(long amount, long unit); +int mm_cu_0011_classify(long amount); + +#endif /* MM_CU_0011_H */ diff --git a/app/include/mm_h_0001.h b/app/include/mm_h_0001.h new file mode 100644 index 0000000..f15ca90 --- /dev/null +++ b/app/include/mm_h_0001.h @@ -0,0 +1,22 @@ +/* + * mm_h_0001.h - 마스터 레코드/뷰 구조 정의 + */ +#ifndef MM_H_0001_H +#define MM_H_0001_H + +/* 마스터 처리 뷰 레코드 */ +typedef struct { + char key[16]; + char merch_id[16]; + long amount; + long fee; + char biz_date[9]; + char status[2]; + char reserved[16]; +} mm_h_0001_view_t; + +#define MM_H_0001_STATUS_OPEN "O" +#define MM_H_0001_STATUS_HOLD "H" +#define MM_H_0001_STATUS_CLOSE "C" + +#endif /* MM_H_0001_H */ diff --git a/app/include/mm_h_0002.h b/app/include/mm_h_0002.h new file mode 100644 index 0000000..b024832 --- /dev/null +++ b/app/include/mm_h_0002.h @@ -0,0 +1,13 @@ +/* + * mm_h_0002.h - 마스터 내부 헬퍼 선언 + */ +#ifndef MM_H_0002_H +#define MM_H_0002_H + +#include "txcore.h" + +int mm_h_0002_check(const char *key, long amount); +int mm_h_0002_apply(TXBUF *in, TXBUF *out); +long mm_h_0002_eval(long amount, int factor); + +#endif /* MM_H_0002_H */ diff --git a/app/include/mm_h_0003.h b/app/include/mm_h_0003.h new file mode 100644 index 0000000..ebc5e18 --- /dev/null +++ b/app/include/mm_h_0003.h @@ -0,0 +1,20 @@ +/* + * mm_h_0003.h - 마스터 코드/상수 테이블 + */ +#ifndef MM_H_0003_H +#define MM_H_0003_H + +#define MM_H_0003_RC_OK 0 +#define MM_H_0003_RC_RETRY 1 +#define MM_H_0003_RC_SKIP 2 +#define MM_H_0003_RC_ERROR 9 + +#define MM_H_0003_LIMIT_DAILY 100000000L +#define MM_H_0003_LIMIT_SINGLE 50000000L +#define MM_H_0003_FEE_RATE_BP 250 /* 2.50% */ + +#define MM_H_0003_CHAN_ONLINE "01" +#define MM_H_0003_CHAN_BATCH "02" +#define MM_H_0003_CHAN_RECON "03" + +#endif /* MM_H_0003_H */ diff --git a/app/include/mm_h_0004.h b/app/include/mm_h_0004.h new file mode 100644 index 0000000..b1bd992 --- /dev/null +++ b/app/include/mm_h_0004.h @@ -0,0 +1,19 @@ +/* + * mm_h_0004.h - 마스터 고정길이 전문 레이아웃 (positional, 재배치 금지) + */ +#ifndef MM_H_0004_H +#define MM_H_0004_H + +typedef struct { + char msg_type[4]; /* 전문구분 4 */ + char merch_id[15]; /* 가맹점번호 15 */ + char key[9]; /* 처리키 9 */ + char amount[12]; /* 금액 12 zero-pad */ + char biz_date[8]; /* 영업일 8 */ + char resp_code[4]; /* 응답코드 4 */ + char filler[20]; /* 예비 20 */ +} mm_h_0004_msg_t; + +#define MM_H_0004_MSG_LEN ((int)sizeof(mm_h_0004_msg_t)) + +#endif /* MM_H_0004_H */ diff --git a/app/include/mm_h_0005.h b/app/include/mm_h_0005.h new file mode 100644 index 0000000..257b510 --- /dev/null +++ b/app/include/mm_h_0005.h @@ -0,0 +1,22 @@ +/* + * mm_h_0005.h - 마스터 레코드/뷰 구조 정의 + */ +#ifndef MM_H_0005_H +#define MM_H_0005_H + +/* 마스터 처리 뷰 레코드 */ +typedef struct { + char key[16]; + char merch_id[16]; + long amount; + long fee; + char biz_date[9]; + char status[2]; + char reserved[16]; +} mm_h_0005_view_t; + +#define MM_H_0005_STATUS_OPEN "O" +#define MM_H_0005_STATUS_HOLD "H" +#define MM_H_0005_STATUS_CLOSE "C" + +#endif /* MM_H_0005_H */ diff --git a/app/include/mm_h_0006.h b/app/include/mm_h_0006.h new file mode 100644 index 0000000..9595a11 --- /dev/null +++ b/app/include/mm_h_0006.h @@ -0,0 +1,13 @@ +/* + * mm_h_0006.h - 마스터 내부 헬퍼 선언 + */ +#ifndef MM_H_0006_H +#define MM_H_0006_H + +#include "txcore.h" + +int mm_h_0006_check(const char *key, long amount); +int mm_h_0006_apply(TXBUF *in, TXBUF *out); +long mm_h_0006_eval(long amount, int factor); + +#endif /* MM_H_0006_H */ diff --git a/app/include/mm_h_0007.h b/app/include/mm_h_0007.h new file mode 100644 index 0000000..cfbb26f --- /dev/null +++ b/app/include/mm_h_0007.h @@ -0,0 +1,20 @@ +/* + * mm_h_0007.h - 마스터 코드/상수 테이블 + */ +#ifndef MM_H_0007_H +#define MM_H_0007_H + +#define MM_H_0007_RC_OK 0 +#define MM_H_0007_RC_RETRY 1 +#define MM_H_0007_RC_SKIP 2 +#define MM_H_0007_RC_ERROR 9 + +#define MM_H_0007_LIMIT_DAILY 100000000L +#define MM_H_0007_LIMIT_SINGLE 50000000L +#define MM_H_0007_FEE_RATE_BP 250 /* 2.50% */ + +#define MM_H_0007_CHAN_ONLINE "01" +#define MM_H_0007_CHAN_BATCH "02" +#define MM_H_0007_CHAN_RECON "03" + +#endif /* MM_H_0007_H */ diff --git a/app/include/mm_h_0008.h b/app/include/mm_h_0008.h new file mode 100644 index 0000000..5b0b602 --- /dev/null +++ b/app/include/mm_h_0008.h @@ -0,0 +1,19 @@ +/* + * mm_h_0008.h - 마스터 고정길이 전문 레이아웃 (positional, 재배치 금지) + */ +#ifndef MM_H_0008_H +#define MM_H_0008_H + +typedef struct { + char msg_type[4]; /* 전문구분 4 */ + char merch_id[15]; /* 가맹점번호 15 */ + char key[9]; /* 처리키 9 */ + char amount[12]; /* 금액 12 zero-pad */ + char biz_date[8]; /* 영업일 8 */ + char resp_code[4]; /* 응답코드 4 */ + char filler[20]; /* 예비 20 */ +} mm_h_0008_msg_t; + +#define MM_H_0008_MSG_LEN ((int)sizeof(mm_h_0008_msg_t)) + +#endif /* MM_H_0008_H */ diff --git a/app/include/mm_h_0009.h b/app/include/mm_h_0009.h new file mode 100644 index 0000000..99235b1 --- /dev/null +++ b/app/include/mm_h_0009.h @@ -0,0 +1,22 @@ +/* + * mm_h_0009.h - 마스터 레코드/뷰 구조 정의 + */ +#ifndef MM_H_0009_H +#define MM_H_0009_H + +/* 마스터 처리 뷰 레코드 */ +typedef struct { + char key[16]; + char merch_id[16]; + long amount; + long fee; + char biz_date[9]; + char status[2]; + char reserved[16]; +} mm_h_0009_view_t; + +#define MM_H_0009_STATUS_OPEN "O" +#define MM_H_0009_STATUS_HOLD "H" +#define MM_H_0009_STATUS_CLOSE "C" + +#endif /* MM_H_0009_H */ diff --git a/app/include/mm_h_0010.h b/app/include/mm_h_0010.h new file mode 100644 index 0000000..78d3fea --- /dev/null +++ b/app/include/mm_h_0010.h @@ -0,0 +1,13 @@ +/* + * mm_h_0010.h - 마스터 내부 헬퍼 선언 + */ +#ifndef MM_H_0010_H +#define MM_H_0010_H + +#include "txcore.h" + +int mm_h_0010_check(const char *key, long amount); +int mm_h_0010_apply(TXBUF *in, TXBUF *out); +long mm_h_0010_eval(long amount, int factor); + +#endif /* MM_H_0010_H */ diff --git a/app/include/mm_h_0011.h b/app/include/mm_h_0011.h new file mode 100644 index 0000000..b27d627 --- /dev/null +++ b/app/include/mm_h_0011.h @@ -0,0 +1,20 @@ +/* + * mm_h_0011.h - 마스터 코드/상수 테이블 + */ +#ifndef MM_H_0011_H +#define MM_H_0011_H + +#define MM_H_0011_RC_OK 0 +#define MM_H_0011_RC_RETRY 1 +#define MM_H_0011_RC_SKIP 2 +#define MM_H_0011_RC_ERROR 9 + +#define MM_H_0011_LIMIT_DAILY 100000000L +#define MM_H_0011_LIMIT_SINGLE 50000000L +#define MM_H_0011_FEE_RATE_BP 250 /* 2.50% */ + +#define MM_H_0011_CHAN_ONLINE "01" +#define MM_H_0011_CHAN_BATCH "02" +#define MM_H_0011_CHAN_RECON "03" + +#endif /* MM_H_0011_H */ diff --git a/app/include/mm_h_0012.h b/app/include/mm_h_0012.h new file mode 100644 index 0000000..61cf60f --- /dev/null +++ b/app/include/mm_h_0012.h @@ -0,0 +1,19 @@ +/* + * mm_h_0012.h - 마스터 고정길이 전문 레이아웃 (positional, 재배치 금지) + */ +#ifndef MM_H_0012_H +#define MM_H_0012_H + +typedef struct { + char msg_type[4]; /* 전문구분 4 */ + char merch_id[15]; /* 가맹점번호 15 */ + char key[9]; /* 처리키 9 */ + char amount[12]; /* 금액 12 zero-pad */ + char biz_date[8]; /* 영업일 8 */ + char resp_code[4]; /* 응답코드 4 */ + char filler[20]; /* 예비 20 */ +} mm_h_0012_msg_t; + +#define MM_H_0012_MSG_LEN ((int)sizeof(mm_h_0012_msg_t)) + +#endif /* MM_H_0012_H */ diff --git a/app/include/mm_h_0013.h b/app/include/mm_h_0013.h new file mode 100644 index 0000000..0dfd984 --- /dev/null +++ b/app/include/mm_h_0013.h @@ -0,0 +1,22 @@ +/* + * mm_h_0013.h - 마스터 레코드/뷰 구조 정의 + */ +#ifndef MM_H_0013_H +#define MM_H_0013_H + +/* 마스터 처리 뷰 레코드 */ +typedef struct { + char key[16]; + char merch_id[16]; + long amount; + long fee; + char biz_date[9]; + char status[2]; + char reserved[16]; +} mm_h_0013_view_t; + +#define MM_H_0013_STATUS_OPEN "O" +#define MM_H_0013_STATUS_HOLD "H" +#define MM_H_0013_STATUS_CLOSE "C" + +#endif /* MM_H_0013_H */ diff --git a/app/include/mm_h_0014.h b/app/include/mm_h_0014.h new file mode 100644 index 0000000..77d5390 --- /dev/null +++ b/app/include/mm_h_0014.h @@ -0,0 +1,13 @@ +/* + * mm_h_0014.h - 마스터 내부 헬퍼 선언 + */ +#ifndef MM_H_0014_H +#define MM_H_0014_H + +#include "txcore.h" + +int mm_h_0014_check(const char *key, long amount); +int mm_h_0014_apply(TXBUF *in, TXBUF *out); +long mm_h_0014_eval(long amount, int factor); + +#endif /* MM_H_0014_H */ diff --git a/app/include/mm_h_0015.h b/app/include/mm_h_0015.h new file mode 100644 index 0000000..5e55653 --- /dev/null +++ b/app/include/mm_h_0015.h @@ -0,0 +1,20 @@ +/* + * mm_h_0015.h - 마스터 코드/상수 테이블 + */ +#ifndef MM_H_0015_H +#define MM_H_0015_H + +#define MM_H_0015_RC_OK 0 +#define MM_H_0015_RC_RETRY 1 +#define MM_H_0015_RC_SKIP 2 +#define MM_H_0015_RC_ERROR 9 + +#define MM_H_0015_LIMIT_DAILY 100000000L +#define MM_H_0015_LIMIT_SINGLE 50000000L +#define MM_H_0015_FEE_RATE_BP 250 /* 2.50% */ + +#define MM_H_0015_CHAN_ONLINE "01" +#define MM_H_0015_CHAN_BATCH "02" +#define MM_H_0015_CHAN_RECON "03" + +#endif /* MM_H_0015_H */ diff --git a/app/include/mm_h_0016.h b/app/include/mm_h_0016.h new file mode 100644 index 0000000..dc67132 --- /dev/null +++ b/app/include/mm_h_0016.h @@ -0,0 +1,19 @@ +/* + * mm_h_0016.h - 마스터 고정길이 전문 레이아웃 (positional, 재배치 금지) + */ +#ifndef MM_H_0016_H +#define MM_H_0016_H + +typedef struct { + char msg_type[4]; /* 전문구분 4 */ + char merch_id[15]; /* 가맹점번호 15 */ + char key[9]; /* 처리키 9 */ + char amount[12]; /* 금액 12 zero-pad */ + char biz_date[8]; /* 영업일 8 */ + char resp_code[4]; /* 응답코드 4 */ + char filler[20]; /* 예비 20 */ +} mm_h_0016_msg_t; + +#define MM_H_0016_MSG_LEN ((int)sizeof(mm_h_0016_msg_t)) + +#endif /* MM_H_0016_H */ diff --git a/app/include/mm_io_0001.h b/app/include/mm_io_0001.h new file mode 100644 index 0000000..d4c8838 --- /dev/null +++ b/app/include/mm_io_0001.h @@ -0,0 +1,14 @@ +/* + * mm_io_0001.h - 마스터 보조 DBIO 선언 (mm_io_0001.pgc 구현) + */ +#ifndef MM_IO_0001_H +#define MM_IO_0001_H + +#include "txcore.h" + +/* mm_io_0001 전용 조회/갱신 (테이블 mm_io_0001_t) */ +int mm_io_0001_fetch(const char *key, long *out_amount); +int mm_io_0001_touch(const char *key, long amount); +long mm_io_0001_total(const char *biz_date); + +#endif /* MM_IO_0001_H */ diff --git a/app/include/mm_io_0002.h b/app/include/mm_io_0002.h new file mode 100644 index 0000000..96e2aa3 --- /dev/null +++ b/app/include/mm_io_0002.h @@ -0,0 +1,14 @@ +/* + * mm_io_0002.h - 마스터 보조 DBIO 선언 (mm_io_0002.pgc 구현) + */ +#ifndef MM_IO_0002_H +#define MM_IO_0002_H + +#include "txcore.h" + +/* mm_io_0002 전용 조회/갱신 (테이블 mm_io_0002_t) */ +int mm_io_0002_fetch(const char *key, long *out_amount); +int mm_io_0002_touch(const char *key, long amount); +long mm_io_0002_total(const char *biz_date); + +#endif /* MM_IO_0002_H */ diff --git a/app/include/mm_io_0003.h b/app/include/mm_io_0003.h new file mode 100644 index 0000000..b4f108f --- /dev/null +++ b/app/include/mm_io_0003.h @@ -0,0 +1,14 @@ +/* + * mm_io_0003.h - 마스터 보조 DBIO 선언 (mm_io_0003.pgc 구현) + */ +#ifndef MM_IO_0003_H +#define MM_IO_0003_H + +#include "txcore.h" + +/* mm_io_0003 전용 조회/갱신 (테이블 mm_io_0003_t) */ +int mm_io_0003_fetch(const char *key, long *out_amount); +int mm_io_0003_touch(const char *key, long amount); +long mm_io_0003_total(const char *biz_date); + +#endif /* MM_IO_0003_H */ diff --git a/app/include/mm_io_0004.h b/app/include/mm_io_0004.h new file mode 100644 index 0000000..8125858 --- /dev/null +++ b/app/include/mm_io_0004.h @@ -0,0 +1,14 @@ +/* + * mm_io_0004.h - 마스터 보조 DBIO 선언 (mm_io_0004.pgc 구현) + */ +#ifndef MM_IO_0004_H +#define MM_IO_0004_H + +#include "txcore.h" + +/* mm_io_0004 전용 조회/갱신 (테이블 mm_io_0004_t) */ +int mm_io_0004_fetch(const char *key, long *out_amount); +int mm_io_0004_touch(const char *key, long amount); +long mm_io_0004_total(const char *biz_date); + +#endif /* MM_IO_0004_H */ diff --git a/app/include/mm_io_0005.h b/app/include/mm_io_0005.h new file mode 100644 index 0000000..836dc7f --- /dev/null +++ b/app/include/mm_io_0005.h @@ -0,0 +1,14 @@ +/* + * mm_io_0005.h - 마스터 보조 DBIO 선언 (mm_io_0005.pgc 구현) + */ +#ifndef MM_IO_0005_H +#define MM_IO_0005_H + +#include "txcore.h" + +/* mm_io_0005 전용 조회/갱신 (테이블 mm_io_0005_t) */ +int mm_io_0005_fetch(const char *key, long *out_amount); +int mm_io_0005_touch(const char *key, long amount); +long mm_io_0005_total(const char *biz_date); + +#endif /* MM_IO_0005_H */ diff --git a/app/include/mm_io_0006.h b/app/include/mm_io_0006.h new file mode 100644 index 0000000..db29407 --- /dev/null +++ b/app/include/mm_io_0006.h @@ -0,0 +1,14 @@ +/* + * mm_io_0006.h - 마스터 보조 DBIO 선언 (mm_io_0006.pgc 구현) + */ +#ifndef MM_IO_0006_H +#define MM_IO_0006_H + +#include "txcore.h" + +/* mm_io_0006 전용 조회/갱신 (테이블 mm_io_0006_t) */ +int mm_io_0006_fetch(const char *key, long *out_amount); +int mm_io_0006_touch(const char *key, long amount); +long mm_io_0006_total(const char *biz_date); + +#endif /* MM_IO_0006_H */ diff --git a/app/include/mm_io_0007.h b/app/include/mm_io_0007.h new file mode 100644 index 0000000..7006406 --- /dev/null +++ b/app/include/mm_io_0007.h @@ -0,0 +1,14 @@ +/* + * mm_io_0007.h - 마스터 보조 DBIO 선언 (mm_io_0007.pgc 구현) + */ +#ifndef MM_IO_0007_H +#define MM_IO_0007_H + +#include "txcore.h" + +/* mm_io_0007 전용 조회/갱신 (테이블 mm_io_0007_t) */ +int mm_io_0007_fetch(const char *key, long *out_amount); +int mm_io_0007_touch(const char *key, long amount); +long mm_io_0007_total(const char *biz_date); + +#endif /* MM_IO_0007_H */ diff --git a/app/include/mm_io_0008.h b/app/include/mm_io_0008.h new file mode 100644 index 0000000..ba9926e --- /dev/null +++ b/app/include/mm_io_0008.h @@ -0,0 +1,14 @@ +/* + * mm_io_0008.h - 마스터 보조 DBIO 선언 (mm_io_0008.pgc 구현) + */ +#ifndef MM_IO_0008_H +#define MM_IO_0008_H + +#include "txcore.h" + +/* mm_io_0008 전용 조회/갱신 (테이블 mm_io_0008_t) */ +int mm_io_0008_fetch(const char *key, long *out_amount); +int mm_io_0008_touch(const char *key, long amount); +long mm_io_0008_total(const char *biz_date); + +#endif /* MM_IO_0008_H */ diff --git a/app/include/mm_io_0009.h b/app/include/mm_io_0009.h new file mode 100644 index 0000000..a195b47 --- /dev/null +++ b/app/include/mm_io_0009.h @@ -0,0 +1,14 @@ +/* + * mm_io_0009.h - 마스터 보조 DBIO 선언 (mm_io_0009.pgc 구현) + */ +#ifndef MM_IO_0009_H +#define MM_IO_0009_H + +#include "txcore.h" + +/* mm_io_0009 전용 조회/갱신 (테이블 mm_io_0009_t) */ +int mm_io_0009_fetch(const char *key, long *out_amount); +int mm_io_0009_touch(const char *key, long amount); +long mm_io_0009_total(const char *biz_date); + +#endif /* MM_IO_0009_H */ diff --git a/app/include/mm_io_0010.h b/app/include/mm_io_0010.h new file mode 100644 index 0000000..638add5 --- /dev/null +++ b/app/include/mm_io_0010.h @@ -0,0 +1,14 @@ +/* + * mm_io_0010.h - 마스터 보조 DBIO 선언 (mm_io_0010.pgc 구현) + */ +#ifndef MM_IO_0010_H +#define MM_IO_0010_H + +#include "txcore.h" + +/* mm_io_0010 전용 조회/갱신 (테이블 mm_io_0010_t) */ +int mm_io_0010_fetch(const char *key, long *out_amount); +int mm_io_0010_touch(const char *key, long amount); +long mm_io_0010_total(const char *biz_date); + +#endif /* MM_IO_0010_H */ diff --git a/app/include/mm_io_0011.h b/app/include/mm_io_0011.h new file mode 100644 index 0000000..b6bdca1 --- /dev/null +++ b/app/include/mm_io_0011.h @@ -0,0 +1,14 @@ +/* + * mm_io_0011.h - 마스터 보조 DBIO 선언 (mm_io_0011.pgc 구현) + */ +#ifndef MM_IO_0011_H +#define MM_IO_0011_H + +#include "txcore.h" + +/* mm_io_0011 전용 조회/갱신 (테이블 mm_io_0011_t) */ +int mm_io_0011_fetch(const char *key, long *out_amount); +int mm_io_0011_touch(const char *key, long amount); +long mm_io_0011_total(const char *biz_date); + +#endif /* MM_IO_0011_H */ diff --git a/app/include/mm_io_0012.h b/app/include/mm_io_0012.h new file mode 100644 index 0000000..9813db3 --- /dev/null +++ b/app/include/mm_io_0012.h @@ -0,0 +1,14 @@ +/* + * mm_io_0012.h - 마스터 보조 DBIO 선언 (mm_io_0012.pgc 구현) + */ +#ifndef MM_IO_0012_H +#define MM_IO_0012_H + +#include "txcore.h" + +/* mm_io_0012 전용 조회/갱신 (테이블 mm_io_0012_t) */ +int mm_io_0012_fetch(const char *key, long *out_amount); +int mm_io_0012_touch(const char *key, long amount); +long mm_io_0012_total(const char *biz_date); + +#endif /* MM_IO_0012_H */ diff --git a/app/include/mm_io_0013.h b/app/include/mm_io_0013.h new file mode 100644 index 0000000..7b2fd80 --- /dev/null +++ b/app/include/mm_io_0013.h @@ -0,0 +1,14 @@ +/* + * mm_io_0013.h - 마스터 보조 DBIO 선언 (mm_io_0013.pgc 구현) + */ +#ifndef MM_IO_0013_H +#define MM_IO_0013_H + +#include "txcore.h" + +/* mm_io_0013 전용 조회/갱신 (테이블 mm_io_0013_t) */ +int mm_io_0013_fetch(const char *key, long *out_amount); +int mm_io_0013_touch(const char *key, long amount); +long mm_io_0013_total(const char *biz_date); + +#endif /* MM_IO_0013_H */ diff --git a/app/include/mm_io_0014.h b/app/include/mm_io_0014.h new file mode 100644 index 0000000..54621cc --- /dev/null +++ b/app/include/mm_io_0014.h @@ -0,0 +1,14 @@ +/* + * mm_io_0014.h - 마스터 보조 DBIO 선언 (mm_io_0014.pgc 구현) + */ +#ifndef MM_IO_0014_H +#define MM_IO_0014_H + +#include "txcore.h" + +/* mm_io_0014 전용 조회/갱신 (테이블 mm_io_0014_t) */ +int mm_io_0014_fetch(const char *key, long *out_amount); +int mm_io_0014_touch(const char *key, long amount); +long mm_io_0014_total(const char *biz_date); + +#endif /* MM_IO_0014_H */ diff --git a/app/include/mm_io_0015.h b/app/include/mm_io_0015.h new file mode 100644 index 0000000..f550b12 --- /dev/null +++ b/app/include/mm_io_0015.h @@ -0,0 +1,14 @@ +/* + * mm_io_0015.h - 마스터 보조 DBIO 선언 (mm_io_0015.pgc 구현) + */ +#ifndef MM_IO_0015_H +#define MM_IO_0015_H + +#include "txcore.h" + +/* mm_io_0015 전용 조회/갱신 (테이블 mm_io_0015_t) */ +int mm_io_0015_fetch(const char *key, long *out_amount); +int mm_io_0015_touch(const char *key, long amount); +long mm_io_0015_total(const char *biz_date); + +#endif /* MM_IO_0015_H */ diff --git a/app/include/mm_io_0016.h b/app/include/mm_io_0016.h new file mode 100644 index 0000000..819d830 --- /dev/null +++ b/app/include/mm_io_0016.h @@ -0,0 +1,14 @@ +/* + * mm_io_0016.h - 마스터 보조 DBIO 선언 (mm_io_0016.pgc 구현) + */ +#ifndef MM_IO_0016_H +#define MM_IO_0016_H + +#include "txcore.h" + +/* mm_io_0016 전용 조회/갱신 (테이블 mm_io_0016_t) */ +int mm_io_0016_fetch(const char *key, long *out_amount); +int mm_io_0016_touch(const char *key, long amount); +long mm_io_0016_total(const char *biz_date); + +#endif /* MM_IO_0016_H */ diff --git a/app/include/mm_io_0017.h b/app/include/mm_io_0017.h new file mode 100644 index 0000000..f6dd380 --- /dev/null +++ b/app/include/mm_io_0017.h @@ -0,0 +1,14 @@ +/* + * mm_io_0017.h - 마스터 보조 DBIO 선언 (mm_io_0017.pgc 구현) + */ +#ifndef MM_IO_0017_H +#define MM_IO_0017_H + +#include "txcore.h" + +/* mm_io_0017 전용 조회/갱신 (테이블 mm_io_0017_t) */ +int mm_io_0017_fetch(const char *key, long *out_amount); +int mm_io_0017_touch(const char *key, long amount); +long mm_io_0017_total(const char *biz_date); + +#endif /* MM_IO_0017_H */ diff --git a/app/include/mm_io_0018.h b/app/include/mm_io_0018.h new file mode 100644 index 0000000..76cb170 --- /dev/null +++ b/app/include/mm_io_0018.h @@ -0,0 +1,14 @@ +/* + * mm_io_0018.h - 마스터 보조 DBIO 선언 (mm_io_0018.pgc 구현) + */ +#ifndef MM_IO_0018_H +#define MM_IO_0018_H + +#include "txcore.h" + +/* mm_io_0018 전용 조회/갱신 (테이블 mm_io_0018_t) */ +int mm_io_0018_fetch(const char *key, long *out_amount); +int mm_io_0018_touch(const char *key, long amount); +long mm_io_0018_total(const char *biz_date); + +#endif /* MM_IO_0018_H */ diff --git a/app/include/mm_io_0019.h b/app/include/mm_io_0019.h new file mode 100644 index 0000000..02a859b --- /dev/null +++ b/app/include/mm_io_0019.h @@ -0,0 +1,14 @@ +/* + * mm_io_0019.h - 마스터 보조 DBIO 선언 (mm_io_0019.pgc 구현) + */ +#ifndef MM_IO_0019_H +#define MM_IO_0019_H + +#include "txcore.h" + +/* mm_io_0019 전용 조회/갱신 (테이블 mm_io_0019_t) */ +int mm_io_0019_fetch(const char *key, long *out_amount); +int mm_io_0019_touch(const char *key, long amount); +long mm_io_0019_total(const char *biz_date); + +#endif /* MM_IO_0019_H */ diff --git a/app/include/mm_io_0020.h b/app/include/mm_io_0020.h new file mode 100644 index 0000000..c5b6f31 --- /dev/null +++ b/app/include/mm_io_0020.h @@ -0,0 +1,14 @@ +/* + * mm_io_0020.h - 마스터 보조 DBIO 선언 (mm_io_0020.pgc 구현) + */ +#ifndef MM_IO_0020_H +#define MM_IO_0020_H + +#include "txcore.h" + +/* mm_io_0020 전용 조회/갱신 (테이블 mm_io_0020_t) */ +int mm_io_0020_fetch(const char *key, long *out_amount); +int mm_io_0020_touch(const char *key, long amount); +long mm_io_0020_total(const char *biz_date); + +#endif /* MM_IO_0020_H */ diff --git a/app/include/mm_io_0021.h b/app/include/mm_io_0021.h new file mode 100644 index 0000000..3ce62d1 --- /dev/null +++ b/app/include/mm_io_0021.h @@ -0,0 +1,14 @@ +/* + * mm_io_0021.h - 마스터 보조 DBIO 선언 (mm_io_0021.pgc 구현) + */ +#ifndef MM_IO_0021_H +#define MM_IO_0021_H + +#include "txcore.h" + +/* mm_io_0021 전용 조회/갱신 (테이블 mm_io_0021_t) */ +int mm_io_0021_fetch(const char *key, long *out_amount); +int mm_io_0021_touch(const char *key, long amount); +long mm_io_0021_total(const char *biz_date); + +#endif /* MM_IO_0021_H */ diff --git a/app/include/mm_io_0022.h b/app/include/mm_io_0022.h new file mode 100644 index 0000000..416a557 --- /dev/null +++ b/app/include/mm_io_0022.h @@ -0,0 +1,14 @@ +/* + * mm_io_0022.h - 마스터 보조 DBIO 선언 (mm_io_0022.pgc 구현) + */ +#ifndef MM_IO_0022_H +#define MM_IO_0022_H + +#include "txcore.h" + +/* mm_io_0022 전용 조회/갱신 (테이블 mm_io_0022_t) */ +int mm_io_0022_fetch(const char *key, long *out_amount); +int mm_io_0022_touch(const char *key, long amount); +long mm_io_0022_total(const char *biz_date); + +#endif /* MM_IO_0022_H */ diff --git a/app/include/mm_io_0023.h b/app/include/mm_io_0023.h new file mode 100644 index 0000000..d7ba6a2 --- /dev/null +++ b/app/include/mm_io_0023.h @@ -0,0 +1,14 @@ +/* + * mm_io_0023.h - 마스터 보조 DBIO 선언 (mm_io_0023.pgc 구현) + */ +#ifndef MM_IO_0023_H +#define MM_IO_0023_H + +#include "txcore.h" + +/* mm_io_0023 전용 조회/갱신 (테이블 mm_io_0023_t) */ +int mm_io_0023_fetch(const char *key, long *out_amount); +int mm_io_0023_touch(const char *key, long amount); +long mm_io_0023_total(const char *biz_date); + +#endif /* MM_IO_0023_H */ diff --git a/app/include/mm_io_0024.h b/app/include/mm_io_0024.h new file mode 100644 index 0000000..41546b6 --- /dev/null +++ b/app/include/mm_io_0024.h @@ -0,0 +1,14 @@ +/* + * mm_io_0024.h - 마스터 보조 DBIO 선언 (mm_io_0024.pgc 구현) + */ +#ifndef MM_IO_0024_H +#define MM_IO_0024_H + +#include "txcore.h" + +/* mm_io_0024 전용 조회/갱신 (테이블 mm_io_0024_t) */ +int mm_io_0024_fetch(const char *key, long *out_amount); +int mm_io_0024_touch(const char *key, long amount); +long mm_io_0024_total(const char *biz_date); + +#endif /* MM_IO_0024_H */ diff --git a/app/include/mm_io_0025.h b/app/include/mm_io_0025.h new file mode 100644 index 0000000..afc0ddc --- /dev/null +++ b/app/include/mm_io_0025.h @@ -0,0 +1,14 @@ +/* + * mm_io_0025.h - 마스터 보조 DBIO 선언 (mm_io_0025.pgc 구현) + */ +#ifndef MM_IO_0025_H +#define MM_IO_0025_H + +#include "txcore.h" + +/* mm_io_0025 전용 조회/갱신 (테이블 mm_io_0025_t) */ +int mm_io_0025_fetch(const char *key, long *out_amount); +int mm_io_0025_touch(const char *key, long amount); +long mm_io_0025_total(const char *biz_date); + +#endif /* MM_IO_0025_H */ diff --git a/app/include/mm_io_0026.h b/app/include/mm_io_0026.h new file mode 100644 index 0000000..b3eec6e --- /dev/null +++ b/app/include/mm_io_0026.h @@ -0,0 +1,14 @@ +/* + * mm_io_0026.h - 마스터 보조 DBIO 선언 (mm_io_0026.pgc 구현) + */ +#ifndef MM_IO_0026_H +#define MM_IO_0026_H + +#include "txcore.h" + +/* mm_io_0026 전용 조회/갱신 (테이블 mm_io_0026_t) */ +int mm_io_0026_fetch(const char *key, long *out_amount); +int mm_io_0026_touch(const char *key, long amount); +long mm_io_0026_total(const char *biz_date); + +#endif /* MM_IO_0026_H */ diff --git a/app/include/py_core.h b/app/include/py_core.h new file mode 100644 index 0000000..7a29705 --- /dev/null +++ b/app/include/py_core.h @@ -0,0 +1,38 @@ +/* + * py_core.h - 지급 모듈 핵심 계약 (레코드/상태/표준 DBIO API) + * + * 이 모듈의 온라인/배치 프로그램은 SQL 을 직접 다루지 않고 아래 표준 + * DBIO API 만 호출한다. 구현은 app/dbio/py_dbio_main.pgc (ECPG). + */ +#ifndef PY_CORE_H +#define PY_CORE_H + +#include "txcore.h" + +/* 지급 처리 상태코드 */ +#define PY_ST_RECV "R" /* 접수/수신 */ +#define PY_ST_DONE "M" /* 처리완료 */ +#define PY_ST_FAIL "U" /* 불일치/실패 */ +#define PY_ST_SETTLED "S" /* 정산완료 */ + +/* 지급 원장 레코드 (1행) */ +typedef struct { + char key[16]; /* 처리키(승인/거래 번호) PK */ + char merch_id[16]; /* 가맹점번호 */ + char card_no[20]; /* 카드번호(마스킹) */ + long amount; /* 거래금액(원) */ + char biz_date[9]; /* 영업일 YYYYMMDD */ + char status[2]; /* 상태코드 */ + long fee; /* 수수료(원) */ +} py_rec_t; + +/* 표준 DBIO API (구현: py_dbio_main.pgc) */ +int py_dbio_connect(const char *target); +int py_dbio_disconnect(void); +int py_rec_insert(const py_rec_t *rec); +int py_rec_select(const char *key, py_rec_t *out); +int py_rec_update_status(const char *key, const char *status); +long py_rec_count(const char *biz_date, const char *status); +int py_rec_sum(const char *biz_date, long *out_sum); + +#endif /* PY_CORE_H */ diff --git a/app/include/py_cu_0001.h b/app/include/py_cu_0001.h new file mode 100644 index 0000000..3715078 --- /dev/null +++ b/app/include/py_cu_0001.h @@ -0,0 +1,11 @@ +/* + * py_cu_0001.h - 지급 공통 유틸 선언 (py_cu_0001.c 구현) + */ +#ifndef PY_CU_0001_H +#define PY_CU_0001_H + +long py_cu_0001_fee(long amount, int rate_bp); +long py_cu_0001_round_unit(long amount, long unit); +int py_cu_0001_classify(long amount); + +#endif /* PY_CU_0001_H */ diff --git a/app/include/py_cu_0002.h b/app/include/py_cu_0002.h new file mode 100644 index 0000000..51b4fb9 --- /dev/null +++ b/app/include/py_cu_0002.h @@ -0,0 +1,11 @@ +/* + * py_cu_0002.h - 지급 공통 유틸 선언 (py_cu_0002.c 구현) + */ +#ifndef PY_CU_0002_H +#define PY_CU_0002_H + +long py_cu_0002_fee(long amount, int rate_bp); +long py_cu_0002_round_unit(long amount, long unit); +int py_cu_0002_classify(long amount); + +#endif /* PY_CU_0002_H */ diff --git a/app/include/py_cu_0003.h b/app/include/py_cu_0003.h new file mode 100644 index 0000000..9b89f62 --- /dev/null +++ b/app/include/py_cu_0003.h @@ -0,0 +1,11 @@ +/* + * py_cu_0003.h - 지급 공통 유틸 선언 (py_cu_0003.c 구현) + */ +#ifndef PY_CU_0003_H +#define PY_CU_0003_H + +long py_cu_0003_fee(long amount, int rate_bp); +long py_cu_0003_round_unit(long amount, long unit); +int py_cu_0003_classify(long amount); + +#endif /* PY_CU_0003_H */ diff --git a/app/include/py_cu_0004.h b/app/include/py_cu_0004.h new file mode 100644 index 0000000..598a864 --- /dev/null +++ b/app/include/py_cu_0004.h @@ -0,0 +1,11 @@ +/* + * py_cu_0004.h - 지급 공통 유틸 선언 (py_cu_0004.c 구현) + */ +#ifndef PY_CU_0004_H +#define PY_CU_0004_H + +long py_cu_0004_fee(long amount, int rate_bp); +long py_cu_0004_round_unit(long amount, long unit); +int py_cu_0004_classify(long amount); + +#endif /* PY_CU_0004_H */ diff --git a/app/include/py_cu_0005.h b/app/include/py_cu_0005.h new file mode 100644 index 0000000..a3f9c53 --- /dev/null +++ b/app/include/py_cu_0005.h @@ -0,0 +1,11 @@ +/* + * py_cu_0005.h - 지급 공통 유틸 선언 (py_cu_0005.c 구현) + */ +#ifndef PY_CU_0005_H +#define PY_CU_0005_H + +long py_cu_0005_fee(long amount, int rate_bp); +long py_cu_0005_round_unit(long amount, long unit); +int py_cu_0005_classify(long amount); + +#endif /* PY_CU_0005_H */ diff --git a/app/include/py_cu_0006.h b/app/include/py_cu_0006.h new file mode 100644 index 0000000..b214b2e --- /dev/null +++ b/app/include/py_cu_0006.h @@ -0,0 +1,11 @@ +/* + * py_cu_0006.h - 지급 공통 유틸 선언 (py_cu_0006.c 구현) + */ +#ifndef PY_CU_0006_H +#define PY_CU_0006_H + +long py_cu_0006_fee(long amount, int rate_bp); +long py_cu_0006_round_unit(long amount, long unit); +int py_cu_0006_classify(long amount); + +#endif /* PY_CU_0006_H */ diff --git a/app/include/py_cu_0007.h b/app/include/py_cu_0007.h new file mode 100644 index 0000000..06cbdd5 --- /dev/null +++ b/app/include/py_cu_0007.h @@ -0,0 +1,11 @@ +/* + * py_cu_0007.h - 지급 공통 유틸 선언 (py_cu_0007.c 구현) + */ +#ifndef PY_CU_0007_H +#define PY_CU_0007_H + +long py_cu_0007_fee(long amount, int rate_bp); +long py_cu_0007_round_unit(long amount, long unit); +int py_cu_0007_classify(long amount); + +#endif /* PY_CU_0007_H */ diff --git a/app/include/py_cu_0008.h b/app/include/py_cu_0008.h new file mode 100644 index 0000000..2baea46 --- /dev/null +++ b/app/include/py_cu_0008.h @@ -0,0 +1,11 @@ +/* + * py_cu_0008.h - 지급 공통 유틸 선언 (py_cu_0008.c 구현) + */ +#ifndef PY_CU_0008_H +#define PY_CU_0008_H + +long py_cu_0008_fee(long amount, int rate_bp); +long py_cu_0008_round_unit(long amount, long unit); +int py_cu_0008_classify(long amount); + +#endif /* PY_CU_0008_H */ diff --git a/app/include/py_cu_0009.h b/app/include/py_cu_0009.h new file mode 100644 index 0000000..3e0b74d --- /dev/null +++ b/app/include/py_cu_0009.h @@ -0,0 +1,11 @@ +/* + * py_cu_0009.h - 지급 공통 유틸 선언 (py_cu_0009.c 구현) + */ +#ifndef PY_CU_0009_H +#define PY_CU_0009_H + +long py_cu_0009_fee(long amount, int rate_bp); +long py_cu_0009_round_unit(long amount, long unit); +int py_cu_0009_classify(long amount); + +#endif /* PY_CU_0009_H */ diff --git a/app/include/py_cu_0010.h b/app/include/py_cu_0010.h new file mode 100644 index 0000000..ee88208 --- /dev/null +++ b/app/include/py_cu_0010.h @@ -0,0 +1,11 @@ +/* + * py_cu_0010.h - 지급 공통 유틸 선언 (py_cu_0010.c 구현) + */ +#ifndef PY_CU_0010_H +#define PY_CU_0010_H + +long py_cu_0010_fee(long amount, int rate_bp); +long py_cu_0010_round_unit(long amount, long unit); +int py_cu_0010_classify(long amount); + +#endif /* PY_CU_0010_H */ diff --git a/app/include/py_cu_0011.h b/app/include/py_cu_0011.h new file mode 100644 index 0000000..b614ddb --- /dev/null +++ b/app/include/py_cu_0011.h @@ -0,0 +1,11 @@ +/* + * py_cu_0011.h - 지급 공통 유틸 선언 (py_cu_0011.c 구현) + */ +#ifndef PY_CU_0011_H +#define PY_CU_0011_H + +long py_cu_0011_fee(long amount, int rate_bp); +long py_cu_0011_round_unit(long amount, long unit); +int py_cu_0011_classify(long amount); + +#endif /* PY_CU_0011_H */ diff --git a/app/include/py_h_0001.h b/app/include/py_h_0001.h new file mode 100644 index 0000000..7df942a --- /dev/null +++ b/app/include/py_h_0001.h @@ -0,0 +1,20 @@ +/* + * py_h_0001.h - 지급 코드/상수 테이블 + */ +#ifndef PY_H_0001_H +#define PY_H_0001_H + +#define PY_H_0001_RC_OK 0 +#define PY_H_0001_RC_RETRY 1 +#define PY_H_0001_RC_SKIP 2 +#define PY_H_0001_RC_ERROR 9 + +#define PY_H_0001_LIMIT_DAILY 100000000L +#define PY_H_0001_LIMIT_SINGLE 50000000L +#define PY_H_0001_FEE_RATE_BP 250 /* 2.50% */ + +#define PY_H_0001_CHAN_ONLINE "01" +#define PY_H_0001_CHAN_BATCH "02" +#define PY_H_0001_CHAN_RECON "03" + +#endif /* PY_H_0001_H */ diff --git a/app/include/py_h_0002.h b/app/include/py_h_0002.h new file mode 100644 index 0000000..70f2b9e --- /dev/null +++ b/app/include/py_h_0002.h @@ -0,0 +1,19 @@ +/* + * py_h_0002.h - 지급 고정길이 전문 레이아웃 (positional, 재배치 금지) + */ +#ifndef PY_H_0002_H +#define PY_H_0002_H + +typedef struct { + char msg_type[4]; /* 전문구분 4 */ + char merch_id[15]; /* 가맹점번호 15 */ + char key[9]; /* 처리키 9 */ + char amount[12]; /* 금액 12 zero-pad */ + char biz_date[8]; /* 영업일 8 */ + char resp_code[4]; /* 응답코드 4 */ + char filler[20]; /* 예비 20 */ +} py_h_0002_msg_t; + +#define PY_H_0002_MSG_LEN ((int)sizeof(py_h_0002_msg_t)) + +#endif /* PY_H_0002_H */ diff --git a/app/include/py_h_0003.h b/app/include/py_h_0003.h new file mode 100644 index 0000000..5fc48f7 --- /dev/null +++ b/app/include/py_h_0003.h @@ -0,0 +1,22 @@ +/* + * py_h_0003.h - 지급 레코드/뷰 구조 정의 + */ +#ifndef PY_H_0003_H +#define PY_H_0003_H + +/* 지급 처리 뷰 레코드 */ +typedef struct { + char key[16]; + char merch_id[16]; + long amount; + long fee; + char biz_date[9]; + char status[2]; + char reserved[16]; +} py_h_0003_view_t; + +#define PY_H_0003_STATUS_OPEN "O" +#define PY_H_0003_STATUS_HOLD "H" +#define PY_H_0003_STATUS_CLOSE "C" + +#endif /* PY_H_0003_H */ diff --git a/app/include/py_h_0004.h b/app/include/py_h_0004.h new file mode 100644 index 0000000..1c25013 --- /dev/null +++ b/app/include/py_h_0004.h @@ -0,0 +1,13 @@ +/* + * py_h_0004.h - 지급 내부 헬퍼 선언 + */ +#ifndef PY_H_0004_H +#define PY_H_0004_H + +#include "txcore.h" + +int py_h_0004_check(const char *key, long amount); +int py_h_0004_apply(TXBUF *in, TXBUF *out); +long py_h_0004_eval(long amount, int factor); + +#endif /* PY_H_0004_H */ diff --git a/app/include/py_h_0005.h b/app/include/py_h_0005.h new file mode 100644 index 0000000..eb79720 --- /dev/null +++ b/app/include/py_h_0005.h @@ -0,0 +1,20 @@ +/* + * py_h_0005.h - 지급 코드/상수 테이블 + */ +#ifndef PY_H_0005_H +#define PY_H_0005_H + +#define PY_H_0005_RC_OK 0 +#define PY_H_0005_RC_RETRY 1 +#define PY_H_0005_RC_SKIP 2 +#define PY_H_0005_RC_ERROR 9 + +#define PY_H_0005_LIMIT_DAILY 100000000L +#define PY_H_0005_LIMIT_SINGLE 50000000L +#define PY_H_0005_FEE_RATE_BP 250 /* 2.50% */ + +#define PY_H_0005_CHAN_ONLINE "01" +#define PY_H_0005_CHAN_BATCH "02" +#define PY_H_0005_CHAN_RECON "03" + +#endif /* PY_H_0005_H */ diff --git a/app/include/py_h_0006.h b/app/include/py_h_0006.h new file mode 100644 index 0000000..6566063 --- /dev/null +++ b/app/include/py_h_0006.h @@ -0,0 +1,19 @@ +/* + * py_h_0006.h - 지급 고정길이 전문 레이아웃 (positional, 재배치 금지) + */ +#ifndef PY_H_0006_H +#define PY_H_0006_H + +typedef struct { + char msg_type[4]; /* 전문구분 4 */ + char merch_id[15]; /* 가맹점번호 15 */ + char key[9]; /* 처리키 9 */ + char amount[12]; /* 금액 12 zero-pad */ + char biz_date[8]; /* 영업일 8 */ + char resp_code[4]; /* 응답코드 4 */ + char filler[20]; /* 예비 20 */ +} py_h_0006_msg_t; + +#define PY_H_0006_MSG_LEN ((int)sizeof(py_h_0006_msg_t)) + +#endif /* PY_H_0006_H */ diff --git a/app/include/py_h_0007.h b/app/include/py_h_0007.h new file mode 100644 index 0000000..f0ab7bb --- /dev/null +++ b/app/include/py_h_0007.h @@ -0,0 +1,22 @@ +/* + * py_h_0007.h - 지급 레코드/뷰 구조 정의 + */ +#ifndef PY_H_0007_H +#define PY_H_0007_H + +/* 지급 처리 뷰 레코드 */ +typedef struct { + char key[16]; + char merch_id[16]; + long amount; + long fee; + char biz_date[9]; + char status[2]; + char reserved[16]; +} py_h_0007_view_t; + +#define PY_H_0007_STATUS_OPEN "O" +#define PY_H_0007_STATUS_HOLD "H" +#define PY_H_0007_STATUS_CLOSE "C" + +#endif /* PY_H_0007_H */ diff --git a/app/include/py_h_0008.h b/app/include/py_h_0008.h new file mode 100644 index 0000000..94bc018 --- /dev/null +++ b/app/include/py_h_0008.h @@ -0,0 +1,13 @@ +/* + * py_h_0008.h - 지급 내부 헬퍼 선언 + */ +#ifndef PY_H_0008_H +#define PY_H_0008_H + +#include "txcore.h" + +int py_h_0008_check(const char *key, long amount); +int py_h_0008_apply(TXBUF *in, TXBUF *out); +long py_h_0008_eval(long amount, int factor); + +#endif /* PY_H_0008_H */ diff --git a/app/include/py_h_0009.h b/app/include/py_h_0009.h new file mode 100644 index 0000000..81a7f96 --- /dev/null +++ b/app/include/py_h_0009.h @@ -0,0 +1,20 @@ +/* + * py_h_0009.h - 지급 코드/상수 테이블 + */ +#ifndef PY_H_0009_H +#define PY_H_0009_H + +#define PY_H_0009_RC_OK 0 +#define PY_H_0009_RC_RETRY 1 +#define PY_H_0009_RC_SKIP 2 +#define PY_H_0009_RC_ERROR 9 + +#define PY_H_0009_LIMIT_DAILY 100000000L +#define PY_H_0009_LIMIT_SINGLE 50000000L +#define PY_H_0009_FEE_RATE_BP 250 /* 2.50% */ + +#define PY_H_0009_CHAN_ONLINE "01" +#define PY_H_0009_CHAN_BATCH "02" +#define PY_H_0009_CHAN_RECON "03" + +#endif /* PY_H_0009_H */ diff --git a/app/include/py_h_0010.h b/app/include/py_h_0010.h new file mode 100644 index 0000000..382d816 --- /dev/null +++ b/app/include/py_h_0010.h @@ -0,0 +1,19 @@ +/* + * py_h_0010.h - 지급 고정길이 전문 레이아웃 (positional, 재배치 금지) + */ +#ifndef PY_H_0010_H +#define PY_H_0010_H + +typedef struct { + char msg_type[4]; /* 전문구분 4 */ + char merch_id[15]; /* 가맹점번호 15 */ + char key[9]; /* 처리키 9 */ + char amount[12]; /* 금액 12 zero-pad */ + char biz_date[8]; /* 영업일 8 */ + char resp_code[4]; /* 응답코드 4 */ + char filler[20]; /* 예비 20 */ +} py_h_0010_msg_t; + +#define PY_H_0010_MSG_LEN ((int)sizeof(py_h_0010_msg_t)) + +#endif /* PY_H_0010_H */ diff --git a/app/include/py_h_0011.h b/app/include/py_h_0011.h new file mode 100644 index 0000000..1cc72a7 --- /dev/null +++ b/app/include/py_h_0011.h @@ -0,0 +1,22 @@ +/* + * py_h_0011.h - 지급 레코드/뷰 구조 정의 + */ +#ifndef PY_H_0011_H +#define PY_H_0011_H + +/* 지급 처리 뷰 레코드 */ +typedef struct { + char key[16]; + char merch_id[16]; + long amount; + long fee; + char biz_date[9]; + char status[2]; + char reserved[16]; +} py_h_0011_view_t; + +#define PY_H_0011_STATUS_OPEN "O" +#define PY_H_0011_STATUS_HOLD "H" +#define PY_H_0011_STATUS_CLOSE "C" + +#endif /* PY_H_0011_H */ diff --git a/app/include/py_h_0012.h b/app/include/py_h_0012.h new file mode 100644 index 0000000..7cba307 --- /dev/null +++ b/app/include/py_h_0012.h @@ -0,0 +1,13 @@ +/* + * py_h_0012.h - 지급 내부 헬퍼 선언 + */ +#ifndef PY_H_0012_H +#define PY_H_0012_H + +#include "txcore.h" + +int py_h_0012_check(const char *key, long amount); +int py_h_0012_apply(TXBUF *in, TXBUF *out); +long py_h_0012_eval(long amount, int factor); + +#endif /* PY_H_0012_H */ diff --git a/app/include/py_h_0013.h b/app/include/py_h_0013.h new file mode 100644 index 0000000..ad7208d --- /dev/null +++ b/app/include/py_h_0013.h @@ -0,0 +1,20 @@ +/* + * py_h_0013.h - 지급 코드/상수 테이블 + */ +#ifndef PY_H_0013_H +#define PY_H_0013_H + +#define PY_H_0013_RC_OK 0 +#define PY_H_0013_RC_RETRY 1 +#define PY_H_0013_RC_SKIP 2 +#define PY_H_0013_RC_ERROR 9 + +#define PY_H_0013_LIMIT_DAILY 100000000L +#define PY_H_0013_LIMIT_SINGLE 50000000L +#define PY_H_0013_FEE_RATE_BP 250 /* 2.50% */ + +#define PY_H_0013_CHAN_ONLINE "01" +#define PY_H_0013_CHAN_BATCH "02" +#define PY_H_0013_CHAN_RECON "03" + +#endif /* PY_H_0013_H */ diff --git a/app/include/py_h_0014.h b/app/include/py_h_0014.h new file mode 100644 index 0000000..1eb4951 --- /dev/null +++ b/app/include/py_h_0014.h @@ -0,0 +1,19 @@ +/* + * py_h_0014.h - 지급 고정길이 전문 레이아웃 (positional, 재배치 금지) + */ +#ifndef PY_H_0014_H +#define PY_H_0014_H + +typedef struct { + char msg_type[4]; /* 전문구분 4 */ + char merch_id[15]; /* 가맹점번호 15 */ + char key[9]; /* 처리키 9 */ + char amount[12]; /* 금액 12 zero-pad */ + char biz_date[8]; /* 영업일 8 */ + char resp_code[4]; /* 응답코드 4 */ + char filler[20]; /* 예비 20 */ +} py_h_0014_msg_t; + +#define PY_H_0014_MSG_LEN ((int)sizeof(py_h_0014_msg_t)) + +#endif /* PY_H_0014_H */ diff --git a/app/include/py_h_0015.h b/app/include/py_h_0015.h new file mode 100644 index 0000000..a780fcb --- /dev/null +++ b/app/include/py_h_0015.h @@ -0,0 +1,22 @@ +/* + * py_h_0015.h - 지급 레코드/뷰 구조 정의 + */ +#ifndef PY_H_0015_H +#define PY_H_0015_H + +/* 지급 처리 뷰 레코드 */ +typedef struct { + char key[16]; + char merch_id[16]; + long amount; + long fee; + char biz_date[9]; + char status[2]; + char reserved[16]; +} py_h_0015_view_t; + +#define PY_H_0015_STATUS_OPEN "O" +#define PY_H_0015_STATUS_HOLD "H" +#define PY_H_0015_STATUS_CLOSE "C" + +#endif /* PY_H_0015_H */ diff --git a/app/include/py_h_0016.h b/app/include/py_h_0016.h new file mode 100644 index 0000000..3e8cb4b --- /dev/null +++ b/app/include/py_h_0016.h @@ -0,0 +1,13 @@ +/* + * py_h_0016.h - 지급 내부 헬퍼 선언 + */ +#ifndef PY_H_0016_H +#define PY_H_0016_H + +#include "txcore.h" + +int py_h_0016_check(const char *key, long amount); +int py_h_0016_apply(TXBUF *in, TXBUF *out); +long py_h_0016_eval(long amount, int factor); + +#endif /* PY_H_0016_H */ diff --git a/app/include/py_io_0001.h b/app/include/py_io_0001.h new file mode 100644 index 0000000..1851518 --- /dev/null +++ b/app/include/py_io_0001.h @@ -0,0 +1,14 @@ +/* + * py_io_0001.h - 지급 보조 DBIO 선언 (py_io_0001.pgc 구현) + */ +#ifndef PY_IO_0001_H +#define PY_IO_0001_H + +#include "txcore.h" + +/* py_io_0001 전용 조회/갱신 (테이블 py_io_0001_t) */ +int py_io_0001_fetch(const char *key, long *out_amount); +int py_io_0001_touch(const char *key, long amount); +long py_io_0001_total(const char *biz_date); + +#endif /* PY_IO_0001_H */ diff --git a/app/include/py_io_0002.h b/app/include/py_io_0002.h new file mode 100644 index 0000000..c13756d --- /dev/null +++ b/app/include/py_io_0002.h @@ -0,0 +1,14 @@ +/* + * py_io_0002.h - 지급 보조 DBIO 선언 (py_io_0002.pgc 구현) + */ +#ifndef PY_IO_0002_H +#define PY_IO_0002_H + +#include "txcore.h" + +/* py_io_0002 전용 조회/갱신 (테이블 py_io_0002_t) */ +int py_io_0002_fetch(const char *key, long *out_amount); +int py_io_0002_touch(const char *key, long amount); +long py_io_0002_total(const char *biz_date); + +#endif /* PY_IO_0002_H */ diff --git a/app/include/py_io_0003.h b/app/include/py_io_0003.h new file mode 100644 index 0000000..3102d96 --- /dev/null +++ b/app/include/py_io_0003.h @@ -0,0 +1,14 @@ +/* + * py_io_0003.h - 지급 보조 DBIO 선언 (py_io_0003.pgc 구현) + */ +#ifndef PY_IO_0003_H +#define PY_IO_0003_H + +#include "txcore.h" + +/* py_io_0003 전용 조회/갱신 (테이블 py_io_0003_t) */ +int py_io_0003_fetch(const char *key, long *out_amount); +int py_io_0003_touch(const char *key, long amount); +long py_io_0003_total(const char *biz_date); + +#endif /* PY_IO_0003_H */ diff --git a/app/include/py_io_0004.h b/app/include/py_io_0004.h new file mode 100644 index 0000000..65bd2e2 --- /dev/null +++ b/app/include/py_io_0004.h @@ -0,0 +1,14 @@ +/* + * py_io_0004.h - 지급 보조 DBIO 선언 (py_io_0004.pgc 구현) + */ +#ifndef PY_IO_0004_H +#define PY_IO_0004_H + +#include "txcore.h" + +/* py_io_0004 전용 조회/갱신 (테이블 py_io_0004_t) */ +int py_io_0004_fetch(const char *key, long *out_amount); +int py_io_0004_touch(const char *key, long amount); +long py_io_0004_total(const char *biz_date); + +#endif /* PY_IO_0004_H */ diff --git a/app/include/py_io_0005.h b/app/include/py_io_0005.h new file mode 100644 index 0000000..d06a9ca --- /dev/null +++ b/app/include/py_io_0005.h @@ -0,0 +1,14 @@ +/* + * py_io_0005.h - 지급 보조 DBIO 선언 (py_io_0005.pgc 구현) + */ +#ifndef PY_IO_0005_H +#define PY_IO_0005_H + +#include "txcore.h" + +/* py_io_0005 전용 조회/갱신 (테이블 py_io_0005_t) */ +int py_io_0005_fetch(const char *key, long *out_amount); +int py_io_0005_touch(const char *key, long amount); +long py_io_0005_total(const char *biz_date); + +#endif /* PY_IO_0005_H */ diff --git a/app/include/py_io_0006.h b/app/include/py_io_0006.h new file mode 100644 index 0000000..0a24179 --- /dev/null +++ b/app/include/py_io_0006.h @@ -0,0 +1,14 @@ +/* + * py_io_0006.h - 지급 보조 DBIO 선언 (py_io_0006.pgc 구현) + */ +#ifndef PY_IO_0006_H +#define PY_IO_0006_H + +#include "txcore.h" + +/* py_io_0006 전용 조회/갱신 (테이블 py_io_0006_t) */ +int py_io_0006_fetch(const char *key, long *out_amount); +int py_io_0006_touch(const char *key, long amount); +long py_io_0006_total(const char *biz_date); + +#endif /* PY_IO_0006_H */ diff --git a/app/include/py_io_0007.h b/app/include/py_io_0007.h new file mode 100644 index 0000000..9a1ac8a --- /dev/null +++ b/app/include/py_io_0007.h @@ -0,0 +1,14 @@ +/* + * py_io_0007.h - 지급 보조 DBIO 선언 (py_io_0007.pgc 구현) + */ +#ifndef PY_IO_0007_H +#define PY_IO_0007_H + +#include "txcore.h" + +/* py_io_0007 전용 조회/갱신 (테이블 py_io_0007_t) */ +int py_io_0007_fetch(const char *key, long *out_amount); +int py_io_0007_touch(const char *key, long amount); +long py_io_0007_total(const char *biz_date); + +#endif /* PY_IO_0007_H */ diff --git a/app/include/py_io_0008.h b/app/include/py_io_0008.h new file mode 100644 index 0000000..97cff7f --- /dev/null +++ b/app/include/py_io_0008.h @@ -0,0 +1,14 @@ +/* + * py_io_0008.h - 지급 보조 DBIO 선언 (py_io_0008.pgc 구현) + */ +#ifndef PY_IO_0008_H +#define PY_IO_0008_H + +#include "txcore.h" + +/* py_io_0008 전용 조회/갱신 (테이블 py_io_0008_t) */ +int py_io_0008_fetch(const char *key, long *out_amount); +int py_io_0008_touch(const char *key, long amount); +long py_io_0008_total(const char *biz_date); + +#endif /* PY_IO_0008_H */ diff --git a/app/include/py_io_0009.h b/app/include/py_io_0009.h new file mode 100644 index 0000000..f69d891 --- /dev/null +++ b/app/include/py_io_0009.h @@ -0,0 +1,14 @@ +/* + * py_io_0009.h - 지급 보조 DBIO 선언 (py_io_0009.pgc 구현) + */ +#ifndef PY_IO_0009_H +#define PY_IO_0009_H + +#include "txcore.h" + +/* py_io_0009 전용 조회/갱신 (테이블 py_io_0009_t) */ +int py_io_0009_fetch(const char *key, long *out_amount); +int py_io_0009_touch(const char *key, long amount); +long py_io_0009_total(const char *biz_date); + +#endif /* PY_IO_0009_H */ diff --git a/app/include/py_io_0010.h b/app/include/py_io_0010.h new file mode 100644 index 0000000..1eda508 --- /dev/null +++ b/app/include/py_io_0010.h @@ -0,0 +1,14 @@ +/* + * py_io_0010.h - 지급 보조 DBIO 선언 (py_io_0010.pgc 구현) + */ +#ifndef PY_IO_0010_H +#define PY_IO_0010_H + +#include "txcore.h" + +/* py_io_0010 전용 조회/갱신 (테이블 py_io_0010_t) */ +int py_io_0010_fetch(const char *key, long *out_amount); +int py_io_0010_touch(const char *key, long amount); +long py_io_0010_total(const char *biz_date); + +#endif /* PY_IO_0010_H */ diff --git a/app/include/py_io_0011.h b/app/include/py_io_0011.h new file mode 100644 index 0000000..902e123 --- /dev/null +++ b/app/include/py_io_0011.h @@ -0,0 +1,14 @@ +/* + * py_io_0011.h - 지급 보조 DBIO 선언 (py_io_0011.pgc 구현) + */ +#ifndef PY_IO_0011_H +#define PY_IO_0011_H + +#include "txcore.h" + +/* py_io_0011 전용 조회/갱신 (테이블 py_io_0011_t) */ +int py_io_0011_fetch(const char *key, long *out_amount); +int py_io_0011_touch(const char *key, long amount); +long py_io_0011_total(const char *biz_date); + +#endif /* PY_IO_0011_H */ diff --git a/app/include/py_io_0012.h b/app/include/py_io_0012.h new file mode 100644 index 0000000..f6be5fb --- /dev/null +++ b/app/include/py_io_0012.h @@ -0,0 +1,14 @@ +/* + * py_io_0012.h - 지급 보조 DBIO 선언 (py_io_0012.pgc 구현) + */ +#ifndef PY_IO_0012_H +#define PY_IO_0012_H + +#include "txcore.h" + +/* py_io_0012 전용 조회/갱신 (테이블 py_io_0012_t) */ +int py_io_0012_fetch(const char *key, long *out_amount); +int py_io_0012_touch(const char *key, long amount); +long py_io_0012_total(const char *biz_date); + +#endif /* PY_IO_0012_H */ diff --git a/app/include/py_io_0013.h b/app/include/py_io_0013.h new file mode 100644 index 0000000..287eea0 --- /dev/null +++ b/app/include/py_io_0013.h @@ -0,0 +1,14 @@ +/* + * py_io_0013.h - 지급 보조 DBIO 선언 (py_io_0013.pgc 구현) + */ +#ifndef PY_IO_0013_H +#define PY_IO_0013_H + +#include "txcore.h" + +/* py_io_0013 전용 조회/갱신 (테이블 py_io_0013_t) */ +int py_io_0013_fetch(const char *key, long *out_amount); +int py_io_0013_touch(const char *key, long amount); +long py_io_0013_total(const char *biz_date); + +#endif /* PY_IO_0013_H */ diff --git a/app/include/py_io_0014.h b/app/include/py_io_0014.h new file mode 100644 index 0000000..219589a --- /dev/null +++ b/app/include/py_io_0014.h @@ -0,0 +1,14 @@ +/* + * py_io_0014.h - 지급 보조 DBIO 선언 (py_io_0014.pgc 구현) + */ +#ifndef PY_IO_0014_H +#define PY_IO_0014_H + +#include "txcore.h" + +/* py_io_0014 전용 조회/갱신 (테이블 py_io_0014_t) */ +int py_io_0014_fetch(const char *key, long *out_amount); +int py_io_0014_touch(const char *key, long amount); +long py_io_0014_total(const char *biz_date); + +#endif /* PY_IO_0014_H */ diff --git a/app/include/py_io_0015.h b/app/include/py_io_0015.h new file mode 100644 index 0000000..29464c7 --- /dev/null +++ b/app/include/py_io_0015.h @@ -0,0 +1,14 @@ +/* + * py_io_0015.h - 지급 보조 DBIO 선언 (py_io_0015.pgc 구현) + */ +#ifndef PY_IO_0015_H +#define PY_IO_0015_H + +#include "txcore.h" + +/* py_io_0015 전용 조회/갱신 (테이블 py_io_0015_t) */ +int py_io_0015_fetch(const char *key, long *out_amount); +int py_io_0015_touch(const char *key, long amount); +long py_io_0015_total(const char *biz_date); + +#endif /* PY_IO_0015_H */ diff --git a/app/include/py_io_0016.h b/app/include/py_io_0016.h new file mode 100644 index 0000000..9101d41 --- /dev/null +++ b/app/include/py_io_0016.h @@ -0,0 +1,14 @@ +/* + * py_io_0016.h - 지급 보조 DBIO 선언 (py_io_0016.pgc 구현) + */ +#ifndef PY_IO_0016_H +#define PY_IO_0016_H + +#include "txcore.h" + +/* py_io_0016 전용 조회/갱신 (테이블 py_io_0016_t) */ +int py_io_0016_fetch(const char *key, long *out_amount); +int py_io_0016_touch(const char *key, long amount); +long py_io_0016_total(const char *biz_date); + +#endif /* PY_IO_0016_H */ diff --git a/app/include/py_io_0017.h b/app/include/py_io_0017.h new file mode 100644 index 0000000..cbc7171 --- /dev/null +++ b/app/include/py_io_0017.h @@ -0,0 +1,14 @@ +/* + * py_io_0017.h - 지급 보조 DBIO 선언 (py_io_0017.pgc 구현) + */ +#ifndef PY_IO_0017_H +#define PY_IO_0017_H + +#include "txcore.h" + +/* py_io_0017 전용 조회/갱신 (테이블 py_io_0017_t) */ +int py_io_0017_fetch(const char *key, long *out_amount); +int py_io_0017_touch(const char *key, long amount); +long py_io_0017_total(const char *biz_date); + +#endif /* PY_IO_0017_H */ diff --git a/app/include/py_io_0018.h b/app/include/py_io_0018.h new file mode 100644 index 0000000..81beae1 --- /dev/null +++ b/app/include/py_io_0018.h @@ -0,0 +1,14 @@ +/* + * py_io_0018.h - 지급 보조 DBIO 선언 (py_io_0018.pgc 구현) + */ +#ifndef PY_IO_0018_H +#define PY_IO_0018_H + +#include "txcore.h" + +/* py_io_0018 전용 조회/갱신 (테이블 py_io_0018_t) */ +int py_io_0018_fetch(const char *key, long *out_amount); +int py_io_0018_touch(const char *key, long amount); +long py_io_0018_total(const char *biz_date); + +#endif /* PY_IO_0018_H */ diff --git a/app/include/py_io_0019.h b/app/include/py_io_0019.h new file mode 100644 index 0000000..bc7e9d6 --- /dev/null +++ b/app/include/py_io_0019.h @@ -0,0 +1,14 @@ +/* + * py_io_0019.h - 지급 보조 DBIO 선언 (py_io_0019.pgc 구현) + */ +#ifndef PY_IO_0019_H +#define PY_IO_0019_H + +#include "txcore.h" + +/* py_io_0019 전용 조회/갱신 (테이블 py_io_0019_t) */ +int py_io_0019_fetch(const char *key, long *out_amount); +int py_io_0019_touch(const char *key, long amount); +long py_io_0019_total(const char *biz_date); + +#endif /* PY_IO_0019_H */ diff --git a/app/include/py_io_0020.h b/app/include/py_io_0020.h new file mode 100644 index 0000000..51a8cf7 --- /dev/null +++ b/app/include/py_io_0020.h @@ -0,0 +1,14 @@ +/* + * py_io_0020.h - 지급 보조 DBIO 선언 (py_io_0020.pgc 구현) + */ +#ifndef PY_IO_0020_H +#define PY_IO_0020_H + +#include "txcore.h" + +/* py_io_0020 전용 조회/갱신 (테이블 py_io_0020_t) */ +int py_io_0020_fetch(const char *key, long *out_amount); +int py_io_0020_touch(const char *key, long amount); +long py_io_0020_total(const char *biz_date); + +#endif /* PY_IO_0020_H */ diff --git a/app/include/py_io_0021.h b/app/include/py_io_0021.h new file mode 100644 index 0000000..c2a8397 --- /dev/null +++ b/app/include/py_io_0021.h @@ -0,0 +1,14 @@ +/* + * py_io_0021.h - 지급 보조 DBIO 선언 (py_io_0021.pgc 구현) + */ +#ifndef PY_IO_0021_H +#define PY_IO_0021_H + +#include "txcore.h" + +/* py_io_0021 전용 조회/갱신 (테이블 py_io_0021_t) */ +int py_io_0021_fetch(const char *key, long *out_amount); +int py_io_0021_touch(const char *key, long amount); +long py_io_0021_total(const char *biz_date); + +#endif /* PY_IO_0021_H */ diff --git a/app/include/py_io_0022.h b/app/include/py_io_0022.h new file mode 100644 index 0000000..b553261 --- /dev/null +++ b/app/include/py_io_0022.h @@ -0,0 +1,14 @@ +/* + * py_io_0022.h - 지급 보조 DBIO 선언 (py_io_0022.pgc 구현) + */ +#ifndef PY_IO_0022_H +#define PY_IO_0022_H + +#include "txcore.h" + +/* py_io_0022 전용 조회/갱신 (테이블 py_io_0022_t) */ +int py_io_0022_fetch(const char *key, long *out_amount); +int py_io_0022_touch(const char *key, long amount); +long py_io_0022_total(const char *biz_date); + +#endif /* PY_IO_0022_H */ diff --git a/app/include/py_io_0023.h b/app/include/py_io_0023.h new file mode 100644 index 0000000..465528b --- /dev/null +++ b/app/include/py_io_0023.h @@ -0,0 +1,14 @@ +/* + * py_io_0023.h - 지급 보조 DBIO 선언 (py_io_0023.pgc 구현) + */ +#ifndef PY_IO_0023_H +#define PY_IO_0023_H + +#include "txcore.h" + +/* py_io_0023 전용 조회/갱신 (테이블 py_io_0023_t) */ +int py_io_0023_fetch(const char *key, long *out_amount); +int py_io_0023_touch(const char *key, long amount); +long py_io_0023_total(const char *biz_date); + +#endif /* PY_IO_0023_H */ diff --git a/app/include/py_io_0024.h b/app/include/py_io_0024.h new file mode 100644 index 0000000..6fe71b6 --- /dev/null +++ b/app/include/py_io_0024.h @@ -0,0 +1,14 @@ +/* + * py_io_0024.h - 지급 보조 DBIO 선언 (py_io_0024.pgc 구현) + */ +#ifndef PY_IO_0024_H +#define PY_IO_0024_H + +#include "txcore.h" + +/* py_io_0024 전용 조회/갱신 (테이블 py_io_0024_t) */ +int py_io_0024_fetch(const char *key, long *out_amount); +int py_io_0024_touch(const char *key, long amount); +long py_io_0024_total(const char *biz_date); + +#endif /* PY_IO_0024_H */ diff --git a/app/include/py_io_0025.h b/app/include/py_io_0025.h new file mode 100644 index 0000000..a7bf08f --- /dev/null +++ b/app/include/py_io_0025.h @@ -0,0 +1,14 @@ +/* + * py_io_0025.h - 지급 보조 DBIO 선언 (py_io_0025.pgc 구현) + */ +#ifndef PY_IO_0025_H +#define PY_IO_0025_H + +#include "txcore.h" + +/* py_io_0025 전용 조회/갱신 (테이블 py_io_0025_t) */ +int py_io_0025_fetch(const char *key, long *out_amount); +int py_io_0025_touch(const char *key, long amount); +long py_io_0025_total(const char *biz_date); + +#endif /* PY_IO_0025_H */ diff --git a/app/include/py_io_0026.h b/app/include/py_io_0026.h new file mode 100644 index 0000000..0ef826d --- /dev/null +++ b/app/include/py_io_0026.h @@ -0,0 +1,14 @@ +/* + * py_io_0026.h - 지급 보조 DBIO 선언 (py_io_0026.pgc 구현) + */ +#ifndef PY_IO_0026_H +#define PY_IO_0026_H + +#include "txcore.h" + +/* py_io_0026 전용 조회/갱신 (테이블 py_io_0026_t) */ +int py_io_0026_fetch(const char *key, long *out_amount); +int py_io_0026_touch(const char *key, long amount); +long py_io_0026_total(const char *biz_date); + +#endif /* PY_IO_0026_H */ diff --git a/app/include/rc_core.h b/app/include/rc_core.h new file mode 100644 index 0000000..d4fbdb3 --- /dev/null +++ b/app/include/rc_core.h @@ -0,0 +1,38 @@ +/* + * rc_core.h - 대사 모듈 핵심 계약 (레코드/상태/표준 DBIO API) + * + * 이 모듈의 온라인/배치 프로그램은 SQL 을 직접 다루지 않고 아래 표준 + * DBIO API 만 호출한다. 구현은 app/dbio/rc_dbio_main.pgc (ECPG). + */ +#ifndef RC_CORE_H +#define RC_CORE_H + +#include "txcore.h" + +/* 대사 처리 상태코드 */ +#define RC_ST_RECV "R" /* 접수/수신 */ +#define RC_ST_DONE "M" /* 처리완료 */ +#define RC_ST_FAIL "U" /* 불일치/실패 */ +#define RC_ST_SETTLED "S" /* 정산완료 */ + +/* 대사 원장 레코드 (1행) */ +typedef struct { + char key[16]; /* 처리키(승인/거래 번호) PK */ + char merch_id[16]; /* 가맹점번호 */ + char card_no[20]; /* 카드번호(마스킹) */ + long amount; /* 거래금액(원) */ + char biz_date[9]; /* 영업일 YYYYMMDD */ + char status[2]; /* 상태코드 */ + long fee; /* 수수료(원) */ +} rc_rec_t; + +/* 표준 DBIO API (구현: rc_dbio_main.pgc) */ +int rc_dbio_connect(const char *target); +int rc_dbio_disconnect(void); +int rc_rec_insert(const rc_rec_t *rec); +int rc_rec_select(const char *key, rc_rec_t *out); +int rc_rec_update_status(const char *key, const char *status); +long rc_rec_count(const char *biz_date, const char *status); +int rc_rec_sum(const char *biz_date, long *out_sum); + +#endif /* RC_CORE_H */ diff --git a/app/include/rc_cu_0001.h b/app/include/rc_cu_0001.h new file mode 100644 index 0000000..d485687 --- /dev/null +++ b/app/include/rc_cu_0001.h @@ -0,0 +1,11 @@ +/* + * rc_cu_0001.h - 대사 공통 유틸 선언 (rc_cu_0001.c 구현) + */ +#ifndef RC_CU_0001_H +#define RC_CU_0001_H + +long rc_cu_0001_fee(long amount, int rate_bp); +long rc_cu_0001_round_unit(long amount, long unit); +int rc_cu_0001_classify(long amount); + +#endif /* RC_CU_0001_H */ diff --git a/app/include/rc_cu_0002.h b/app/include/rc_cu_0002.h new file mode 100644 index 0000000..fdcb3fa --- /dev/null +++ b/app/include/rc_cu_0002.h @@ -0,0 +1,11 @@ +/* + * rc_cu_0002.h - 대사 공통 유틸 선언 (rc_cu_0002.c 구현) + */ +#ifndef RC_CU_0002_H +#define RC_CU_0002_H + +long rc_cu_0002_fee(long amount, int rate_bp); +long rc_cu_0002_round_unit(long amount, long unit); +int rc_cu_0002_classify(long amount); + +#endif /* RC_CU_0002_H */ diff --git a/app/include/rc_cu_0003.h b/app/include/rc_cu_0003.h new file mode 100644 index 0000000..61608ed --- /dev/null +++ b/app/include/rc_cu_0003.h @@ -0,0 +1,11 @@ +/* + * rc_cu_0003.h - 대사 공통 유틸 선언 (rc_cu_0003.c 구현) + */ +#ifndef RC_CU_0003_H +#define RC_CU_0003_H + +long rc_cu_0003_fee(long amount, int rate_bp); +long rc_cu_0003_round_unit(long amount, long unit); +int rc_cu_0003_classify(long amount); + +#endif /* RC_CU_0003_H */ diff --git a/app/include/rc_cu_0004.h b/app/include/rc_cu_0004.h new file mode 100644 index 0000000..017bea3 --- /dev/null +++ b/app/include/rc_cu_0004.h @@ -0,0 +1,11 @@ +/* + * rc_cu_0004.h - 대사 공통 유틸 선언 (rc_cu_0004.c 구현) + */ +#ifndef RC_CU_0004_H +#define RC_CU_0004_H + +long rc_cu_0004_fee(long amount, int rate_bp); +long rc_cu_0004_round_unit(long amount, long unit); +int rc_cu_0004_classify(long amount); + +#endif /* RC_CU_0004_H */ diff --git a/app/include/rc_cu_0005.h b/app/include/rc_cu_0005.h new file mode 100644 index 0000000..8ac83ae --- /dev/null +++ b/app/include/rc_cu_0005.h @@ -0,0 +1,11 @@ +/* + * rc_cu_0005.h - 대사 공통 유틸 선언 (rc_cu_0005.c 구현) + */ +#ifndef RC_CU_0005_H +#define RC_CU_0005_H + +long rc_cu_0005_fee(long amount, int rate_bp); +long rc_cu_0005_round_unit(long amount, long unit); +int rc_cu_0005_classify(long amount); + +#endif /* RC_CU_0005_H */ diff --git a/app/include/rc_cu_0006.h b/app/include/rc_cu_0006.h new file mode 100644 index 0000000..84dfba1 --- /dev/null +++ b/app/include/rc_cu_0006.h @@ -0,0 +1,11 @@ +/* + * rc_cu_0006.h - 대사 공통 유틸 선언 (rc_cu_0006.c 구현) + */ +#ifndef RC_CU_0006_H +#define RC_CU_0006_H + +long rc_cu_0006_fee(long amount, int rate_bp); +long rc_cu_0006_round_unit(long amount, long unit); +int rc_cu_0006_classify(long amount); + +#endif /* RC_CU_0006_H */ diff --git a/app/include/rc_cu_0007.h b/app/include/rc_cu_0007.h new file mode 100644 index 0000000..8c24327 --- /dev/null +++ b/app/include/rc_cu_0007.h @@ -0,0 +1,11 @@ +/* + * rc_cu_0007.h - 대사 공통 유틸 선언 (rc_cu_0007.c 구현) + */ +#ifndef RC_CU_0007_H +#define RC_CU_0007_H + +long rc_cu_0007_fee(long amount, int rate_bp); +long rc_cu_0007_round_unit(long amount, long unit); +int rc_cu_0007_classify(long amount); + +#endif /* RC_CU_0007_H */ diff --git a/app/include/rc_cu_0008.h b/app/include/rc_cu_0008.h new file mode 100644 index 0000000..50271d7 --- /dev/null +++ b/app/include/rc_cu_0008.h @@ -0,0 +1,11 @@ +/* + * rc_cu_0008.h - 대사 공통 유틸 선언 (rc_cu_0008.c 구현) + */ +#ifndef RC_CU_0008_H +#define RC_CU_0008_H + +long rc_cu_0008_fee(long amount, int rate_bp); +long rc_cu_0008_round_unit(long amount, long unit); +int rc_cu_0008_classify(long amount); + +#endif /* RC_CU_0008_H */ diff --git a/app/include/rc_cu_0009.h b/app/include/rc_cu_0009.h new file mode 100644 index 0000000..c157dd8 --- /dev/null +++ b/app/include/rc_cu_0009.h @@ -0,0 +1,11 @@ +/* + * rc_cu_0009.h - 대사 공통 유틸 선언 (rc_cu_0009.c 구현) + */ +#ifndef RC_CU_0009_H +#define RC_CU_0009_H + +long rc_cu_0009_fee(long amount, int rate_bp); +long rc_cu_0009_round_unit(long amount, long unit); +int rc_cu_0009_classify(long amount); + +#endif /* RC_CU_0009_H */ diff --git a/app/include/rc_cu_0010.h b/app/include/rc_cu_0010.h new file mode 100644 index 0000000..552827f --- /dev/null +++ b/app/include/rc_cu_0010.h @@ -0,0 +1,11 @@ +/* + * rc_cu_0010.h - 대사 공통 유틸 선언 (rc_cu_0010.c 구현) + */ +#ifndef RC_CU_0010_H +#define RC_CU_0010_H + +long rc_cu_0010_fee(long amount, int rate_bp); +long rc_cu_0010_round_unit(long amount, long unit); +int rc_cu_0010_classify(long amount); + +#endif /* RC_CU_0010_H */ diff --git a/app/include/rc_cu_0011.h b/app/include/rc_cu_0011.h new file mode 100644 index 0000000..6959010 --- /dev/null +++ b/app/include/rc_cu_0011.h @@ -0,0 +1,11 @@ +/* + * rc_cu_0011.h - 대사 공통 유틸 선언 (rc_cu_0011.c 구현) + */ +#ifndef RC_CU_0011_H +#define RC_CU_0011_H + +long rc_cu_0011_fee(long amount, int rate_bp); +long rc_cu_0011_round_unit(long amount, long unit); +int rc_cu_0011_classify(long amount); + +#endif /* RC_CU_0011_H */ diff --git a/app/include/rc_h_0001.h b/app/include/rc_h_0001.h new file mode 100644 index 0000000..4003dea --- /dev/null +++ b/app/include/rc_h_0001.h @@ -0,0 +1,13 @@ +/* + * rc_h_0001.h - 대사 내부 헬퍼 선언 + */ +#ifndef RC_H_0001_H +#define RC_H_0001_H + +#include "txcore.h" + +int rc_h_0001_check(const char *key, long amount); +int rc_h_0001_apply(TXBUF *in, TXBUF *out); +long rc_h_0001_eval(long amount, int factor); + +#endif /* RC_H_0001_H */ diff --git a/app/include/rc_h_0002.h b/app/include/rc_h_0002.h new file mode 100644 index 0000000..376056a --- /dev/null +++ b/app/include/rc_h_0002.h @@ -0,0 +1,20 @@ +/* + * rc_h_0002.h - 대사 코드/상수 테이블 + */ +#ifndef RC_H_0002_H +#define RC_H_0002_H + +#define RC_H_0002_RC_OK 0 +#define RC_H_0002_RC_RETRY 1 +#define RC_H_0002_RC_SKIP 2 +#define RC_H_0002_RC_ERROR 9 + +#define RC_H_0002_LIMIT_DAILY 100000000L +#define RC_H_0002_LIMIT_SINGLE 50000000L +#define RC_H_0002_FEE_RATE_BP 250 /* 2.50% */ + +#define RC_H_0002_CHAN_ONLINE "01" +#define RC_H_0002_CHAN_BATCH "02" +#define RC_H_0002_CHAN_RECON "03" + +#endif /* RC_H_0002_H */ diff --git a/app/include/rc_h_0003.h b/app/include/rc_h_0003.h new file mode 100644 index 0000000..25041c8 --- /dev/null +++ b/app/include/rc_h_0003.h @@ -0,0 +1,19 @@ +/* + * rc_h_0003.h - 대사 고정길이 전문 레이아웃 (positional, 재배치 금지) + */ +#ifndef RC_H_0003_H +#define RC_H_0003_H + +typedef struct { + char msg_type[4]; /* 전문구분 4 */ + char merch_id[15]; /* 가맹점번호 15 */ + char key[9]; /* 처리키 9 */ + char amount[12]; /* 금액 12 zero-pad */ + char biz_date[8]; /* 영업일 8 */ + char resp_code[4]; /* 응답코드 4 */ + char filler[20]; /* 예비 20 */ +} rc_h_0003_msg_t; + +#define RC_H_0003_MSG_LEN ((int)sizeof(rc_h_0003_msg_t)) + +#endif /* RC_H_0003_H */ diff --git a/app/include/rc_h_0004.h b/app/include/rc_h_0004.h new file mode 100644 index 0000000..1fa391a --- /dev/null +++ b/app/include/rc_h_0004.h @@ -0,0 +1,22 @@ +/* + * rc_h_0004.h - 대사 레코드/뷰 구조 정의 + */ +#ifndef RC_H_0004_H +#define RC_H_0004_H + +/* 대사 처리 뷰 레코드 */ +typedef struct { + char key[16]; + char merch_id[16]; + long amount; + long fee; + char biz_date[9]; + char status[2]; + char reserved[16]; +} rc_h_0004_view_t; + +#define RC_H_0004_STATUS_OPEN "O" +#define RC_H_0004_STATUS_HOLD "H" +#define RC_H_0004_STATUS_CLOSE "C" + +#endif /* RC_H_0004_H */ diff --git a/app/include/rc_h_0005.h b/app/include/rc_h_0005.h new file mode 100644 index 0000000..b8b7b09 --- /dev/null +++ b/app/include/rc_h_0005.h @@ -0,0 +1,13 @@ +/* + * rc_h_0005.h - 대사 내부 헬퍼 선언 + */ +#ifndef RC_H_0005_H +#define RC_H_0005_H + +#include "txcore.h" + +int rc_h_0005_check(const char *key, long amount); +int rc_h_0005_apply(TXBUF *in, TXBUF *out); +long rc_h_0005_eval(long amount, int factor); + +#endif /* RC_H_0005_H */ diff --git a/app/include/rc_h_0006.h b/app/include/rc_h_0006.h new file mode 100644 index 0000000..24054f1 --- /dev/null +++ b/app/include/rc_h_0006.h @@ -0,0 +1,20 @@ +/* + * rc_h_0006.h - 대사 코드/상수 테이블 + */ +#ifndef RC_H_0006_H +#define RC_H_0006_H + +#define RC_H_0006_RC_OK 0 +#define RC_H_0006_RC_RETRY 1 +#define RC_H_0006_RC_SKIP 2 +#define RC_H_0006_RC_ERROR 9 + +#define RC_H_0006_LIMIT_DAILY 100000000L +#define RC_H_0006_LIMIT_SINGLE 50000000L +#define RC_H_0006_FEE_RATE_BP 250 /* 2.50% */ + +#define RC_H_0006_CHAN_ONLINE "01" +#define RC_H_0006_CHAN_BATCH "02" +#define RC_H_0006_CHAN_RECON "03" + +#endif /* RC_H_0006_H */ diff --git a/app/include/rc_h_0007.h b/app/include/rc_h_0007.h new file mode 100644 index 0000000..d9149dd --- /dev/null +++ b/app/include/rc_h_0007.h @@ -0,0 +1,19 @@ +/* + * rc_h_0007.h - 대사 고정길이 전문 레이아웃 (positional, 재배치 금지) + */ +#ifndef RC_H_0007_H +#define RC_H_0007_H + +typedef struct { + char msg_type[4]; /* 전문구분 4 */ + char merch_id[15]; /* 가맹점번호 15 */ + char key[9]; /* 처리키 9 */ + char amount[12]; /* 금액 12 zero-pad */ + char biz_date[8]; /* 영업일 8 */ + char resp_code[4]; /* 응답코드 4 */ + char filler[20]; /* 예비 20 */ +} rc_h_0007_msg_t; + +#define RC_H_0007_MSG_LEN ((int)sizeof(rc_h_0007_msg_t)) + +#endif /* RC_H_0007_H */ diff --git a/app/include/rc_h_0008.h b/app/include/rc_h_0008.h new file mode 100644 index 0000000..82c20ba --- /dev/null +++ b/app/include/rc_h_0008.h @@ -0,0 +1,22 @@ +/* + * rc_h_0008.h - 대사 레코드/뷰 구조 정의 + */ +#ifndef RC_H_0008_H +#define RC_H_0008_H + +/* 대사 처리 뷰 레코드 */ +typedef struct { + char key[16]; + char merch_id[16]; + long amount; + long fee; + char biz_date[9]; + char status[2]; + char reserved[16]; +} rc_h_0008_view_t; + +#define RC_H_0008_STATUS_OPEN "O" +#define RC_H_0008_STATUS_HOLD "H" +#define RC_H_0008_STATUS_CLOSE "C" + +#endif /* RC_H_0008_H */ diff --git a/app/include/rc_h_0009.h b/app/include/rc_h_0009.h new file mode 100644 index 0000000..376f6bd --- /dev/null +++ b/app/include/rc_h_0009.h @@ -0,0 +1,13 @@ +/* + * rc_h_0009.h - 대사 내부 헬퍼 선언 + */ +#ifndef RC_H_0009_H +#define RC_H_0009_H + +#include "txcore.h" + +int rc_h_0009_check(const char *key, long amount); +int rc_h_0009_apply(TXBUF *in, TXBUF *out); +long rc_h_0009_eval(long amount, int factor); + +#endif /* RC_H_0009_H */ diff --git a/app/include/rc_h_0010.h b/app/include/rc_h_0010.h new file mode 100644 index 0000000..ffba080 --- /dev/null +++ b/app/include/rc_h_0010.h @@ -0,0 +1,20 @@ +/* + * rc_h_0010.h - 대사 코드/상수 테이블 + */ +#ifndef RC_H_0010_H +#define RC_H_0010_H + +#define RC_H_0010_RC_OK 0 +#define RC_H_0010_RC_RETRY 1 +#define RC_H_0010_RC_SKIP 2 +#define RC_H_0010_RC_ERROR 9 + +#define RC_H_0010_LIMIT_DAILY 100000000L +#define RC_H_0010_LIMIT_SINGLE 50000000L +#define RC_H_0010_FEE_RATE_BP 250 /* 2.50% */ + +#define RC_H_0010_CHAN_ONLINE "01" +#define RC_H_0010_CHAN_BATCH "02" +#define RC_H_0010_CHAN_RECON "03" + +#endif /* RC_H_0010_H */ diff --git a/app/include/rc_h_0011.h b/app/include/rc_h_0011.h new file mode 100644 index 0000000..07a3c4c --- /dev/null +++ b/app/include/rc_h_0011.h @@ -0,0 +1,19 @@ +/* + * rc_h_0011.h - 대사 고정길이 전문 레이아웃 (positional, 재배치 금지) + */ +#ifndef RC_H_0011_H +#define RC_H_0011_H + +typedef struct { + char msg_type[4]; /* 전문구분 4 */ + char merch_id[15]; /* 가맹점번호 15 */ + char key[9]; /* 처리키 9 */ + char amount[12]; /* 금액 12 zero-pad */ + char biz_date[8]; /* 영업일 8 */ + char resp_code[4]; /* 응답코드 4 */ + char filler[20]; /* 예비 20 */ +} rc_h_0011_msg_t; + +#define RC_H_0011_MSG_LEN ((int)sizeof(rc_h_0011_msg_t)) + +#endif /* RC_H_0011_H */ diff --git a/app/include/rc_h_0012.h b/app/include/rc_h_0012.h new file mode 100644 index 0000000..bc5ce6d --- /dev/null +++ b/app/include/rc_h_0012.h @@ -0,0 +1,22 @@ +/* + * rc_h_0012.h - 대사 레코드/뷰 구조 정의 + */ +#ifndef RC_H_0012_H +#define RC_H_0012_H + +/* 대사 처리 뷰 레코드 */ +typedef struct { + char key[16]; + char merch_id[16]; + long amount; + long fee; + char biz_date[9]; + char status[2]; + char reserved[16]; +} rc_h_0012_view_t; + +#define RC_H_0012_STATUS_OPEN "O" +#define RC_H_0012_STATUS_HOLD "H" +#define RC_H_0012_STATUS_CLOSE "C" + +#endif /* RC_H_0012_H */ diff --git a/app/include/rc_h_0013.h b/app/include/rc_h_0013.h new file mode 100644 index 0000000..a1cc9a6 --- /dev/null +++ b/app/include/rc_h_0013.h @@ -0,0 +1,13 @@ +/* + * rc_h_0013.h - 대사 내부 헬퍼 선언 + */ +#ifndef RC_H_0013_H +#define RC_H_0013_H + +#include "txcore.h" + +int rc_h_0013_check(const char *key, long amount); +int rc_h_0013_apply(TXBUF *in, TXBUF *out); +long rc_h_0013_eval(long amount, int factor); + +#endif /* RC_H_0013_H */ diff --git a/app/include/rc_h_0014.h b/app/include/rc_h_0014.h new file mode 100644 index 0000000..e90fcac --- /dev/null +++ b/app/include/rc_h_0014.h @@ -0,0 +1,20 @@ +/* + * rc_h_0014.h - 대사 코드/상수 테이블 + */ +#ifndef RC_H_0014_H +#define RC_H_0014_H + +#define RC_H_0014_RC_OK 0 +#define RC_H_0014_RC_RETRY 1 +#define RC_H_0014_RC_SKIP 2 +#define RC_H_0014_RC_ERROR 9 + +#define RC_H_0014_LIMIT_DAILY 100000000L +#define RC_H_0014_LIMIT_SINGLE 50000000L +#define RC_H_0014_FEE_RATE_BP 250 /* 2.50% */ + +#define RC_H_0014_CHAN_ONLINE "01" +#define RC_H_0014_CHAN_BATCH "02" +#define RC_H_0014_CHAN_RECON "03" + +#endif /* RC_H_0014_H */ diff --git a/app/include/rc_h_0015.h b/app/include/rc_h_0015.h new file mode 100644 index 0000000..e7dda55 --- /dev/null +++ b/app/include/rc_h_0015.h @@ -0,0 +1,19 @@ +/* + * rc_h_0015.h - 대사 고정길이 전문 레이아웃 (positional, 재배치 금지) + */ +#ifndef RC_H_0015_H +#define RC_H_0015_H + +typedef struct { + char msg_type[4]; /* 전문구분 4 */ + char merch_id[15]; /* 가맹점번호 15 */ + char key[9]; /* 처리키 9 */ + char amount[12]; /* 금액 12 zero-pad */ + char biz_date[8]; /* 영업일 8 */ + char resp_code[4]; /* 응답코드 4 */ + char filler[20]; /* 예비 20 */ +} rc_h_0015_msg_t; + +#define RC_H_0015_MSG_LEN ((int)sizeof(rc_h_0015_msg_t)) + +#endif /* RC_H_0015_H */ diff --git a/app/include/rc_h_0016.h b/app/include/rc_h_0016.h new file mode 100644 index 0000000..0f22d0f --- /dev/null +++ b/app/include/rc_h_0016.h @@ -0,0 +1,22 @@ +/* + * rc_h_0016.h - 대사 레코드/뷰 구조 정의 + */ +#ifndef RC_H_0016_H +#define RC_H_0016_H + +/* 대사 처리 뷰 레코드 */ +typedef struct { + char key[16]; + char merch_id[16]; + long amount; + long fee; + char biz_date[9]; + char status[2]; + char reserved[16]; +} rc_h_0016_view_t; + +#define RC_H_0016_STATUS_OPEN "O" +#define RC_H_0016_STATUS_HOLD "H" +#define RC_H_0016_STATUS_CLOSE "C" + +#endif /* RC_H_0016_H */ diff --git a/app/include/rc_h_0017.h b/app/include/rc_h_0017.h new file mode 100644 index 0000000..dafeecf --- /dev/null +++ b/app/include/rc_h_0017.h @@ -0,0 +1,13 @@ +/* + * rc_h_0017.h - 대사 내부 헬퍼 선언 + */ +#ifndef RC_H_0017_H +#define RC_H_0017_H + +#include "txcore.h" + +int rc_h_0017_check(const char *key, long amount); +int rc_h_0017_apply(TXBUF *in, TXBUF *out); +long rc_h_0017_eval(long amount, int factor); + +#endif /* RC_H_0017_H */ diff --git a/app/include/rc_io_0001.h b/app/include/rc_io_0001.h new file mode 100644 index 0000000..d8ff13c --- /dev/null +++ b/app/include/rc_io_0001.h @@ -0,0 +1,14 @@ +/* + * rc_io_0001.h - 대사 보조 DBIO 선언 (rc_io_0001.pgc 구현) + */ +#ifndef RC_IO_0001_H +#define RC_IO_0001_H + +#include "txcore.h" + +/* rc_io_0001 전용 조회/갱신 (테이블 rc_io_0001_t) */ +int rc_io_0001_fetch(const char *key, long *out_amount); +int rc_io_0001_touch(const char *key, long amount); +long rc_io_0001_total(const char *biz_date); + +#endif /* RC_IO_0001_H */ diff --git a/app/include/rc_io_0002.h b/app/include/rc_io_0002.h new file mode 100644 index 0000000..e11024e --- /dev/null +++ b/app/include/rc_io_0002.h @@ -0,0 +1,14 @@ +/* + * rc_io_0002.h - 대사 보조 DBIO 선언 (rc_io_0002.pgc 구현) + */ +#ifndef RC_IO_0002_H +#define RC_IO_0002_H + +#include "txcore.h" + +/* rc_io_0002 전용 조회/갱신 (테이블 rc_io_0002_t) */ +int rc_io_0002_fetch(const char *key, long *out_amount); +int rc_io_0002_touch(const char *key, long amount); +long rc_io_0002_total(const char *biz_date); + +#endif /* RC_IO_0002_H */ diff --git a/app/include/rc_io_0003.h b/app/include/rc_io_0003.h new file mode 100644 index 0000000..ac81a44 --- /dev/null +++ b/app/include/rc_io_0003.h @@ -0,0 +1,14 @@ +/* + * rc_io_0003.h - 대사 보조 DBIO 선언 (rc_io_0003.pgc 구현) + */ +#ifndef RC_IO_0003_H +#define RC_IO_0003_H + +#include "txcore.h" + +/* rc_io_0003 전용 조회/갱신 (테이블 rc_io_0003_t) */ +int rc_io_0003_fetch(const char *key, long *out_amount); +int rc_io_0003_touch(const char *key, long amount); +long rc_io_0003_total(const char *biz_date); + +#endif /* RC_IO_0003_H */ diff --git a/app/include/rc_io_0004.h b/app/include/rc_io_0004.h new file mode 100644 index 0000000..8ce769c --- /dev/null +++ b/app/include/rc_io_0004.h @@ -0,0 +1,14 @@ +/* + * rc_io_0004.h - 대사 보조 DBIO 선언 (rc_io_0004.pgc 구현) + */ +#ifndef RC_IO_0004_H +#define RC_IO_0004_H + +#include "txcore.h" + +/* rc_io_0004 전용 조회/갱신 (테이블 rc_io_0004_t) */ +int rc_io_0004_fetch(const char *key, long *out_amount); +int rc_io_0004_touch(const char *key, long amount); +long rc_io_0004_total(const char *biz_date); + +#endif /* RC_IO_0004_H */ diff --git a/app/include/rc_io_0005.h b/app/include/rc_io_0005.h new file mode 100644 index 0000000..507b360 --- /dev/null +++ b/app/include/rc_io_0005.h @@ -0,0 +1,14 @@ +/* + * rc_io_0005.h - 대사 보조 DBIO 선언 (rc_io_0005.pgc 구현) + */ +#ifndef RC_IO_0005_H +#define RC_IO_0005_H + +#include "txcore.h" + +/* rc_io_0005 전용 조회/갱신 (테이블 rc_io_0005_t) */ +int rc_io_0005_fetch(const char *key, long *out_amount); +int rc_io_0005_touch(const char *key, long amount); +long rc_io_0005_total(const char *biz_date); + +#endif /* RC_IO_0005_H */ diff --git a/app/include/rc_io_0006.h b/app/include/rc_io_0006.h new file mode 100644 index 0000000..cc4936f --- /dev/null +++ b/app/include/rc_io_0006.h @@ -0,0 +1,14 @@ +/* + * rc_io_0006.h - 대사 보조 DBIO 선언 (rc_io_0006.pgc 구현) + */ +#ifndef RC_IO_0006_H +#define RC_IO_0006_H + +#include "txcore.h" + +/* rc_io_0006 전용 조회/갱신 (테이블 rc_io_0006_t) */ +int rc_io_0006_fetch(const char *key, long *out_amount); +int rc_io_0006_touch(const char *key, long amount); +long rc_io_0006_total(const char *biz_date); + +#endif /* RC_IO_0006_H */ diff --git a/app/include/rc_io_0007.h b/app/include/rc_io_0007.h new file mode 100644 index 0000000..905300e --- /dev/null +++ b/app/include/rc_io_0007.h @@ -0,0 +1,14 @@ +/* + * rc_io_0007.h - 대사 보조 DBIO 선언 (rc_io_0007.pgc 구현) + */ +#ifndef RC_IO_0007_H +#define RC_IO_0007_H + +#include "txcore.h" + +/* rc_io_0007 전용 조회/갱신 (테이블 rc_io_0007_t) */ +int rc_io_0007_fetch(const char *key, long *out_amount); +int rc_io_0007_touch(const char *key, long amount); +long rc_io_0007_total(const char *biz_date); + +#endif /* RC_IO_0007_H */ diff --git a/app/include/rc_io_0008.h b/app/include/rc_io_0008.h new file mode 100644 index 0000000..9f942b5 --- /dev/null +++ b/app/include/rc_io_0008.h @@ -0,0 +1,14 @@ +/* + * rc_io_0008.h - 대사 보조 DBIO 선언 (rc_io_0008.pgc 구현) + */ +#ifndef RC_IO_0008_H +#define RC_IO_0008_H + +#include "txcore.h" + +/* rc_io_0008 전용 조회/갱신 (테이블 rc_io_0008_t) */ +int rc_io_0008_fetch(const char *key, long *out_amount); +int rc_io_0008_touch(const char *key, long amount); +long rc_io_0008_total(const char *biz_date); + +#endif /* RC_IO_0008_H */ diff --git a/app/include/rc_io_0009.h b/app/include/rc_io_0009.h new file mode 100644 index 0000000..d71e3fc --- /dev/null +++ b/app/include/rc_io_0009.h @@ -0,0 +1,14 @@ +/* + * rc_io_0009.h - 대사 보조 DBIO 선언 (rc_io_0009.pgc 구현) + */ +#ifndef RC_IO_0009_H +#define RC_IO_0009_H + +#include "txcore.h" + +/* rc_io_0009 전용 조회/갱신 (테이블 rc_io_0009_t) */ +int rc_io_0009_fetch(const char *key, long *out_amount); +int rc_io_0009_touch(const char *key, long amount); +long rc_io_0009_total(const char *biz_date); + +#endif /* RC_IO_0009_H */ diff --git a/app/include/rc_io_0010.h b/app/include/rc_io_0010.h new file mode 100644 index 0000000..6a0ed61 --- /dev/null +++ b/app/include/rc_io_0010.h @@ -0,0 +1,14 @@ +/* + * rc_io_0010.h - 대사 보조 DBIO 선언 (rc_io_0010.pgc 구현) + */ +#ifndef RC_IO_0010_H +#define RC_IO_0010_H + +#include "txcore.h" + +/* rc_io_0010 전용 조회/갱신 (테이블 rc_io_0010_t) */ +int rc_io_0010_fetch(const char *key, long *out_amount); +int rc_io_0010_touch(const char *key, long amount); +long rc_io_0010_total(const char *biz_date); + +#endif /* RC_IO_0010_H */ diff --git a/app/include/rc_io_0011.h b/app/include/rc_io_0011.h new file mode 100644 index 0000000..b0b1d54 --- /dev/null +++ b/app/include/rc_io_0011.h @@ -0,0 +1,14 @@ +/* + * rc_io_0011.h - 대사 보조 DBIO 선언 (rc_io_0011.pgc 구현) + */ +#ifndef RC_IO_0011_H +#define RC_IO_0011_H + +#include "txcore.h" + +/* rc_io_0011 전용 조회/갱신 (테이블 rc_io_0011_t) */ +int rc_io_0011_fetch(const char *key, long *out_amount); +int rc_io_0011_touch(const char *key, long amount); +long rc_io_0011_total(const char *biz_date); + +#endif /* RC_IO_0011_H */ diff --git a/app/include/rc_io_0012.h b/app/include/rc_io_0012.h new file mode 100644 index 0000000..8f042ea --- /dev/null +++ b/app/include/rc_io_0012.h @@ -0,0 +1,14 @@ +/* + * rc_io_0012.h - 대사 보조 DBIO 선언 (rc_io_0012.pgc 구현) + */ +#ifndef RC_IO_0012_H +#define RC_IO_0012_H + +#include "txcore.h" + +/* rc_io_0012 전용 조회/갱신 (테이블 rc_io_0012_t) */ +int rc_io_0012_fetch(const char *key, long *out_amount); +int rc_io_0012_touch(const char *key, long amount); +long rc_io_0012_total(const char *biz_date); + +#endif /* RC_IO_0012_H */ diff --git a/app/include/rc_io_0013.h b/app/include/rc_io_0013.h new file mode 100644 index 0000000..cd4bd5f --- /dev/null +++ b/app/include/rc_io_0013.h @@ -0,0 +1,14 @@ +/* + * rc_io_0013.h - 대사 보조 DBIO 선언 (rc_io_0013.pgc 구현) + */ +#ifndef RC_IO_0013_H +#define RC_IO_0013_H + +#include "txcore.h" + +/* rc_io_0013 전용 조회/갱신 (테이블 rc_io_0013_t) */ +int rc_io_0013_fetch(const char *key, long *out_amount); +int rc_io_0013_touch(const char *key, long amount); +long rc_io_0013_total(const char *biz_date); + +#endif /* RC_IO_0013_H */ diff --git a/app/include/rc_io_0014.h b/app/include/rc_io_0014.h new file mode 100644 index 0000000..20e8c18 --- /dev/null +++ b/app/include/rc_io_0014.h @@ -0,0 +1,14 @@ +/* + * rc_io_0014.h - 대사 보조 DBIO 선언 (rc_io_0014.pgc 구현) + */ +#ifndef RC_IO_0014_H +#define RC_IO_0014_H + +#include "txcore.h" + +/* rc_io_0014 전용 조회/갱신 (테이블 rc_io_0014_t) */ +int rc_io_0014_fetch(const char *key, long *out_amount); +int rc_io_0014_touch(const char *key, long amount); +long rc_io_0014_total(const char *biz_date); + +#endif /* RC_IO_0014_H */ diff --git a/app/include/rc_io_0015.h b/app/include/rc_io_0015.h new file mode 100644 index 0000000..05354e3 --- /dev/null +++ b/app/include/rc_io_0015.h @@ -0,0 +1,14 @@ +/* + * rc_io_0015.h - 대사 보조 DBIO 선언 (rc_io_0015.pgc 구현) + */ +#ifndef RC_IO_0015_H +#define RC_IO_0015_H + +#include "txcore.h" + +/* rc_io_0015 전용 조회/갱신 (테이블 rc_io_0015_t) */ +int rc_io_0015_fetch(const char *key, long *out_amount); +int rc_io_0015_touch(const char *key, long amount); +long rc_io_0015_total(const char *biz_date); + +#endif /* RC_IO_0015_H */ diff --git a/app/include/rc_io_0016.h b/app/include/rc_io_0016.h new file mode 100644 index 0000000..f42b5c4 --- /dev/null +++ b/app/include/rc_io_0016.h @@ -0,0 +1,14 @@ +/* + * rc_io_0016.h - 대사 보조 DBIO 선언 (rc_io_0016.pgc 구현) + */ +#ifndef RC_IO_0016_H +#define RC_IO_0016_H + +#include "txcore.h" + +/* rc_io_0016 전용 조회/갱신 (테이블 rc_io_0016_t) */ +int rc_io_0016_fetch(const char *key, long *out_amount); +int rc_io_0016_touch(const char *key, long amount); +long rc_io_0016_total(const char *biz_date); + +#endif /* RC_IO_0016_H */ diff --git a/app/include/rc_io_0017.h b/app/include/rc_io_0017.h new file mode 100644 index 0000000..17bd10f --- /dev/null +++ b/app/include/rc_io_0017.h @@ -0,0 +1,14 @@ +/* + * rc_io_0017.h - 대사 보조 DBIO 선언 (rc_io_0017.pgc 구현) + */ +#ifndef RC_IO_0017_H +#define RC_IO_0017_H + +#include "txcore.h" + +/* rc_io_0017 전용 조회/갱신 (테이블 rc_io_0017_t) */ +int rc_io_0017_fetch(const char *key, long *out_amount); +int rc_io_0017_touch(const char *key, long amount); +long rc_io_0017_total(const char *biz_date); + +#endif /* RC_IO_0017_H */ diff --git a/app/include/rc_io_0018.h b/app/include/rc_io_0018.h new file mode 100644 index 0000000..ccc2b9c --- /dev/null +++ b/app/include/rc_io_0018.h @@ -0,0 +1,14 @@ +/* + * rc_io_0018.h - 대사 보조 DBIO 선언 (rc_io_0018.pgc 구현) + */ +#ifndef RC_IO_0018_H +#define RC_IO_0018_H + +#include "txcore.h" + +/* rc_io_0018 전용 조회/갱신 (테이블 rc_io_0018_t) */ +int rc_io_0018_fetch(const char *key, long *out_amount); +int rc_io_0018_touch(const char *key, long amount); +long rc_io_0018_total(const char *biz_date); + +#endif /* RC_IO_0018_H */ diff --git a/app/include/rc_io_0019.h b/app/include/rc_io_0019.h new file mode 100644 index 0000000..6bf30cc --- /dev/null +++ b/app/include/rc_io_0019.h @@ -0,0 +1,14 @@ +/* + * rc_io_0019.h - 대사 보조 DBIO 선언 (rc_io_0019.pgc 구현) + */ +#ifndef RC_IO_0019_H +#define RC_IO_0019_H + +#include "txcore.h" + +/* rc_io_0019 전용 조회/갱신 (테이블 rc_io_0019_t) */ +int rc_io_0019_fetch(const char *key, long *out_amount); +int rc_io_0019_touch(const char *key, long amount); +long rc_io_0019_total(const char *biz_date); + +#endif /* RC_IO_0019_H */ diff --git a/app/include/rc_io_0020.h b/app/include/rc_io_0020.h new file mode 100644 index 0000000..60cb8d6 --- /dev/null +++ b/app/include/rc_io_0020.h @@ -0,0 +1,14 @@ +/* + * rc_io_0020.h - 대사 보조 DBIO 선언 (rc_io_0020.pgc 구현) + */ +#ifndef RC_IO_0020_H +#define RC_IO_0020_H + +#include "txcore.h" + +/* rc_io_0020 전용 조회/갱신 (테이블 rc_io_0020_t) */ +int rc_io_0020_fetch(const char *key, long *out_amount); +int rc_io_0020_touch(const char *key, long amount); +long rc_io_0020_total(const char *biz_date); + +#endif /* RC_IO_0020_H */ diff --git a/app/include/rc_io_0021.h b/app/include/rc_io_0021.h new file mode 100644 index 0000000..2f8b099 --- /dev/null +++ b/app/include/rc_io_0021.h @@ -0,0 +1,14 @@ +/* + * rc_io_0021.h - 대사 보조 DBIO 선언 (rc_io_0021.pgc 구현) + */ +#ifndef RC_IO_0021_H +#define RC_IO_0021_H + +#include "txcore.h" + +/* rc_io_0021 전용 조회/갱신 (테이블 rc_io_0021_t) */ +int rc_io_0021_fetch(const char *key, long *out_amount); +int rc_io_0021_touch(const char *key, long amount); +long rc_io_0021_total(const char *biz_date); + +#endif /* RC_IO_0021_H */ diff --git a/app/include/rc_io_0022.h b/app/include/rc_io_0022.h new file mode 100644 index 0000000..6f4056d --- /dev/null +++ b/app/include/rc_io_0022.h @@ -0,0 +1,14 @@ +/* + * rc_io_0022.h - 대사 보조 DBIO 선언 (rc_io_0022.pgc 구현) + */ +#ifndef RC_IO_0022_H +#define RC_IO_0022_H + +#include "txcore.h" + +/* rc_io_0022 전용 조회/갱신 (테이블 rc_io_0022_t) */ +int rc_io_0022_fetch(const char *key, long *out_amount); +int rc_io_0022_touch(const char *key, long amount); +long rc_io_0022_total(const char *biz_date); + +#endif /* RC_IO_0022_H */ diff --git a/app/include/rc_io_0023.h b/app/include/rc_io_0023.h new file mode 100644 index 0000000..c6ea26a --- /dev/null +++ b/app/include/rc_io_0023.h @@ -0,0 +1,14 @@ +/* + * rc_io_0023.h - 대사 보조 DBIO 선언 (rc_io_0023.pgc 구현) + */ +#ifndef RC_IO_0023_H +#define RC_IO_0023_H + +#include "txcore.h" + +/* rc_io_0023 전용 조회/갱신 (테이블 rc_io_0023_t) */ +int rc_io_0023_fetch(const char *key, long *out_amount); +int rc_io_0023_touch(const char *key, long amount); +long rc_io_0023_total(const char *biz_date); + +#endif /* RC_IO_0023_H */ diff --git a/app/include/rc_io_0024.h b/app/include/rc_io_0024.h new file mode 100644 index 0000000..7732b71 --- /dev/null +++ b/app/include/rc_io_0024.h @@ -0,0 +1,14 @@ +/* + * rc_io_0024.h - 대사 보조 DBIO 선언 (rc_io_0024.pgc 구현) + */ +#ifndef RC_IO_0024_H +#define RC_IO_0024_H + +#include "txcore.h" + +/* rc_io_0024 전용 조회/갱신 (테이블 rc_io_0024_t) */ +int rc_io_0024_fetch(const char *key, long *out_amount); +int rc_io_0024_touch(const char *key, long amount); +long rc_io_0024_total(const char *biz_date); + +#endif /* RC_IO_0024_H */ diff --git a/app/include/rc_io_0025.h b/app/include/rc_io_0025.h new file mode 100644 index 0000000..162992b --- /dev/null +++ b/app/include/rc_io_0025.h @@ -0,0 +1,14 @@ +/* + * rc_io_0025.h - 대사 보조 DBIO 선언 (rc_io_0025.pgc 구현) + */ +#ifndef RC_IO_0025_H +#define RC_IO_0025_H + +#include "txcore.h" + +/* rc_io_0025 전용 조회/갱신 (테이블 rc_io_0025_t) */ +int rc_io_0025_fetch(const char *key, long *out_amount); +int rc_io_0025_touch(const char *key, long amount); +long rc_io_0025_total(const char *biz_date); + +#endif /* RC_IO_0025_H */ diff --git a/app/include/rc_io_0026.h b/app/include/rc_io_0026.h new file mode 100644 index 0000000..c75f3d1 --- /dev/null +++ b/app/include/rc_io_0026.h @@ -0,0 +1,14 @@ +/* + * rc_io_0026.h - 대사 보조 DBIO 선언 (rc_io_0026.pgc 구현) + */ +#ifndef RC_IO_0026_H +#define RC_IO_0026_H + +#include "txcore.h" + +/* rc_io_0026 전용 조회/갱신 (테이블 rc_io_0026_t) */ +int rc_io_0026_fetch(const char *key, long *out_amount); +int rc_io_0026_touch(const char *key, long amount); +long rc_io_0026_total(const char *biz_date); + +#endif /* RC_IO_0026_H */ diff --git a/app/include/st_core.h b/app/include/st_core.h new file mode 100644 index 0000000..c774659 --- /dev/null +++ b/app/include/st_core.h @@ -0,0 +1,38 @@ +/* + * st_core.h - 정산수수료 모듈 핵심 계약 (레코드/상태/표준 DBIO API) + * + * 이 모듈의 온라인/배치 프로그램은 SQL 을 직접 다루지 않고 아래 표준 + * DBIO API 만 호출한다. 구현은 app/dbio/st_dbio_main.pgc (ECPG). + */ +#ifndef ST_CORE_H +#define ST_CORE_H + +#include "txcore.h" + +/* 정산수수료 처리 상태코드 */ +#define ST_ST_RECV "R" /* 접수/수신 */ +#define ST_ST_DONE "M" /* 처리완료 */ +#define ST_ST_FAIL "U" /* 불일치/실패 */ +#define ST_ST_SETTLED "S" /* 정산완료 */ + +/* 정산수수료 원장 레코드 (1행) */ +typedef struct { + char key[16]; /* 처리키(승인/거래 번호) PK */ + char merch_id[16]; /* 가맹점번호 */ + char card_no[20]; /* 카드번호(마스킹) */ + long amount; /* 거래금액(원) */ + char biz_date[9]; /* 영업일 YYYYMMDD */ + char status[2]; /* 상태코드 */ + long fee; /* 수수료(원) */ +} st_rec_t; + +/* 표준 DBIO API (구현: st_dbio_main.pgc) */ +int st_dbio_connect(const char *target); +int st_dbio_disconnect(void); +int st_rec_insert(const st_rec_t *rec); +int st_rec_select(const char *key, st_rec_t *out); +int st_rec_update_status(const char *key, const char *status); +long st_rec_count(const char *biz_date, const char *status); +int st_rec_sum(const char *biz_date, long *out_sum); + +#endif /* ST_CORE_H */ diff --git a/app/include/st_cu_0001.h b/app/include/st_cu_0001.h new file mode 100644 index 0000000..0e7e997 --- /dev/null +++ b/app/include/st_cu_0001.h @@ -0,0 +1,11 @@ +/* + * st_cu_0001.h - 정산수수료 공통 유틸 선언 (st_cu_0001.c 구현) + */ +#ifndef ST_CU_0001_H +#define ST_CU_0001_H + +long st_cu_0001_fee(long amount, int rate_bp); +long st_cu_0001_round_unit(long amount, long unit); +int st_cu_0001_classify(long amount); + +#endif /* ST_CU_0001_H */ diff --git a/app/include/st_cu_0002.h b/app/include/st_cu_0002.h new file mode 100644 index 0000000..3e08dc0 --- /dev/null +++ b/app/include/st_cu_0002.h @@ -0,0 +1,11 @@ +/* + * st_cu_0002.h - 정산수수료 공통 유틸 선언 (st_cu_0002.c 구현) + */ +#ifndef ST_CU_0002_H +#define ST_CU_0002_H + +long st_cu_0002_fee(long amount, int rate_bp); +long st_cu_0002_round_unit(long amount, long unit); +int st_cu_0002_classify(long amount); + +#endif /* ST_CU_0002_H */ diff --git a/app/include/st_cu_0003.h b/app/include/st_cu_0003.h new file mode 100644 index 0000000..379a06c --- /dev/null +++ b/app/include/st_cu_0003.h @@ -0,0 +1,11 @@ +/* + * st_cu_0003.h - 정산수수료 공통 유틸 선언 (st_cu_0003.c 구현) + */ +#ifndef ST_CU_0003_H +#define ST_CU_0003_H + +long st_cu_0003_fee(long amount, int rate_bp); +long st_cu_0003_round_unit(long amount, long unit); +int st_cu_0003_classify(long amount); + +#endif /* ST_CU_0003_H */ diff --git a/app/include/st_cu_0004.h b/app/include/st_cu_0004.h new file mode 100644 index 0000000..5dd1647 --- /dev/null +++ b/app/include/st_cu_0004.h @@ -0,0 +1,11 @@ +/* + * st_cu_0004.h - 정산수수료 공통 유틸 선언 (st_cu_0004.c 구현) + */ +#ifndef ST_CU_0004_H +#define ST_CU_0004_H + +long st_cu_0004_fee(long amount, int rate_bp); +long st_cu_0004_round_unit(long amount, long unit); +int st_cu_0004_classify(long amount); + +#endif /* ST_CU_0004_H */ diff --git a/app/include/st_cu_0005.h b/app/include/st_cu_0005.h new file mode 100644 index 0000000..f92841b --- /dev/null +++ b/app/include/st_cu_0005.h @@ -0,0 +1,11 @@ +/* + * st_cu_0005.h - 정산수수료 공통 유틸 선언 (st_cu_0005.c 구현) + */ +#ifndef ST_CU_0005_H +#define ST_CU_0005_H + +long st_cu_0005_fee(long amount, int rate_bp); +long st_cu_0005_round_unit(long amount, long unit); +int st_cu_0005_classify(long amount); + +#endif /* ST_CU_0005_H */ diff --git a/app/include/st_cu_0006.h b/app/include/st_cu_0006.h new file mode 100644 index 0000000..c57539b --- /dev/null +++ b/app/include/st_cu_0006.h @@ -0,0 +1,11 @@ +/* + * st_cu_0006.h - 정산수수료 공통 유틸 선언 (st_cu_0006.c 구현) + */ +#ifndef ST_CU_0006_H +#define ST_CU_0006_H + +long st_cu_0006_fee(long amount, int rate_bp); +long st_cu_0006_round_unit(long amount, long unit); +int st_cu_0006_classify(long amount); + +#endif /* ST_CU_0006_H */ diff --git a/app/include/st_cu_0007.h b/app/include/st_cu_0007.h new file mode 100644 index 0000000..33ceeb7 --- /dev/null +++ b/app/include/st_cu_0007.h @@ -0,0 +1,11 @@ +/* + * st_cu_0007.h - 정산수수료 공통 유틸 선언 (st_cu_0007.c 구현) + */ +#ifndef ST_CU_0007_H +#define ST_CU_0007_H + +long st_cu_0007_fee(long amount, int rate_bp); +long st_cu_0007_round_unit(long amount, long unit); +int st_cu_0007_classify(long amount); + +#endif /* ST_CU_0007_H */ diff --git a/app/include/st_cu_0008.h b/app/include/st_cu_0008.h new file mode 100644 index 0000000..b880d7a --- /dev/null +++ b/app/include/st_cu_0008.h @@ -0,0 +1,11 @@ +/* + * st_cu_0008.h - 정산수수료 공통 유틸 선언 (st_cu_0008.c 구현) + */ +#ifndef ST_CU_0008_H +#define ST_CU_0008_H + +long st_cu_0008_fee(long amount, int rate_bp); +long st_cu_0008_round_unit(long amount, long unit); +int st_cu_0008_classify(long amount); + +#endif /* ST_CU_0008_H */ diff --git a/app/include/st_cu_0009.h b/app/include/st_cu_0009.h new file mode 100644 index 0000000..dcbfaa2 --- /dev/null +++ b/app/include/st_cu_0009.h @@ -0,0 +1,11 @@ +/* + * st_cu_0009.h - 정산수수료 공통 유틸 선언 (st_cu_0009.c 구현) + */ +#ifndef ST_CU_0009_H +#define ST_CU_0009_H + +long st_cu_0009_fee(long amount, int rate_bp); +long st_cu_0009_round_unit(long amount, long unit); +int st_cu_0009_classify(long amount); + +#endif /* ST_CU_0009_H */ diff --git a/app/include/st_cu_0010.h b/app/include/st_cu_0010.h new file mode 100644 index 0000000..4d8703d --- /dev/null +++ b/app/include/st_cu_0010.h @@ -0,0 +1,11 @@ +/* + * st_cu_0010.h - 정산수수료 공통 유틸 선언 (st_cu_0010.c 구현) + */ +#ifndef ST_CU_0010_H +#define ST_CU_0010_H + +long st_cu_0010_fee(long amount, int rate_bp); +long st_cu_0010_round_unit(long amount, long unit); +int st_cu_0010_classify(long amount); + +#endif /* ST_CU_0010_H */ diff --git a/app/include/st_cu_0011.h b/app/include/st_cu_0011.h new file mode 100644 index 0000000..4ae0f6b --- /dev/null +++ b/app/include/st_cu_0011.h @@ -0,0 +1,11 @@ +/* + * st_cu_0011.h - 정산수수료 공통 유틸 선언 (st_cu_0011.c 구현) + */ +#ifndef ST_CU_0011_H +#define ST_CU_0011_H + +long st_cu_0011_fee(long amount, int rate_bp); +long st_cu_0011_round_unit(long amount, long unit); +int st_cu_0011_classify(long amount); + +#endif /* ST_CU_0011_H */ diff --git a/app/include/st_h_0001.h b/app/include/st_h_0001.h new file mode 100644 index 0000000..bfa60a9 --- /dev/null +++ b/app/include/st_h_0001.h @@ -0,0 +1,19 @@ +/* + * st_h_0001.h - 정산수수료 고정길이 전문 레이아웃 (positional, 재배치 금지) + */ +#ifndef ST_H_0001_H +#define ST_H_0001_H + +typedef struct { + char msg_type[4]; /* 전문구분 4 */ + char merch_id[15]; /* 가맹점번호 15 */ + char key[9]; /* 처리키 9 */ + char amount[12]; /* 금액 12 zero-pad */ + char biz_date[8]; /* 영업일 8 */ + char resp_code[4]; /* 응답코드 4 */ + char filler[20]; /* 예비 20 */ +} st_h_0001_msg_t; + +#define ST_H_0001_MSG_LEN ((int)sizeof(st_h_0001_msg_t)) + +#endif /* ST_H_0001_H */ diff --git a/app/include/st_h_0002.h b/app/include/st_h_0002.h new file mode 100644 index 0000000..d36369f --- /dev/null +++ b/app/include/st_h_0002.h @@ -0,0 +1,22 @@ +/* + * st_h_0002.h - 정산수수료 레코드/뷰 구조 정의 + */ +#ifndef ST_H_0002_H +#define ST_H_0002_H + +/* 정산수수료 처리 뷰 레코드 */ +typedef struct { + char key[16]; + char merch_id[16]; + long amount; + long fee; + char biz_date[9]; + char status[2]; + char reserved[16]; +} st_h_0002_view_t; + +#define ST_H_0002_STATUS_OPEN "O" +#define ST_H_0002_STATUS_HOLD "H" +#define ST_H_0002_STATUS_CLOSE "C" + +#endif /* ST_H_0002_H */ diff --git a/app/include/st_h_0003.h b/app/include/st_h_0003.h new file mode 100644 index 0000000..0689de9 --- /dev/null +++ b/app/include/st_h_0003.h @@ -0,0 +1,13 @@ +/* + * st_h_0003.h - 정산수수료 내부 헬퍼 선언 + */ +#ifndef ST_H_0003_H +#define ST_H_0003_H + +#include "txcore.h" + +int st_h_0003_check(const char *key, long amount); +int st_h_0003_apply(TXBUF *in, TXBUF *out); +long st_h_0003_eval(long amount, int factor); + +#endif /* ST_H_0003_H */ diff --git a/app/include/st_h_0004.h b/app/include/st_h_0004.h new file mode 100644 index 0000000..cd059d9 --- /dev/null +++ b/app/include/st_h_0004.h @@ -0,0 +1,20 @@ +/* + * st_h_0004.h - 정산수수료 코드/상수 테이블 + */ +#ifndef ST_H_0004_H +#define ST_H_0004_H + +#define ST_H_0004_RC_OK 0 +#define ST_H_0004_RC_RETRY 1 +#define ST_H_0004_RC_SKIP 2 +#define ST_H_0004_RC_ERROR 9 + +#define ST_H_0004_LIMIT_DAILY 100000000L +#define ST_H_0004_LIMIT_SINGLE 50000000L +#define ST_H_0004_FEE_RATE_BP 250 /* 2.50% */ + +#define ST_H_0004_CHAN_ONLINE "01" +#define ST_H_0004_CHAN_BATCH "02" +#define ST_H_0004_CHAN_RECON "03" + +#endif /* ST_H_0004_H */ diff --git a/app/include/st_h_0005.h b/app/include/st_h_0005.h new file mode 100644 index 0000000..83f8c7d --- /dev/null +++ b/app/include/st_h_0005.h @@ -0,0 +1,19 @@ +/* + * st_h_0005.h - 정산수수료 고정길이 전문 레이아웃 (positional, 재배치 금지) + */ +#ifndef ST_H_0005_H +#define ST_H_0005_H + +typedef struct { + char msg_type[4]; /* 전문구분 4 */ + char merch_id[15]; /* 가맹점번호 15 */ + char key[9]; /* 처리키 9 */ + char amount[12]; /* 금액 12 zero-pad */ + char biz_date[8]; /* 영업일 8 */ + char resp_code[4]; /* 응답코드 4 */ + char filler[20]; /* 예비 20 */ +} st_h_0005_msg_t; + +#define ST_H_0005_MSG_LEN ((int)sizeof(st_h_0005_msg_t)) + +#endif /* ST_H_0005_H */ diff --git a/app/include/st_h_0006.h b/app/include/st_h_0006.h new file mode 100644 index 0000000..31b5ac3 --- /dev/null +++ b/app/include/st_h_0006.h @@ -0,0 +1,22 @@ +/* + * st_h_0006.h - 정산수수료 레코드/뷰 구조 정의 + */ +#ifndef ST_H_0006_H +#define ST_H_0006_H + +/* 정산수수료 처리 뷰 레코드 */ +typedef struct { + char key[16]; + char merch_id[16]; + long amount; + long fee; + char biz_date[9]; + char status[2]; + char reserved[16]; +} st_h_0006_view_t; + +#define ST_H_0006_STATUS_OPEN "O" +#define ST_H_0006_STATUS_HOLD "H" +#define ST_H_0006_STATUS_CLOSE "C" + +#endif /* ST_H_0006_H */ diff --git a/app/include/st_h_0007.h b/app/include/st_h_0007.h new file mode 100644 index 0000000..eb38562 --- /dev/null +++ b/app/include/st_h_0007.h @@ -0,0 +1,13 @@ +/* + * st_h_0007.h - 정산수수료 내부 헬퍼 선언 + */ +#ifndef ST_H_0007_H +#define ST_H_0007_H + +#include "txcore.h" + +int st_h_0007_check(const char *key, long amount); +int st_h_0007_apply(TXBUF *in, TXBUF *out); +long st_h_0007_eval(long amount, int factor); + +#endif /* ST_H_0007_H */ diff --git a/app/include/st_h_0008.h b/app/include/st_h_0008.h new file mode 100644 index 0000000..5e8467f --- /dev/null +++ b/app/include/st_h_0008.h @@ -0,0 +1,20 @@ +/* + * st_h_0008.h - 정산수수료 코드/상수 테이블 + */ +#ifndef ST_H_0008_H +#define ST_H_0008_H + +#define ST_H_0008_RC_OK 0 +#define ST_H_0008_RC_RETRY 1 +#define ST_H_0008_RC_SKIP 2 +#define ST_H_0008_RC_ERROR 9 + +#define ST_H_0008_LIMIT_DAILY 100000000L +#define ST_H_0008_LIMIT_SINGLE 50000000L +#define ST_H_0008_FEE_RATE_BP 250 /* 2.50% */ + +#define ST_H_0008_CHAN_ONLINE "01" +#define ST_H_0008_CHAN_BATCH "02" +#define ST_H_0008_CHAN_RECON "03" + +#endif /* ST_H_0008_H */ diff --git a/app/include/st_h_0009.h b/app/include/st_h_0009.h new file mode 100644 index 0000000..c40b943 --- /dev/null +++ b/app/include/st_h_0009.h @@ -0,0 +1,19 @@ +/* + * st_h_0009.h - 정산수수료 고정길이 전문 레이아웃 (positional, 재배치 금지) + */ +#ifndef ST_H_0009_H +#define ST_H_0009_H + +typedef struct { + char msg_type[4]; /* 전문구분 4 */ + char merch_id[15]; /* 가맹점번호 15 */ + char key[9]; /* 처리키 9 */ + char amount[12]; /* 금액 12 zero-pad */ + char biz_date[8]; /* 영업일 8 */ + char resp_code[4]; /* 응답코드 4 */ + char filler[20]; /* 예비 20 */ +} st_h_0009_msg_t; + +#define ST_H_0009_MSG_LEN ((int)sizeof(st_h_0009_msg_t)) + +#endif /* ST_H_0009_H */ diff --git a/app/include/st_h_0010.h b/app/include/st_h_0010.h new file mode 100644 index 0000000..1e5f5d3 --- /dev/null +++ b/app/include/st_h_0010.h @@ -0,0 +1,22 @@ +/* + * st_h_0010.h - 정산수수료 레코드/뷰 구조 정의 + */ +#ifndef ST_H_0010_H +#define ST_H_0010_H + +/* 정산수수료 처리 뷰 레코드 */ +typedef struct { + char key[16]; + char merch_id[16]; + long amount; + long fee; + char biz_date[9]; + char status[2]; + char reserved[16]; +} st_h_0010_view_t; + +#define ST_H_0010_STATUS_OPEN "O" +#define ST_H_0010_STATUS_HOLD "H" +#define ST_H_0010_STATUS_CLOSE "C" + +#endif /* ST_H_0010_H */ diff --git a/app/include/st_h_0011.h b/app/include/st_h_0011.h new file mode 100644 index 0000000..faafe5e --- /dev/null +++ b/app/include/st_h_0011.h @@ -0,0 +1,13 @@ +/* + * st_h_0011.h - 정산수수료 내부 헬퍼 선언 + */ +#ifndef ST_H_0011_H +#define ST_H_0011_H + +#include "txcore.h" + +int st_h_0011_check(const char *key, long amount); +int st_h_0011_apply(TXBUF *in, TXBUF *out); +long st_h_0011_eval(long amount, int factor); + +#endif /* ST_H_0011_H */ diff --git a/app/include/st_h_0012.h b/app/include/st_h_0012.h new file mode 100644 index 0000000..fd1733a --- /dev/null +++ b/app/include/st_h_0012.h @@ -0,0 +1,20 @@ +/* + * st_h_0012.h - 정산수수료 코드/상수 테이블 + */ +#ifndef ST_H_0012_H +#define ST_H_0012_H + +#define ST_H_0012_RC_OK 0 +#define ST_H_0012_RC_RETRY 1 +#define ST_H_0012_RC_SKIP 2 +#define ST_H_0012_RC_ERROR 9 + +#define ST_H_0012_LIMIT_DAILY 100000000L +#define ST_H_0012_LIMIT_SINGLE 50000000L +#define ST_H_0012_FEE_RATE_BP 250 /* 2.50% */ + +#define ST_H_0012_CHAN_ONLINE "01" +#define ST_H_0012_CHAN_BATCH "02" +#define ST_H_0012_CHAN_RECON "03" + +#endif /* ST_H_0012_H */ diff --git a/app/include/st_h_0013.h b/app/include/st_h_0013.h new file mode 100644 index 0000000..5dcc6e0 --- /dev/null +++ b/app/include/st_h_0013.h @@ -0,0 +1,19 @@ +/* + * st_h_0013.h - 정산수수료 고정길이 전문 레이아웃 (positional, 재배치 금지) + */ +#ifndef ST_H_0013_H +#define ST_H_0013_H + +typedef struct { + char msg_type[4]; /* 전문구분 4 */ + char merch_id[15]; /* 가맹점번호 15 */ + char key[9]; /* 처리키 9 */ + char amount[12]; /* 금액 12 zero-pad */ + char biz_date[8]; /* 영업일 8 */ + char resp_code[4]; /* 응답코드 4 */ + char filler[20]; /* 예비 20 */ +} st_h_0013_msg_t; + +#define ST_H_0013_MSG_LEN ((int)sizeof(st_h_0013_msg_t)) + +#endif /* ST_H_0013_H */ diff --git a/app/include/st_h_0014.h b/app/include/st_h_0014.h new file mode 100644 index 0000000..cb73b04 --- /dev/null +++ b/app/include/st_h_0014.h @@ -0,0 +1,22 @@ +/* + * st_h_0014.h - 정산수수료 레코드/뷰 구조 정의 + */ +#ifndef ST_H_0014_H +#define ST_H_0014_H + +/* 정산수수료 처리 뷰 레코드 */ +typedef struct { + char key[16]; + char merch_id[16]; + long amount; + long fee; + char biz_date[9]; + char status[2]; + char reserved[16]; +} st_h_0014_view_t; + +#define ST_H_0014_STATUS_OPEN "O" +#define ST_H_0014_STATUS_HOLD "H" +#define ST_H_0014_STATUS_CLOSE "C" + +#endif /* ST_H_0014_H */ diff --git a/app/include/st_h_0015.h b/app/include/st_h_0015.h new file mode 100644 index 0000000..23923fa --- /dev/null +++ b/app/include/st_h_0015.h @@ -0,0 +1,13 @@ +/* + * st_h_0015.h - 정산수수료 내부 헬퍼 선언 + */ +#ifndef ST_H_0015_H +#define ST_H_0015_H + +#include "txcore.h" + +int st_h_0015_check(const char *key, long amount); +int st_h_0015_apply(TXBUF *in, TXBUF *out); +long st_h_0015_eval(long amount, int factor); + +#endif /* ST_H_0015_H */ diff --git a/app/include/st_h_0016.h b/app/include/st_h_0016.h new file mode 100644 index 0000000..a77627c --- /dev/null +++ b/app/include/st_h_0016.h @@ -0,0 +1,20 @@ +/* + * st_h_0016.h - 정산수수료 코드/상수 테이블 + */ +#ifndef ST_H_0016_H +#define ST_H_0016_H + +#define ST_H_0016_RC_OK 0 +#define ST_H_0016_RC_RETRY 1 +#define ST_H_0016_RC_SKIP 2 +#define ST_H_0016_RC_ERROR 9 + +#define ST_H_0016_LIMIT_DAILY 100000000L +#define ST_H_0016_LIMIT_SINGLE 50000000L +#define ST_H_0016_FEE_RATE_BP 250 /* 2.50% */ + +#define ST_H_0016_CHAN_ONLINE "01" +#define ST_H_0016_CHAN_BATCH "02" +#define ST_H_0016_CHAN_RECON "03" + +#endif /* ST_H_0016_H */ diff --git a/app/include/st_io_0001.h b/app/include/st_io_0001.h new file mode 100644 index 0000000..7de70d8 --- /dev/null +++ b/app/include/st_io_0001.h @@ -0,0 +1,14 @@ +/* + * st_io_0001.h - 정산수수료 보조 DBIO 선언 (st_io_0001.pgc 구현) + */ +#ifndef ST_IO_0001_H +#define ST_IO_0001_H + +#include "txcore.h" + +/* st_io_0001 전용 조회/갱신 (테이블 st_io_0001_t) */ +int st_io_0001_fetch(const char *key, long *out_amount); +int st_io_0001_touch(const char *key, long amount); +long st_io_0001_total(const char *biz_date); + +#endif /* ST_IO_0001_H */ diff --git a/app/include/st_io_0002.h b/app/include/st_io_0002.h new file mode 100644 index 0000000..3b4d6d2 --- /dev/null +++ b/app/include/st_io_0002.h @@ -0,0 +1,14 @@ +/* + * st_io_0002.h - 정산수수료 보조 DBIO 선언 (st_io_0002.pgc 구현) + */ +#ifndef ST_IO_0002_H +#define ST_IO_0002_H + +#include "txcore.h" + +/* st_io_0002 전용 조회/갱신 (테이블 st_io_0002_t) */ +int st_io_0002_fetch(const char *key, long *out_amount); +int st_io_0002_touch(const char *key, long amount); +long st_io_0002_total(const char *biz_date); + +#endif /* ST_IO_0002_H */ diff --git a/app/include/st_io_0003.h b/app/include/st_io_0003.h new file mode 100644 index 0000000..75e2b99 --- /dev/null +++ b/app/include/st_io_0003.h @@ -0,0 +1,14 @@ +/* + * st_io_0003.h - 정산수수료 보조 DBIO 선언 (st_io_0003.pgc 구현) + */ +#ifndef ST_IO_0003_H +#define ST_IO_0003_H + +#include "txcore.h" + +/* st_io_0003 전용 조회/갱신 (테이블 st_io_0003_t) */ +int st_io_0003_fetch(const char *key, long *out_amount); +int st_io_0003_touch(const char *key, long amount); +long st_io_0003_total(const char *biz_date); + +#endif /* ST_IO_0003_H */ diff --git a/app/include/st_io_0004.h b/app/include/st_io_0004.h new file mode 100644 index 0000000..27b8933 --- /dev/null +++ b/app/include/st_io_0004.h @@ -0,0 +1,14 @@ +/* + * st_io_0004.h - 정산수수료 보조 DBIO 선언 (st_io_0004.pgc 구현) + */ +#ifndef ST_IO_0004_H +#define ST_IO_0004_H + +#include "txcore.h" + +/* st_io_0004 전용 조회/갱신 (테이블 st_io_0004_t) */ +int st_io_0004_fetch(const char *key, long *out_amount); +int st_io_0004_touch(const char *key, long amount); +long st_io_0004_total(const char *biz_date); + +#endif /* ST_IO_0004_H */ diff --git a/app/include/st_io_0005.h b/app/include/st_io_0005.h new file mode 100644 index 0000000..5c6c3f0 --- /dev/null +++ b/app/include/st_io_0005.h @@ -0,0 +1,14 @@ +/* + * st_io_0005.h - 정산수수료 보조 DBIO 선언 (st_io_0005.pgc 구현) + */ +#ifndef ST_IO_0005_H +#define ST_IO_0005_H + +#include "txcore.h" + +/* st_io_0005 전용 조회/갱신 (테이블 st_io_0005_t) */ +int st_io_0005_fetch(const char *key, long *out_amount); +int st_io_0005_touch(const char *key, long amount); +long st_io_0005_total(const char *biz_date); + +#endif /* ST_IO_0005_H */ diff --git a/app/include/st_io_0006.h b/app/include/st_io_0006.h new file mode 100644 index 0000000..97c8f79 --- /dev/null +++ b/app/include/st_io_0006.h @@ -0,0 +1,14 @@ +/* + * st_io_0006.h - 정산수수료 보조 DBIO 선언 (st_io_0006.pgc 구현) + */ +#ifndef ST_IO_0006_H +#define ST_IO_0006_H + +#include "txcore.h" + +/* st_io_0006 전용 조회/갱신 (테이블 st_io_0006_t) */ +int st_io_0006_fetch(const char *key, long *out_amount); +int st_io_0006_touch(const char *key, long amount); +long st_io_0006_total(const char *biz_date); + +#endif /* ST_IO_0006_H */ diff --git a/app/include/st_io_0007.h b/app/include/st_io_0007.h new file mode 100644 index 0000000..435976f --- /dev/null +++ b/app/include/st_io_0007.h @@ -0,0 +1,14 @@ +/* + * st_io_0007.h - 정산수수료 보조 DBIO 선언 (st_io_0007.pgc 구현) + */ +#ifndef ST_IO_0007_H +#define ST_IO_0007_H + +#include "txcore.h" + +/* st_io_0007 전용 조회/갱신 (테이블 st_io_0007_t) */ +int st_io_0007_fetch(const char *key, long *out_amount); +int st_io_0007_touch(const char *key, long amount); +long st_io_0007_total(const char *biz_date); + +#endif /* ST_IO_0007_H */ diff --git a/app/include/st_io_0008.h b/app/include/st_io_0008.h new file mode 100644 index 0000000..4670a98 --- /dev/null +++ b/app/include/st_io_0008.h @@ -0,0 +1,14 @@ +/* + * st_io_0008.h - 정산수수료 보조 DBIO 선언 (st_io_0008.pgc 구현) + */ +#ifndef ST_IO_0008_H +#define ST_IO_0008_H + +#include "txcore.h" + +/* st_io_0008 전용 조회/갱신 (테이블 st_io_0008_t) */ +int st_io_0008_fetch(const char *key, long *out_amount); +int st_io_0008_touch(const char *key, long amount); +long st_io_0008_total(const char *biz_date); + +#endif /* ST_IO_0008_H */ diff --git a/app/include/st_io_0009.h b/app/include/st_io_0009.h new file mode 100644 index 0000000..7f79d13 --- /dev/null +++ b/app/include/st_io_0009.h @@ -0,0 +1,14 @@ +/* + * st_io_0009.h - 정산수수료 보조 DBIO 선언 (st_io_0009.pgc 구현) + */ +#ifndef ST_IO_0009_H +#define ST_IO_0009_H + +#include "txcore.h" + +/* st_io_0009 전용 조회/갱신 (테이블 st_io_0009_t) */ +int st_io_0009_fetch(const char *key, long *out_amount); +int st_io_0009_touch(const char *key, long amount); +long st_io_0009_total(const char *biz_date); + +#endif /* ST_IO_0009_H */ diff --git a/app/include/st_io_0010.h b/app/include/st_io_0010.h new file mode 100644 index 0000000..b46c1b5 --- /dev/null +++ b/app/include/st_io_0010.h @@ -0,0 +1,14 @@ +/* + * st_io_0010.h - 정산수수료 보조 DBIO 선언 (st_io_0010.pgc 구현) + */ +#ifndef ST_IO_0010_H +#define ST_IO_0010_H + +#include "txcore.h" + +/* st_io_0010 전용 조회/갱신 (테이블 st_io_0010_t) */ +int st_io_0010_fetch(const char *key, long *out_amount); +int st_io_0010_touch(const char *key, long amount); +long st_io_0010_total(const char *biz_date); + +#endif /* ST_IO_0010_H */ diff --git a/app/include/st_io_0011.h b/app/include/st_io_0011.h new file mode 100644 index 0000000..5ce9f94 --- /dev/null +++ b/app/include/st_io_0011.h @@ -0,0 +1,14 @@ +/* + * st_io_0011.h - 정산수수료 보조 DBIO 선언 (st_io_0011.pgc 구현) + */ +#ifndef ST_IO_0011_H +#define ST_IO_0011_H + +#include "txcore.h" + +/* st_io_0011 전용 조회/갱신 (테이블 st_io_0011_t) */ +int st_io_0011_fetch(const char *key, long *out_amount); +int st_io_0011_touch(const char *key, long amount); +long st_io_0011_total(const char *biz_date); + +#endif /* ST_IO_0011_H */ diff --git a/app/include/st_io_0012.h b/app/include/st_io_0012.h new file mode 100644 index 0000000..2505ad5 --- /dev/null +++ b/app/include/st_io_0012.h @@ -0,0 +1,14 @@ +/* + * st_io_0012.h - 정산수수료 보조 DBIO 선언 (st_io_0012.pgc 구현) + */ +#ifndef ST_IO_0012_H +#define ST_IO_0012_H + +#include "txcore.h" + +/* st_io_0012 전용 조회/갱신 (테이블 st_io_0012_t) */ +int st_io_0012_fetch(const char *key, long *out_amount); +int st_io_0012_touch(const char *key, long amount); +long st_io_0012_total(const char *biz_date); + +#endif /* ST_IO_0012_H */ diff --git a/app/include/st_io_0013.h b/app/include/st_io_0013.h new file mode 100644 index 0000000..e4e5906 --- /dev/null +++ b/app/include/st_io_0013.h @@ -0,0 +1,14 @@ +/* + * st_io_0013.h - 정산수수료 보조 DBIO 선언 (st_io_0013.pgc 구현) + */ +#ifndef ST_IO_0013_H +#define ST_IO_0013_H + +#include "txcore.h" + +/* st_io_0013 전용 조회/갱신 (테이블 st_io_0013_t) */ +int st_io_0013_fetch(const char *key, long *out_amount); +int st_io_0013_touch(const char *key, long amount); +long st_io_0013_total(const char *biz_date); + +#endif /* ST_IO_0013_H */ diff --git a/app/include/st_io_0014.h b/app/include/st_io_0014.h new file mode 100644 index 0000000..615d060 --- /dev/null +++ b/app/include/st_io_0014.h @@ -0,0 +1,14 @@ +/* + * st_io_0014.h - 정산수수료 보조 DBIO 선언 (st_io_0014.pgc 구현) + */ +#ifndef ST_IO_0014_H +#define ST_IO_0014_H + +#include "txcore.h" + +/* st_io_0014 전용 조회/갱신 (테이블 st_io_0014_t) */ +int st_io_0014_fetch(const char *key, long *out_amount); +int st_io_0014_touch(const char *key, long amount); +long st_io_0014_total(const char *biz_date); + +#endif /* ST_IO_0014_H */ diff --git a/app/include/st_io_0015.h b/app/include/st_io_0015.h new file mode 100644 index 0000000..32f80a7 --- /dev/null +++ b/app/include/st_io_0015.h @@ -0,0 +1,14 @@ +/* + * st_io_0015.h - 정산수수료 보조 DBIO 선언 (st_io_0015.pgc 구현) + */ +#ifndef ST_IO_0015_H +#define ST_IO_0015_H + +#include "txcore.h" + +/* st_io_0015 전용 조회/갱신 (테이블 st_io_0015_t) */ +int st_io_0015_fetch(const char *key, long *out_amount); +int st_io_0015_touch(const char *key, long amount); +long st_io_0015_total(const char *biz_date); + +#endif /* ST_IO_0015_H */ diff --git a/app/include/st_io_0016.h b/app/include/st_io_0016.h new file mode 100644 index 0000000..cc76a82 --- /dev/null +++ b/app/include/st_io_0016.h @@ -0,0 +1,14 @@ +/* + * st_io_0016.h - 정산수수료 보조 DBIO 선언 (st_io_0016.pgc 구현) + */ +#ifndef ST_IO_0016_H +#define ST_IO_0016_H + +#include "txcore.h" + +/* st_io_0016 전용 조회/갱신 (테이블 st_io_0016_t) */ +int st_io_0016_fetch(const char *key, long *out_amount); +int st_io_0016_touch(const char *key, long amount); +long st_io_0016_total(const char *biz_date); + +#endif /* ST_IO_0016_H */ diff --git a/app/include/st_io_0017.h b/app/include/st_io_0017.h new file mode 100644 index 0000000..adf75e5 --- /dev/null +++ b/app/include/st_io_0017.h @@ -0,0 +1,14 @@ +/* + * st_io_0017.h - 정산수수료 보조 DBIO 선언 (st_io_0017.pgc 구현) + */ +#ifndef ST_IO_0017_H +#define ST_IO_0017_H + +#include "txcore.h" + +/* st_io_0017 전용 조회/갱신 (테이블 st_io_0017_t) */ +int st_io_0017_fetch(const char *key, long *out_amount); +int st_io_0017_touch(const char *key, long amount); +long st_io_0017_total(const char *biz_date); + +#endif /* ST_IO_0017_H */ diff --git a/app/include/st_io_0018.h b/app/include/st_io_0018.h new file mode 100644 index 0000000..798e8e1 --- /dev/null +++ b/app/include/st_io_0018.h @@ -0,0 +1,14 @@ +/* + * st_io_0018.h - 정산수수료 보조 DBIO 선언 (st_io_0018.pgc 구현) + */ +#ifndef ST_IO_0018_H +#define ST_IO_0018_H + +#include "txcore.h" + +/* st_io_0018 전용 조회/갱신 (테이블 st_io_0018_t) */ +int st_io_0018_fetch(const char *key, long *out_amount); +int st_io_0018_touch(const char *key, long amount); +long st_io_0018_total(const char *biz_date); + +#endif /* ST_IO_0018_H */ diff --git a/app/include/st_io_0019.h b/app/include/st_io_0019.h new file mode 100644 index 0000000..68e45fa --- /dev/null +++ b/app/include/st_io_0019.h @@ -0,0 +1,14 @@ +/* + * st_io_0019.h - 정산수수료 보조 DBIO 선언 (st_io_0019.pgc 구현) + */ +#ifndef ST_IO_0019_H +#define ST_IO_0019_H + +#include "txcore.h" + +/* st_io_0019 전용 조회/갱신 (테이블 st_io_0019_t) */ +int st_io_0019_fetch(const char *key, long *out_amount); +int st_io_0019_touch(const char *key, long amount); +long st_io_0019_total(const char *biz_date); + +#endif /* ST_IO_0019_H */ diff --git a/app/include/st_io_0020.h b/app/include/st_io_0020.h new file mode 100644 index 0000000..cd8c70c --- /dev/null +++ b/app/include/st_io_0020.h @@ -0,0 +1,14 @@ +/* + * st_io_0020.h - 정산수수료 보조 DBIO 선언 (st_io_0020.pgc 구현) + */ +#ifndef ST_IO_0020_H +#define ST_IO_0020_H + +#include "txcore.h" + +/* st_io_0020 전용 조회/갱신 (테이블 st_io_0020_t) */ +int st_io_0020_fetch(const char *key, long *out_amount); +int st_io_0020_touch(const char *key, long amount); +long st_io_0020_total(const char *biz_date); + +#endif /* ST_IO_0020_H */ diff --git a/app/include/st_io_0021.h b/app/include/st_io_0021.h new file mode 100644 index 0000000..4b0b8cf --- /dev/null +++ b/app/include/st_io_0021.h @@ -0,0 +1,14 @@ +/* + * st_io_0021.h - 정산수수료 보조 DBIO 선언 (st_io_0021.pgc 구현) + */ +#ifndef ST_IO_0021_H +#define ST_IO_0021_H + +#include "txcore.h" + +/* st_io_0021 전용 조회/갱신 (테이블 st_io_0021_t) */ +int st_io_0021_fetch(const char *key, long *out_amount); +int st_io_0021_touch(const char *key, long amount); +long st_io_0021_total(const char *biz_date); + +#endif /* ST_IO_0021_H */ diff --git a/app/include/st_io_0022.h b/app/include/st_io_0022.h new file mode 100644 index 0000000..74223a9 --- /dev/null +++ b/app/include/st_io_0022.h @@ -0,0 +1,14 @@ +/* + * st_io_0022.h - 정산수수료 보조 DBIO 선언 (st_io_0022.pgc 구현) + */ +#ifndef ST_IO_0022_H +#define ST_IO_0022_H + +#include "txcore.h" + +/* st_io_0022 전용 조회/갱신 (테이블 st_io_0022_t) */ +int st_io_0022_fetch(const char *key, long *out_amount); +int st_io_0022_touch(const char *key, long amount); +long st_io_0022_total(const char *biz_date); + +#endif /* ST_IO_0022_H */ diff --git a/app/include/st_io_0023.h b/app/include/st_io_0023.h new file mode 100644 index 0000000..11cf90c --- /dev/null +++ b/app/include/st_io_0023.h @@ -0,0 +1,14 @@ +/* + * st_io_0023.h - 정산수수료 보조 DBIO 선언 (st_io_0023.pgc 구현) + */ +#ifndef ST_IO_0023_H +#define ST_IO_0023_H + +#include "txcore.h" + +/* st_io_0023 전용 조회/갱신 (테이블 st_io_0023_t) */ +int st_io_0023_fetch(const char *key, long *out_amount); +int st_io_0023_touch(const char *key, long amount); +long st_io_0023_total(const char *biz_date); + +#endif /* ST_IO_0023_H */ diff --git a/app/include/st_io_0024.h b/app/include/st_io_0024.h new file mode 100644 index 0000000..c83e071 --- /dev/null +++ b/app/include/st_io_0024.h @@ -0,0 +1,14 @@ +/* + * st_io_0024.h - 정산수수료 보조 DBIO 선언 (st_io_0024.pgc 구현) + */ +#ifndef ST_IO_0024_H +#define ST_IO_0024_H + +#include "txcore.h" + +/* st_io_0024 전용 조회/갱신 (테이블 st_io_0024_t) */ +int st_io_0024_fetch(const char *key, long *out_amount); +int st_io_0024_touch(const char *key, long amount); +long st_io_0024_total(const char *biz_date); + +#endif /* ST_IO_0024_H */ diff --git a/app/include/st_io_0025.h b/app/include/st_io_0025.h new file mode 100644 index 0000000..7ff42db --- /dev/null +++ b/app/include/st_io_0025.h @@ -0,0 +1,14 @@ +/* + * st_io_0025.h - 정산수수료 보조 DBIO 선언 (st_io_0025.pgc 구현) + */ +#ifndef ST_IO_0025_H +#define ST_IO_0025_H + +#include "txcore.h" + +/* st_io_0025 전용 조회/갱신 (테이블 st_io_0025_t) */ +int st_io_0025_fetch(const char *key, long *out_amount); +int st_io_0025_touch(const char *key, long amount); +long st_io_0025_total(const char *biz_date); + +#endif /* ST_IO_0025_H */ diff --git a/app/include/st_io_0026.h b/app/include/st_io_0026.h new file mode 100644 index 0000000..5ce8f3c --- /dev/null +++ b/app/include/st_io_0026.h @@ -0,0 +1,14 @@ +/* + * st_io_0026.h - 정산수수료 보조 DBIO 선언 (st_io_0026.pgc 구현) + */ +#ifndef ST_IO_0026_H +#define ST_IO_0026_H + +#include "txcore.h" + +/* st_io_0026 전용 조회/갱신 (테이블 st_io_0026_t) */ +int st_io_0026_fetch(const char *key, long *out_amount); +int st_io_0026_touch(const char *key, long amount); +long st_io_0026_total(const char *biz_date); + +#endif /* ST_IO_0026_H */ diff --git a/app/include/vl_core.h b/app/include/vl_core.h new file mode 100644 index 0000000..1296218 --- /dev/null +++ b/app/include/vl_core.h @@ -0,0 +1,38 @@ +/* + * vl_core.h - 정합성 모듈 핵심 계약 (레코드/상태/표준 DBIO API) + * + * 이 모듈의 온라인/배치 프로그램은 SQL 을 직접 다루지 않고 아래 표준 + * DBIO API 만 호출한다. 구현은 app/dbio/vl_dbio_main.pgc (ECPG). + */ +#ifndef VL_CORE_H +#define VL_CORE_H + +#include "txcore.h" + +/* 정합성 처리 상태코드 */ +#define VL_ST_RECV "R" /* 접수/수신 */ +#define VL_ST_DONE "M" /* 처리완료 */ +#define VL_ST_FAIL "U" /* 불일치/실패 */ +#define VL_ST_SETTLED "S" /* 정산완료 */ + +/* 정합성 원장 레코드 (1행) */ +typedef struct { + char key[16]; /* 처리키(승인/거래 번호) PK */ + char merch_id[16]; /* 가맹점번호 */ + char card_no[20]; /* 카드번호(마스킹) */ + long amount; /* 거래금액(원) */ + char biz_date[9]; /* 영업일 YYYYMMDD */ + char status[2]; /* 상태코드 */ + long fee; /* 수수료(원) */ +} vl_rec_t; + +/* 표준 DBIO API (구현: vl_dbio_main.pgc) */ +int vl_dbio_connect(const char *target); +int vl_dbio_disconnect(void); +int vl_rec_insert(const vl_rec_t *rec); +int vl_rec_select(const char *key, vl_rec_t *out); +int vl_rec_update_status(const char *key, const char *status); +long vl_rec_count(const char *biz_date, const char *status); +int vl_rec_sum(const char *biz_date, long *out_sum); + +#endif /* VL_CORE_H */ diff --git a/app/include/vl_cu_0001.h b/app/include/vl_cu_0001.h new file mode 100644 index 0000000..ea3b3e6 --- /dev/null +++ b/app/include/vl_cu_0001.h @@ -0,0 +1,11 @@ +/* + * vl_cu_0001.h - 정합성 공통 유틸 선언 (vl_cu_0001.c 구현) + */ +#ifndef VL_CU_0001_H +#define VL_CU_0001_H + +long vl_cu_0001_fee(long amount, int rate_bp); +long vl_cu_0001_round_unit(long amount, long unit); +int vl_cu_0001_classify(long amount); + +#endif /* VL_CU_0001_H */ diff --git a/app/include/vl_cu_0002.h b/app/include/vl_cu_0002.h new file mode 100644 index 0000000..188f1bd --- /dev/null +++ b/app/include/vl_cu_0002.h @@ -0,0 +1,11 @@ +/* + * vl_cu_0002.h - 정합성 공통 유틸 선언 (vl_cu_0002.c 구현) + */ +#ifndef VL_CU_0002_H +#define VL_CU_0002_H + +long vl_cu_0002_fee(long amount, int rate_bp); +long vl_cu_0002_round_unit(long amount, long unit); +int vl_cu_0002_classify(long amount); + +#endif /* VL_CU_0002_H */ diff --git a/app/include/vl_cu_0003.h b/app/include/vl_cu_0003.h new file mode 100644 index 0000000..10056e0 --- /dev/null +++ b/app/include/vl_cu_0003.h @@ -0,0 +1,11 @@ +/* + * vl_cu_0003.h - 정합성 공통 유틸 선언 (vl_cu_0003.c 구현) + */ +#ifndef VL_CU_0003_H +#define VL_CU_0003_H + +long vl_cu_0003_fee(long amount, int rate_bp); +long vl_cu_0003_round_unit(long amount, long unit); +int vl_cu_0003_classify(long amount); + +#endif /* VL_CU_0003_H */ diff --git a/app/include/vl_cu_0004.h b/app/include/vl_cu_0004.h new file mode 100644 index 0000000..9925f80 --- /dev/null +++ b/app/include/vl_cu_0004.h @@ -0,0 +1,11 @@ +/* + * vl_cu_0004.h - 정합성 공통 유틸 선언 (vl_cu_0004.c 구현) + */ +#ifndef VL_CU_0004_H +#define VL_CU_0004_H + +long vl_cu_0004_fee(long amount, int rate_bp); +long vl_cu_0004_round_unit(long amount, long unit); +int vl_cu_0004_classify(long amount); + +#endif /* VL_CU_0004_H */ diff --git a/app/include/vl_cu_0005.h b/app/include/vl_cu_0005.h new file mode 100644 index 0000000..9a65318 --- /dev/null +++ b/app/include/vl_cu_0005.h @@ -0,0 +1,11 @@ +/* + * vl_cu_0005.h - 정합성 공통 유틸 선언 (vl_cu_0005.c 구현) + */ +#ifndef VL_CU_0005_H +#define VL_CU_0005_H + +long vl_cu_0005_fee(long amount, int rate_bp); +long vl_cu_0005_round_unit(long amount, long unit); +int vl_cu_0005_classify(long amount); + +#endif /* VL_CU_0005_H */ diff --git a/app/include/vl_cu_0006.h b/app/include/vl_cu_0006.h new file mode 100644 index 0000000..7265675 --- /dev/null +++ b/app/include/vl_cu_0006.h @@ -0,0 +1,11 @@ +/* + * vl_cu_0006.h - 정합성 공통 유틸 선언 (vl_cu_0006.c 구현) + */ +#ifndef VL_CU_0006_H +#define VL_CU_0006_H + +long vl_cu_0006_fee(long amount, int rate_bp); +long vl_cu_0006_round_unit(long amount, long unit); +int vl_cu_0006_classify(long amount); + +#endif /* VL_CU_0006_H */ diff --git a/app/include/vl_cu_0007.h b/app/include/vl_cu_0007.h new file mode 100644 index 0000000..5cf319e --- /dev/null +++ b/app/include/vl_cu_0007.h @@ -0,0 +1,11 @@ +/* + * vl_cu_0007.h - 정합성 공통 유틸 선언 (vl_cu_0007.c 구현) + */ +#ifndef VL_CU_0007_H +#define VL_CU_0007_H + +long vl_cu_0007_fee(long amount, int rate_bp); +long vl_cu_0007_round_unit(long amount, long unit); +int vl_cu_0007_classify(long amount); + +#endif /* VL_CU_0007_H */ diff --git a/app/include/vl_cu_0008.h b/app/include/vl_cu_0008.h new file mode 100644 index 0000000..8fc4891 --- /dev/null +++ b/app/include/vl_cu_0008.h @@ -0,0 +1,11 @@ +/* + * vl_cu_0008.h - 정합성 공통 유틸 선언 (vl_cu_0008.c 구현) + */ +#ifndef VL_CU_0008_H +#define VL_CU_0008_H + +long vl_cu_0008_fee(long amount, int rate_bp); +long vl_cu_0008_round_unit(long amount, long unit); +int vl_cu_0008_classify(long amount); + +#endif /* VL_CU_0008_H */ diff --git a/app/include/vl_cu_0009.h b/app/include/vl_cu_0009.h new file mode 100644 index 0000000..94b853a --- /dev/null +++ b/app/include/vl_cu_0009.h @@ -0,0 +1,11 @@ +/* + * vl_cu_0009.h - 정합성 공통 유틸 선언 (vl_cu_0009.c 구현) + */ +#ifndef VL_CU_0009_H +#define VL_CU_0009_H + +long vl_cu_0009_fee(long amount, int rate_bp); +long vl_cu_0009_round_unit(long amount, long unit); +int vl_cu_0009_classify(long amount); + +#endif /* VL_CU_0009_H */ diff --git a/app/include/vl_cu_0010.h b/app/include/vl_cu_0010.h new file mode 100644 index 0000000..7ab60a2 --- /dev/null +++ b/app/include/vl_cu_0010.h @@ -0,0 +1,11 @@ +/* + * vl_cu_0010.h - 정합성 공통 유틸 선언 (vl_cu_0010.c 구현) + */ +#ifndef VL_CU_0010_H +#define VL_CU_0010_H + +long vl_cu_0010_fee(long amount, int rate_bp); +long vl_cu_0010_round_unit(long amount, long unit); +int vl_cu_0010_classify(long amount); + +#endif /* VL_CU_0010_H */ diff --git a/app/include/vl_cu_0011.h b/app/include/vl_cu_0011.h new file mode 100644 index 0000000..6001109 --- /dev/null +++ b/app/include/vl_cu_0011.h @@ -0,0 +1,11 @@ +/* + * vl_cu_0011.h - 정합성 공통 유틸 선언 (vl_cu_0011.c 구현) + */ +#ifndef VL_CU_0011_H +#define VL_CU_0011_H + +long vl_cu_0011_fee(long amount, int rate_bp); +long vl_cu_0011_round_unit(long amount, long unit); +int vl_cu_0011_classify(long amount); + +#endif /* VL_CU_0011_H */ diff --git a/app/include/vl_h_0001.h b/app/include/vl_h_0001.h new file mode 100644 index 0000000..bedc86c --- /dev/null +++ b/app/include/vl_h_0001.h @@ -0,0 +1,22 @@ +/* + * vl_h_0001.h - 정합성 레코드/뷰 구조 정의 + */ +#ifndef VL_H_0001_H +#define VL_H_0001_H + +/* 정합성 처리 뷰 레코드 */ +typedef struct { + char key[16]; + char merch_id[16]; + long amount; + long fee; + char biz_date[9]; + char status[2]; + char reserved[16]; +} vl_h_0001_view_t; + +#define VL_H_0001_STATUS_OPEN "O" +#define VL_H_0001_STATUS_HOLD "H" +#define VL_H_0001_STATUS_CLOSE "C" + +#endif /* VL_H_0001_H */ diff --git a/app/include/vl_h_0002.h b/app/include/vl_h_0002.h new file mode 100644 index 0000000..91209a9 --- /dev/null +++ b/app/include/vl_h_0002.h @@ -0,0 +1,13 @@ +/* + * vl_h_0002.h - 정합성 내부 헬퍼 선언 + */ +#ifndef VL_H_0002_H +#define VL_H_0002_H + +#include "txcore.h" + +int vl_h_0002_check(const char *key, long amount); +int vl_h_0002_apply(TXBUF *in, TXBUF *out); +long vl_h_0002_eval(long amount, int factor); + +#endif /* VL_H_0002_H */ diff --git a/app/include/vl_h_0003.h b/app/include/vl_h_0003.h new file mode 100644 index 0000000..0a23bee --- /dev/null +++ b/app/include/vl_h_0003.h @@ -0,0 +1,20 @@ +/* + * vl_h_0003.h - 정합성 코드/상수 테이블 + */ +#ifndef VL_H_0003_H +#define VL_H_0003_H + +#define VL_H_0003_RC_OK 0 +#define VL_H_0003_RC_RETRY 1 +#define VL_H_0003_RC_SKIP 2 +#define VL_H_0003_RC_ERROR 9 + +#define VL_H_0003_LIMIT_DAILY 100000000L +#define VL_H_0003_LIMIT_SINGLE 50000000L +#define VL_H_0003_FEE_RATE_BP 250 /* 2.50% */ + +#define VL_H_0003_CHAN_ONLINE "01" +#define VL_H_0003_CHAN_BATCH "02" +#define VL_H_0003_CHAN_RECON "03" + +#endif /* VL_H_0003_H */ diff --git a/app/include/vl_h_0004.h b/app/include/vl_h_0004.h new file mode 100644 index 0000000..a9115ac --- /dev/null +++ b/app/include/vl_h_0004.h @@ -0,0 +1,19 @@ +/* + * vl_h_0004.h - 정합성 고정길이 전문 레이아웃 (positional, 재배치 금지) + */ +#ifndef VL_H_0004_H +#define VL_H_0004_H + +typedef struct { + char msg_type[4]; /* 전문구분 4 */ + char merch_id[15]; /* 가맹점번호 15 */ + char key[9]; /* 처리키 9 */ + char amount[12]; /* 금액 12 zero-pad */ + char biz_date[8]; /* 영업일 8 */ + char resp_code[4]; /* 응답코드 4 */ + char filler[20]; /* 예비 20 */ +} vl_h_0004_msg_t; + +#define VL_H_0004_MSG_LEN ((int)sizeof(vl_h_0004_msg_t)) + +#endif /* VL_H_0004_H */ diff --git a/app/include/vl_h_0005.h b/app/include/vl_h_0005.h new file mode 100644 index 0000000..e588c2c --- /dev/null +++ b/app/include/vl_h_0005.h @@ -0,0 +1,22 @@ +/* + * vl_h_0005.h - 정합성 레코드/뷰 구조 정의 + */ +#ifndef VL_H_0005_H +#define VL_H_0005_H + +/* 정합성 처리 뷰 레코드 */ +typedef struct { + char key[16]; + char merch_id[16]; + long amount; + long fee; + char biz_date[9]; + char status[2]; + char reserved[16]; +} vl_h_0005_view_t; + +#define VL_H_0005_STATUS_OPEN "O" +#define VL_H_0005_STATUS_HOLD "H" +#define VL_H_0005_STATUS_CLOSE "C" + +#endif /* VL_H_0005_H */ diff --git a/app/include/vl_h_0006.h b/app/include/vl_h_0006.h new file mode 100644 index 0000000..ca3d211 --- /dev/null +++ b/app/include/vl_h_0006.h @@ -0,0 +1,13 @@ +/* + * vl_h_0006.h - 정합성 내부 헬퍼 선언 + */ +#ifndef VL_H_0006_H +#define VL_H_0006_H + +#include "txcore.h" + +int vl_h_0006_check(const char *key, long amount); +int vl_h_0006_apply(TXBUF *in, TXBUF *out); +long vl_h_0006_eval(long amount, int factor); + +#endif /* VL_H_0006_H */ diff --git a/app/include/vl_h_0007.h b/app/include/vl_h_0007.h new file mode 100644 index 0000000..de5fff7 --- /dev/null +++ b/app/include/vl_h_0007.h @@ -0,0 +1,20 @@ +/* + * vl_h_0007.h - 정합성 코드/상수 테이블 + */ +#ifndef VL_H_0007_H +#define VL_H_0007_H + +#define VL_H_0007_RC_OK 0 +#define VL_H_0007_RC_RETRY 1 +#define VL_H_0007_RC_SKIP 2 +#define VL_H_0007_RC_ERROR 9 + +#define VL_H_0007_LIMIT_DAILY 100000000L +#define VL_H_0007_LIMIT_SINGLE 50000000L +#define VL_H_0007_FEE_RATE_BP 250 /* 2.50% */ + +#define VL_H_0007_CHAN_ONLINE "01" +#define VL_H_0007_CHAN_BATCH "02" +#define VL_H_0007_CHAN_RECON "03" + +#endif /* VL_H_0007_H */ diff --git a/app/include/vl_h_0008.h b/app/include/vl_h_0008.h new file mode 100644 index 0000000..077e599 --- /dev/null +++ b/app/include/vl_h_0008.h @@ -0,0 +1,19 @@ +/* + * vl_h_0008.h - 정합성 고정길이 전문 레이아웃 (positional, 재배치 금지) + */ +#ifndef VL_H_0008_H +#define VL_H_0008_H + +typedef struct { + char msg_type[4]; /* 전문구분 4 */ + char merch_id[15]; /* 가맹점번호 15 */ + char key[9]; /* 처리키 9 */ + char amount[12]; /* 금액 12 zero-pad */ + char biz_date[8]; /* 영업일 8 */ + char resp_code[4]; /* 응답코드 4 */ + char filler[20]; /* 예비 20 */ +} vl_h_0008_msg_t; + +#define VL_H_0008_MSG_LEN ((int)sizeof(vl_h_0008_msg_t)) + +#endif /* VL_H_0008_H */ diff --git a/app/include/vl_h_0009.h b/app/include/vl_h_0009.h new file mode 100644 index 0000000..4b3b942 --- /dev/null +++ b/app/include/vl_h_0009.h @@ -0,0 +1,22 @@ +/* + * vl_h_0009.h - 정합성 레코드/뷰 구조 정의 + */ +#ifndef VL_H_0009_H +#define VL_H_0009_H + +/* 정합성 처리 뷰 레코드 */ +typedef struct { + char key[16]; + char merch_id[16]; + long amount; + long fee; + char biz_date[9]; + char status[2]; + char reserved[16]; +} vl_h_0009_view_t; + +#define VL_H_0009_STATUS_OPEN "O" +#define VL_H_0009_STATUS_HOLD "H" +#define VL_H_0009_STATUS_CLOSE "C" + +#endif /* VL_H_0009_H */ diff --git a/app/include/vl_h_0010.h b/app/include/vl_h_0010.h new file mode 100644 index 0000000..42ba576 --- /dev/null +++ b/app/include/vl_h_0010.h @@ -0,0 +1,13 @@ +/* + * vl_h_0010.h - 정합성 내부 헬퍼 선언 + */ +#ifndef VL_H_0010_H +#define VL_H_0010_H + +#include "txcore.h" + +int vl_h_0010_check(const char *key, long amount); +int vl_h_0010_apply(TXBUF *in, TXBUF *out); +long vl_h_0010_eval(long amount, int factor); + +#endif /* VL_H_0010_H */ diff --git a/app/include/vl_h_0011.h b/app/include/vl_h_0011.h new file mode 100644 index 0000000..9871969 --- /dev/null +++ b/app/include/vl_h_0011.h @@ -0,0 +1,20 @@ +/* + * vl_h_0011.h - 정합성 코드/상수 테이블 + */ +#ifndef VL_H_0011_H +#define VL_H_0011_H + +#define VL_H_0011_RC_OK 0 +#define VL_H_0011_RC_RETRY 1 +#define VL_H_0011_RC_SKIP 2 +#define VL_H_0011_RC_ERROR 9 + +#define VL_H_0011_LIMIT_DAILY 100000000L +#define VL_H_0011_LIMIT_SINGLE 50000000L +#define VL_H_0011_FEE_RATE_BP 250 /* 2.50% */ + +#define VL_H_0011_CHAN_ONLINE "01" +#define VL_H_0011_CHAN_BATCH "02" +#define VL_H_0011_CHAN_RECON "03" + +#endif /* VL_H_0011_H */ diff --git a/app/include/vl_h_0012.h b/app/include/vl_h_0012.h new file mode 100644 index 0000000..15f211c --- /dev/null +++ b/app/include/vl_h_0012.h @@ -0,0 +1,19 @@ +/* + * vl_h_0012.h - 정합성 고정길이 전문 레이아웃 (positional, 재배치 금지) + */ +#ifndef VL_H_0012_H +#define VL_H_0012_H + +typedef struct { + char msg_type[4]; /* 전문구분 4 */ + char merch_id[15]; /* 가맹점번호 15 */ + char key[9]; /* 처리키 9 */ + char amount[12]; /* 금액 12 zero-pad */ + char biz_date[8]; /* 영업일 8 */ + char resp_code[4]; /* 응답코드 4 */ + char filler[20]; /* 예비 20 */ +} vl_h_0012_msg_t; + +#define VL_H_0012_MSG_LEN ((int)sizeof(vl_h_0012_msg_t)) + +#endif /* VL_H_0012_H */ diff --git a/app/include/vl_h_0013.h b/app/include/vl_h_0013.h new file mode 100644 index 0000000..25ca47a --- /dev/null +++ b/app/include/vl_h_0013.h @@ -0,0 +1,22 @@ +/* + * vl_h_0013.h - 정합성 레코드/뷰 구조 정의 + */ +#ifndef VL_H_0013_H +#define VL_H_0013_H + +/* 정합성 처리 뷰 레코드 */ +typedef struct { + char key[16]; + char merch_id[16]; + long amount; + long fee; + char biz_date[9]; + char status[2]; + char reserved[16]; +} vl_h_0013_view_t; + +#define VL_H_0013_STATUS_OPEN "O" +#define VL_H_0013_STATUS_HOLD "H" +#define VL_H_0013_STATUS_CLOSE "C" + +#endif /* VL_H_0013_H */ diff --git a/app/include/vl_h_0014.h b/app/include/vl_h_0014.h new file mode 100644 index 0000000..4c54744 --- /dev/null +++ b/app/include/vl_h_0014.h @@ -0,0 +1,13 @@ +/* + * vl_h_0014.h - 정합성 내부 헬퍼 선언 + */ +#ifndef VL_H_0014_H +#define VL_H_0014_H + +#include "txcore.h" + +int vl_h_0014_check(const char *key, long amount); +int vl_h_0014_apply(TXBUF *in, TXBUF *out); +long vl_h_0014_eval(long amount, int factor); + +#endif /* VL_H_0014_H */ diff --git a/app/include/vl_h_0015.h b/app/include/vl_h_0015.h new file mode 100644 index 0000000..a9269a6 --- /dev/null +++ b/app/include/vl_h_0015.h @@ -0,0 +1,20 @@ +/* + * vl_h_0015.h - 정합성 코드/상수 테이블 + */ +#ifndef VL_H_0015_H +#define VL_H_0015_H + +#define VL_H_0015_RC_OK 0 +#define VL_H_0015_RC_RETRY 1 +#define VL_H_0015_RC_SKIP 2 +#define VL_H_0015_RC_ERROR 9 + +#define VL_H_0015_LIMIT_DAILY 100000000L +#define VL_H_0015_LIMIT_SINGLE 50000000L +#define VL_H_0015_FEE_RATE_BP 250 /* 2.50% */ + +#define VL_H_0015_CHAN_ONLINE "01" +#define VL_H_0015_CHAN_BATCH "02" +#define VL_H_0015_CHAN_RECON "03" + +#endif /* VL_H_0015_H */ diff --git a/app/include/vl_h_0016.h b/app/include/vl_h_0016.h new file mode 100644 index 0000000..af12368 --- /dev/null +++ b/app/include/vl_h_0016.h @@ -0,0 +1,19 @@ +/* + * vl_h_0016.h - 정합성 고정길이 전문 레이아웃 (positional, 재배치 금지) + */ +#ifndef VL_H_0016_H +#define VL_H_0016_H + +typedef struct { + char msg_type[4]; /* 전문구분 4 */ + char merch_id[15]; /* 가맹점번호 15 */ + char key[9]; /* 처리키 9 */ + char amount[12]; /* 금액 12 zero-pad */ + char biz_date[8]; /* 영업일 8 */ + char resp_code[4]; /* 응답코드 4 */ + char filler[20]; /* 예비 20 */ +} vl_h_0016_msg_t; + +#define VL_H_0016_MSG_LEN ((int)sizeof(vl_h_0016_msg_t)) + +#endif /* VL_H_0016_H */ diff --git a/app/include/vl_io_0001.h b/app/include/vl_io_0001.h new file mode 100644 index 0000000..1dfcc8f --- /dev/null +++ b/app/include/vl_io_0001.h @@ -0,0 +1,14 @@ +/* + * vl_io_0001.h - 정합성 보조 DBIO 선언 (vl_io_0001.pgc 구현) + */ +#ifndef VL_IO_0001_H +#define VL_IO_0001_H + +#include "txcore.h" + +/* vl_io_0001 전용 조회/갱신 (테이블 vl_io_0001_t) */ +int vl_io_0001_fetch(const char *key, long *out_amount); +int vl_io_0001_touch(const char *key, long amount); +long vl_io_0001_total(const char *biz_date); + +#endif /* VL_IO_0001_H */ diff --git a/app/include/vl_io_0002.h b/app/include/vl_io_0002.h new file mode 100644 index 0000000..77015c1 --- /dev/null +++ b/app/include/vl_io_0002.h @@ -0,0 +1,14 @@ +/* + * vl_io_0002.h - 정합성 보조 DBIO 선언 (vl_io_0002.pgc 구현) + */ +#ifndef VL_IO_0002_H +#define VL_IO_0002_H + +#include "txcore.h" + +/* vl_io_0002 전용 조회/갱신 (테이블 vl_io_0002_t) */ +int vl_io_0002_fetch(const char *key, long *out_amount); +int vl_io_0002_touch(const char *key, long amount); +long vl_io_0002_total(const char *biz_date); + +#endif /* VL_IO_0002_H */ diff --git a/app/include/vl_io_0003.h b/app/include/vl_io_0003.h new file mode 100644 index 0000000..a61a1bc --- /dev/null +++ b/app/include/vl_io_0003.h @@ -0,0 +1,14 @@ +/* + * vl_io_0003.h - 정합성 보조 DBIO 선언 (vl_io_0003.pgc 구현) + */ +#ifndef VL_IO_0003_H +#define VL_IO_0003_H + +#include "txcore.h" + +/* vl_io_0003 전용 조회/갱신 (테이블 vl_io_0003_t) */ +int vl_io_0003_fetch(const char *key, long *out_amount); +int vl_io_0003_touch(const char *key, long amount); +long vl_io_0003_total(const char *biz_date); + +#endif /* VL_IO_0003_H */ diff --git a/app/include/vl_io_0004.h b/app/include/vl_io_0004.h new file mode 100644 index 0000000..a842707 --- /dev/null +++ b/app/include/vl_io_0004.h @@ -0,0 +1,14 @@ +/* + * vl_io_0004.h - 정합성 보조 DBIO 선언 (vl_io_0004.pgc 구현) + */ +#ifndef VL_IO_0004_H +#define VL_IO_0004_H + +#include "txcore.h" + +/* vl_io_0004 전용 조회/갱신 (테이블 vl_io_0004_t) */ +int vl_io_0004_fetch(const char *key, long *out_amount); +int vl_io_0004_touch(const char *key, long amount); +long vl_io_0004_total(const char *biz_date); + +#endif /* VL_IO_0004_H */ diff --git a/app/include/vl_io_0005.h b/app/include/vl_io_0005.h new file mode 100644 index 0000000..3a4f940 --- /dev/null +++ b/app/include/vl_io_0005.h @@ -0,0 +1,14 @@ +/* + * vl_io_0005.h - 정합성 보조 DBIO 선언 (vl_io_0005.pgc 구현) + */ +#ifndef VL_IO_0005_H +#define VL_IO_0005_H + +#include "txcore.h" + +/* vl_io_0005 전용 조회/갱신 (테이블 vl_io_0005_t) */ +int vl_io_0005_fetch(const char *key, long *out_amount); +int vl_io_0005_touch(const char *key, long amount); +long vl_io_0005_total(const char *biz_date); + +#endif /* VL_IO_0005_H */ diff --git a/app/include/vl_io_0006.h b/app/include/vl_io_0006.h new file mode 100644 index 0000000..fa81568 --- /dev/null +++ b/app/include/vl_io_0006.h @@ -0,0 +1,14 @@ +/* + * vl_io_0006.h - 정합성 보조 DBIO 선언 (vl_io_0006.pgc 구현) + */ +#ifndef VL_IO_0006_H +#define VL_IO_0006_H + +#include "txcore.h" + +/* vl_io_0006 전용 조회/갱신 (테이블 vl_io_0006_t) */ +int vl_io_0006_fetch(const char *key, long *out_amount); +int vl_io_0006_touch(const char *key, long amount); +long vl_io_0006_total(const char *biz_date); + +#endif /* VL_IO_0006_H */ diff --git a/app/include/vl_io_0007.h b/app/include/vl_io_0007.h new file mode 100644 index 0000000..f865967 --- /dev/null +++ b/app/include/vl_io_0007.h @@ -0,0 +1,14 @@ +/* + * vl_io_0007.h - 정합성 보조 DBIO 선언 (vl_io_0007.pgc 구현) + */ +#ifndef VL_IO_0007_H +#define VL_IO_0007_H + +#include "txcore.h" + +/* vl_io_0007 전용 조회/갱신 (테이블 vl_io_0007_t) */ +int vl_io_0007_fetch(const char *key, long *out_amount); +int vl_io_0007_touch(const char *key, long amount); +long vl_io_0007_total(const char *biz_date); + +#endif /* VL_IO_0007_H */ diff --git a/app/include/vl_io_0008.h b/app/include/vl_io_0008.h new file mode 100644 index 0000000..6183565 --- /dev/null +++ b/app/include/vl_io_0008.h @@ -0,0 +1,14 @@ +/* + * vl_io_0008.h - 정합성 보조 DBIO 선언 (vl_io_0008.pgc 구현) + */ +#ifndef VL_IO_0008_H +#define VL_IO_0008_H + +#include "txcore.h" + +/* vl_io_0008 전용 조회/갱신 (테이블 vl_io_0008_t) */ +int vl_io_0008_fetch(const char *key, long *out_amount); +int vl_io_0008_touch(const char *key, long amount); +long vl_io_0008_total(const char *biz_date); + +#endif /* VL_IO_0008_H */ diff --git a/app/include/vl_io_0009.h b/app/include/vl_io_0009.h new file mode 100644 index 0000000..2962d20 --- /dev/null +++ b/app/include/vl_io_0009.h @@ -0,0 +1,14 @@ +/* + * vl_io_0009.h - 정합성 보조 DBIO 선언 (vl_io_0009.pgc 구현) + */ +#ifndef VL_IO_0009_H +#define VL_IO_0009_H + +#include "txcore.h" + +/* vl_io_0009 전용 조회/갱신 (테이블 vl_io_0009_t) */ +int vl_io_0009_fetch(const char *key, long *out_amount); +int vl_io_0009_touch(const char *key, long amount); +long vl_io_0009_total(const char *biz_date); + +#endif /* VL_IO_0009_H */ diff --git a/app/include/vl_io_0010.h b/app/include/vl_io_0010.h new file mode 100644 index 0000000..e7a9bac --- /dev/null +++ b/app/include/vl_io_0010.h @@ -0,0 +1,14 @@ +/* + * vl_io_0010.h - 정합성 보조 DBIO 선언 (vl_io_0010.pgc 구현) + */ +#ifndef VL_IO_0010_H +#define VL_IO_0010_H + +#include "txcore.h" + +/* vl_io_0010 전용 조회/갱신 (테이블 vl_io_0010_t) */ +int vl_io_0010_fetch(const char *key, long *out_amount); +int vl_io_0010_touch(const char *key, long amount); +long vl_io_0010_total(const char *biz_date); + +#endif /* VL_IO_0010_H */ diff --git a/app/include/vl_io_0011.h b/app/include/vl_io_0011.h new file mode 100644 index 0000000..97fae3c --- /dev/null +++ b/app/include/vl_io_0011.h @@ -0,0 +1,14 @@ +/* + * vl_io_0011.h - 정합성 보조 DBIO 선언 (vl_io_0011.pgc 구현) + */ +#ifndef VL_IO_0011_H +#define VL_IO_0011_H + +#include "txcore.h" + +/* vl_io_0011 전용 조회/갱신 (테이블 vl_io_0011_t) */ +int vl_io_0011_fetch(const char *key, long *out_amount); +int vl_io_0011_touch(const char *key, long amount); +long vl_io_0011_total(const char *biz_date); + +#endif /* VL_IO_0011_H */ diff --git a/app/include/vl_io_0012.h b/app/include/vl_io_0012.h new file mode 100644 index 0000000..ac2ee94 --- /dev/null +++ b/app/include/vl_io_0012.h @@ -0,0 +1,14 @@ +/* + * vl_io_0012.h - 정합성 보조 DBIO 선언 (vl_io_0012.pgc 구현) + */ +#ifndef VL_IO_0012_H +#define VL_IO_0012_H + +#include "txcore.h" + +/* vl_io_0012 전용 조회/갱신 (테이블 vl_io_0012_t) */ +int vl_io_0012_fetch(const char *key, long *out_amount); +int vl_io_0012_touch(const char *key, long amount); +long vl_io_0012_total(const char *biz_date); + +#endif /* VL_IO_0012_H */ diff --git a/app/include/vl_io_0013.h b/app/include/vl_io_0013.h new file mode 100644 index 0000000..caa69f6 --- /dev/null +++ b/app/include/vl_io_0013.h @@ -0,0 +1,14 @@ +/* + * vl_io_0013.h - 정합성 보조 DBIO 선언 (vl_io_0013.pgc 구현) + */ +#ifndef VL_IO_0013_H +#define VL_IO_0013_H + +#include "txcore.h" + +/* vl_io_0013 전용 조회/갱신 (테이블 vl_io_0013_t) */ +int vl_io_0013_fetch(const char *key, long *out_amount); +int vl_io_0013_touch(const char *key, long amount); +long vl_io_0013_total(const char *biz_date); + +#endif /* VL_IO_0013_H */ diff --git a/app/include/vl_io_0014.h b/app/include/vl_io_0014.h new file mode 100644 index 0000000..1dd9f27 --- /dev/null +++ b/app/include/vl_io_0014.h @@ -0,0 +1,14 @@ +/* + * vl_io_0014.h - 정합성 보조 DBIO 선언 (vl_io_0014.pgc 구현) + */ +#ifndef VL_IO_0014_H +#define VL_IO_0014_H + +#include "txcore.h" + +/* vl_io_0014 전용 조회/갱신 (테이블 vl_io_0014_t) */ +int vl_io_0014_fetch(const char *key, long *out_amount); +int vl_io_0014_touch(const char *key, long amount); +long vl_io_0014_total(const char *biz_date); + +#endif /* VL_IO_0014_H */ diff --git a/app/include/vl_io_0015.h b/app/include/vl_io_0015.h new file mode 100644 index 0000000..045ecd7 --- /dev/null +++ b/app/include/vl_io_0015.h @@ -0,0 +1,14 @@ +/* + * vl_io_0015.h - 정합성 보조 DBIO 선언 (vl_io_0015.pgc 구현) + */ +#ifndef VL_IO_0015_H +#define VL_IO_0015_H + +#include "txcore.h" + +/* vl_io_0015 전용 조회/갱신 (테이블 vl_io_0015_t) */ +int vl_io_0015_fetch(const char *key, long *out_amount); +int vl_io_0015_touch(const char *key, long amount); +long vl_io_0015_total(const char *biz_date); + +#endif /* VL_IO_0015_H */ diff --git a/app/include/vl_io_0016.h b/app/include/vl_io_0016.h new file mode 100644 index 0000000..c8b9e27 --- /dev/null +++ b/app/include/vl_io_0016.h @@ -0,0 +1,14 @@ +/* + * vl_io_0016.h - 정합성 보조 DBIO 선언 (vl_io_0016.pgc 구현) + */ +#ifndef VL_IO_0016_H +#define VL_IO_0016_H + +#include "txcore.h" + +/* vl_io_0016 전용 조회/갱신 (테이블 vl_io_0016_t) */ +int vl_io_0016_fetch(const char *key, long *out_amount); +int vl_io_0016_touch(const char *key, long amount); +long vl_io_0016_total(const char *biz_date); + +#endif /* VL_IO_0016_H */ diff --git a/app/include/vl_io_0017.h b/app/include/vl_io_0017.h new file mode 100644 index 0000000..c1a9848 --- /dev/null +++ b/app/include/vl_io_0017.h @@ -0,0 +1,14 @@ +/* + * vl_io_0017.h - 정합성 보조 DBIO 선언 (vl_io_0017.pgc 구현) + */ +#ifndef VL_IO_0017_H +#define VL_IO_0017_H + +#include "txcore.h" + +/* vl_io_0017 전용 조회/갱신 (테이블 vl_io_0017_t) */ +int vl_io_0017_fetch(const char *key, long *out_amount); +int vl_io_0017_touch(const char *key, long amount); +long vl_io_0017_total(const char *biz_date); + +#endif /* VL_IO_0017_H */ diff --git a/app/include/vl_io_0018.h b/app/include/vl_io_0018.h new file mode 100644 index 0000000..ac00d77 --- /dev/null +++ b/app/include/vl_io_0018.h @@ -0,0 +1,14 @@ +/* + * vl_io_0018.h - 정합성 보조 DBIO 선언 (vl_io_0018.pgc 구현) + */ +#ifndef VL_IO_0018_H +#define VL_IO_0018_H + +#include "txcore.h" + +/* vl_io_0018 전용 조회/갱신 (테이블 vl_io_0018_t) */ +int vl_io_0018_fetch(const char *key, long *out_amount); +int vl_io_0018_touch(const char *key, long amount); +long vl_io_0018_total(const char *biz_date); + +#endif /* VL_IO_0018_H */ diff --git a/app/include/vl_io_0019.h b/app/include/vl_io_0019.h new file mode 100644 index 0000000..dc36cbe --- /dev/null +++ b/app/include/vl_io_0019.h @@ -0,0 +1,14 @@ +/* + * vl_io_0019.h - 정합성 보조 DBIO 선언 (vl_io_0019.pgc 구현) + */ +#ifndef VL_IO_0019_H +#define VL_IO_0019_H + +#include "txcore.h" + +/* vl_io_0019 전용 조회/갱신 (테이블 vl_io_0019_t) */ +int vl_io_0019_fetch(const char *key, long *out_amount); +int vl_io_0019_touch(const char *key, long amount); +long vl_io_0019_total(const char *biz_date); + +#endif /* VL_IO_0019_H */ diff --git a/app/include/vl_io_0020.h b/app/include/vl_io_0020.h new file mode 100644 index 0000000..94b4322 --- /dev/null +++ b/app/include/vl_io_0020.h @@ -0,0 +1,14 @@ +/* + * vl_io_0020.h - 정합성 보조 DBIO 선언 (vl_io_0020.pgc 구현) + */ +#ifndef VL_IO_0020_H +#define VL_IO_0020_H + +#include "txcore.h" + +/* vl_io_0020 전용 조회/갱신 (테이블 vl_io_0020_t) */ +int vl_io_0020_fetch(const char *key, long *out_amount); +int vl_io_0020_touch(const char *key, long amount); +long vl_io_0020_total(const char *biz_date); + +#endif /* VL_IO_0020_H */ diff --git a/app/include/vl_io_0021.h b/app/include/vl_io_0021.h new file mode 100644 index 0000000..7aac0ad --- /dev/null +++ b/app/include/vl_io_0021.h @@ -0,0 +1,14 @@ +/* + * vl_io_0021.h - 정합성 보조 DBIO 선언 (vl_io_0021.pgc 구현) + */ +#ifndef VL_IO_0021_H +#define VL_IO_0021_H + +#include "txcore.h" + +/* vl_io_0021 전용 조회/갱신 (테이블 vl_io_0021_t) */ +int vl_io_0021_fetch(const char *key, long *out_amount); +int vl_io_0021_touch(const char *key, long amount); +long vl_io_0021_total(const char *biz_date); + +#endif /* VL_IO_0021_H */ diff --git a/app/include/vl_io_0022.h b/app/include/vl_io_0022.h new file mode 100644 index 0000000..f46418a --- /dev/null +++ b/app/include/vl_io_0022.h @@ -0,0 +1,14 @@ +/* + * vl_io_0022.h - 정합성 보조 DBIO 선언 (vl_io_0022.pgc 구현) + */ +#ifndef VL_IO_0022_H +#define VL_IO_0022_H + +#include "txcore.h" + +/* vl_io_0022 전용 조회/갱신 (테이블 vl_io_0022_t) */ +int vl_io_0022_fetch(const char *key, long *out_amount); +int vl_io_0022_touch(const char *key, long amount); +long vl_io_0022_total(const char *biz_date); + +#endif /* VL_IO_0022_H */ diff --git a/app/include/vl_io_0023.h b/app/include/vl_io_0023.h new file mode 100644 index 0000000..1084012 --- /dev/null +++ b/app/include/vl_io_0023.h @@ -0,0 +1,14 @@ +/* + * vl_io_0023.h - 정합성 보조 DBIO 선언 (vl_io_0023.pgc 구현) + */ +#ifndef VL_IO_0023_H +#define VL_IO_0023_H + +#include "txcore.h" + +/* vl_io_0023 전용 조회/갱신 (테이블 vl_io_0023_t) */ +int vl_io_0023_fetch(const char *key, long *out_amount); +int vl_io_0023_touch(const char *key, long amount); +long vl_io_0023_total(const char *biz_date); + +#endif /* VL_IO_0023_H */ diff --git a/app/include/vl_io_0024.h b/app/include/vl_io_0024.h new file mode 100644 index 0000000..4276149 --- /dev/null +++ b/app/include/vl_io_0024.h @@ -0,0 +1,14 @@ +/* + * vl_io_0024.h - 정합성 보조 DBIO 선언 (vl_io_0024.pgc 구현) + */ +#ifndef VL_IO_0024_H +#define VL_IO_0024_H + +#include "txcore.h" + +/* vl_io_0024 전용 조회/갱신 (테이블 vl_io_0024_t) */ +int vl_io_0024_fetch(const char *key, long *out_amount); +int vl_io_0024_touch(const char *key, long amount); +long vl_io_0024_total(const char *biz_date); + +#endif /* VL_IO_0024_H */ diff --git a/app/include/vl_io_0025.h b/app/include/vl_io_0025.h new file mode 100644 index 0000000..5c8ae95 --- /dev/null +++ b/app/include/vl_io_0025.h @@ -0,0 +1,14 @@ +/* + * vl_io_0025.h - 정합성 보조 DBIO 선언 (vl_io_0025.pgc 구현) + */ +#ifndef VL_IO_0025_H +#define VL_IO_0025_H + +#include "txcore.h" + +/* vl_io_0025 전용 조회/갱신 (테이블 vl_io_0025_t) */ +int vl_io_0025_fetch(const char *key, long *out_amount); +int vl_io_0025_touch(const char *key, long amount); +long vl_io_0025_total(const char *biz_date); + +#endif /* VL_IO_0025_H */ diff --git a/app/include/vl_io_0026.h b/app/include/vl_io_0026.h new file mode 100644 index 0000000..f831735 --- /dev/null +++ b/app/include/vl_io_0026.h @@ -0,0 +1,14 @@ +/* + * vl_io_0026.h - 정합성 보조 DBIO 선언 (vl_io_0026.pgc 구현) + */ +#ifndef VL_IO_0026_H +#define VL_IO_0026_H + +#include "txcore.h" + +/* vl_io_0026 전용 조회/갱신 (테이블 vl_io_0026_t) */ +int vl_io_0026_fetch(const char *key, long *out_amount); +int vl_io_0026_touch(const char *key, long amount); +long vl_io_0026_total(const char *biz_date); + +#endif /* VL_IO_0026_H */ diff --git a/app/online/ac_ol_0001.c b/app/online/ac_ol_0001.c new file mode 100644 index 0000000..1b14960 --- /dev/null +++ b/app/online/ac_ol_0001.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/ac_ol_0001.pgc" +/* @tier easy @module ac @transform acquire-online */ +/* + * ac_ol_0001.pgc - 매입 온라인 서비스 (AC_OL_0001) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 ac 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "ac_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/ac_ol_0001.pgc" + + +TX_SERVICE(AC_OL_0001, ctx) +{ + ac_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[AC_OL_0001] 매입 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AC_OL_0001] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = ac_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[AC_OL_0001] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[AC_OL_0001] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/ac_ol_0001.pgc b/app/online/ac_ol_0001.pgc new file mode 100644 index 0000000..6a14e7c --- /dev/null +++ b/app/online/ac_ol_0001.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module ac @transform acquire-online */ +/* + * ac_ol_0001.pgc - 매입 온라인 서비스 (AC_OL_0001) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 ac 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "ac_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(AC_OL_0001, ctx) +{ + ac_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[AC_OL_0001] 매입 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AC_OL_0001] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = ac_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[AC_OL_0001] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[AC_OL_0001] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/ac_ol_0002.c b/app/online/ac_ol_0002.c new file mode 100644 index 0000000..33550d9 --- /dev/null +++ b/app/online/ac_ol_0002.c @@ -0,0 +1,148 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/ac_ol_0002.pgc" +/* @tier medium @module ac @transform acquire-online */ +/* + * ac_ol_0002.pgc - 매입 온라인 서비스 (AC_OL_0002) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 ac 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "ac_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/ac_ol_0002.pgc" + + +TX_SERVICE(AC_OL_0002, ctx) +{ + ac_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[AC_OL_0002] 매입 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AC_OL_0002] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[AC_OL_0002] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[AC_OL_0002] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, AC_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = ac_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[AC_OL_0002] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = ac_rec_count(bizdate, AC_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[AC_OL_0002] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/ac_ol_0002.pgc b/app/online/ac_ol_0002.pgc new file mode 100644 index 0000000..5c496a8 --- /dev/null +++ b/app/online/ac_ol_0002.pgc @@ -0,0 +1,70 @@ +/* @tier medium @module ac @transform acquire-online */ +/* + * ac_ol_0002.pgc - 매입 온라인 서비스 (AC_OL_0002) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 ac 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "ac_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(AC_OL_0002, ctx) +{ + ac_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[AC_OL_0002] 매입 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AC_OL_0002] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[AC_OL_0002] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[AC_OL_0002] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, AC_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = ac_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[AC_OL_0002] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = ac_rec_count(bizdate, AC_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[AC_OL_0002] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/ac_ol_0003.c b/app/online/ac_ol_0003.c new file mode 100644 index 0000000..589d639 --- /dev/null +++ b/app/online/ac_ol_0003.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/ac_ol_0003.pgc" +/* @tier easy @module ac @transform acquire-online */ +/* + * ac_ol_0003.pgc - 매입 온라인 서비스 (AC_OL_0003) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 ac 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "ac_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/ac_ol_0003.pgc" + + +TX_SERVICE(AC_OL_0003, ctx) +{ + ac_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[AC_OL_0003] 매입 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AC_OL_0003] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = ac_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[AC_OL_0003] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[AC_OL_0003] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/ac_ol_0003.pgc b/app/online/ac_ol_0003.pgc new file mode 100644 index 0000000..2bdcd73 --- /dev/null +++ b/app/online/ac_ol_0003.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module ac @transform acquire-online */ +/* + * ac_ol_0003.pgc - 매입 온라인 서비스 (AC_OL_0003) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 ac 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "ac_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(AC_OL_0003, ctx) +{ + ac_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[AC_OL_0003] 매입 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AC_OL_0003] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = ac_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[AC_OL_0003] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[AC_OL_0003] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/ac_ol_0004.c b/app/online/ac_ol_0004.c new file mode 100644 index 0000000..8d8f89c --- /dev/null +++ b/app/online/ac_ol_0004.c @@ -0,0 +1,148 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/ac_ol_0004.pgc" +/* @tier medium @module ac @transform acquire-online */ +/* + * ac_ol_0004.pgc - 매입 온라인 서비스 (AC_OL_0004) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 ac 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "ac_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/ac_ol_0004.pgc" + + +TX_SERVICE(AC_OL_0004, ctx) +{ + ac_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[AC_OL_0004] 매입 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AC_OL_0004] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[AC_OL_0004] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[AC_OL_0004] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, AC_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = ac_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[AC_OL_0004] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = ac_rec_count(bizdate, AC_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[AC_OL_0004] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/ac_ol_0004.pgc b/app/online/ac_ol_0004.pgc new file mode 100644 index 0000000..64f4dfc --- /dev/null +++ b/app/online/ac_ol_0004.pgc @@ -0,0 +1,70 @@ +/* @tier medium @module ac @transform acquire-online */ +/* + * ac_ol_0004.pgc - 매입 온라인 서비스 (AC_OL_0004) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 ac 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "ac_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(AC_OL_0004, ctx) +{ + ac_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[AC_OL_0004] 매입 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AC_OL_0004] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[AC_OL_0004] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[AC_OL_0004] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, AC_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = ac_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[AC_OL_0004] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = ac_rec_count(bizdate, AC_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[AC_OL_0004] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/ac_ol_0005.c b/app/online/ac_ol_0005.c new file mode 100644 index 0000000..d138a24 --- /dev/null +++ b/app/online/ac_ol_0005.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/ac_ol_0005.pgc" +/* @tier easy @module ac @transform acquire-online */ +/* + * ac_ol_0005.pgc - 매입 온라인 서비스 (AC_OL_0005) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 ac 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "ac_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/ac_ol_0005.pgc" + + +TX_SERVICE(AC_OL_0005, ctx) +{ + ac_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[AC_OL_0005] 매입 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AC_OL_0005] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = ac_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[AC_OL_0005] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[AC_OL_0005] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/ac_ol_0005.pgc b/app/online/ac_ol_0005.pgc new file mode 100644 index 0000000..19c2499 --- /dev/null +++ b/app/online/ac_ol_0005.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module ac @transform acquire-online */ +/* + * ac_ol_0005.pgc - 매입 온라인 서비스 (AC_OL_0005) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 ac 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "ac_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(AC_OL_0005, ctx) +{ + ac_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[AC_OL_0005] 매입 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AC_OL_0005] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = ac_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[AC_OL_0005] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[AC_OL_0005] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/ac_ol_0006.c b/app/online/ac_ol_0006.c new file mode 100644 index 0000000..ae1852c --- /dev/null +++ b/app/online/ac_ol_0006.c @@ -0,0 +1,176 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/ac_ol_0006.pgc" +/* @tier hard @module ac @transform acquire-online */ +/* + * ac_ol_0006.pgc - 매입 온라인 서비스 (AC_OL_0006) [tier=hard] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 ac 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "ac_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/ac_ol_0006.pgc" + + +TX_SERVICE(AC_OL_0006, ctx) +{ + ac_rec_t rec; + char key[16], merch[16], bizdate[16], nextbiz[9]; + long amount = 0, daysum = 0; + int rc; + TXBUF *sub_in; + TXBUF *sub_out; + + tx_log(TX_LOG_INFO, "[AC_OL_0006] 매입 트랜잭션 오케스트레이션 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AC_OL_0006] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + if (!amount_is_valid(amount) || !date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[AC_OL_0006] 입력 검증 실패 amount=%ld date=%s", + amount, bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + /* 트랜잭션 시작 → 원장 반영 → 후속 서비스 연계 → 커밋 */ + if (tx_begin() != TX_OK) { + tx_return(ctx, TX_FAIL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, AC_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; + + rc = ac_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[AC_OL_0006] 원장반영 실패 rc=%d", rc); + tx_abort(); + tx_return(ctx, rc, ctx->out); + return; + } + + /* 정산 영업일 = 거래일의 다음 영업일 */ + if (date_next_business(bizdate, nextbiz) != 0) { + memcpy(nextbiz, bizdate, 8); + nextbiz[8] = '\0'; + } + + /* 후속 정산집계 서비스 연계 (레지스트리 문자열 디스패치) */ + sub_in = tx_buf_alloc(); + sub_out = tx_buf_alloc(); + if (sub_in && sub_out) { + tx_buf_sets(sub_in, "MERCHID", merch); + tx_buf_sets(sub_in, "BIZDATE", nextbiz); + tx_buf_setlong(sub_in, "AMOUNT", amount); + rc = tx_call("AC_POST", sub_in, sub_out); + if (rc != TX_OK) + tx_log(TX_LOG_WARN, "[AC_OL_0006] 후속연계 경고 rc=%d", rc); + } + tx_buf_free(sub_in); + tx_buf_free(sub_out); + + /* 교차 검증: 당일 합계 재계산 */ + if (ac_rec_sum(bizdate, &daysum) != TX_OK) + daysum = 0; + + tx_commit(); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYSUM", daysum); + tx_log(TX_LOG_INFO, "[AC_OL_0006] 완료 key=%s 당일합계=%ld", key, daysum); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/ac_ol_0006.pgc b/app/online/ac_ol_0006.pgc new file mode 100644 index 0000000..3df3999 --- /dev/null +++ b/app/online/ac_ol_0006.pgc @@ -0,0 +1,98 @@ +/* @tier hard @module ac @transform acquire-online */ +/* + * ac_ol_0006.pgc - 매입 온라인 서비스 (AC_OL_0006) [tier=hard] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 ac 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "ac_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(AC_OL_0006, ctx) +{ + ac_rec_t rec; + char key[16], merch[16], bizdate[16], nextbiz[9]; + long amount = 0, daysum = 0; + int rc; + TXBUF *sub_in; + TXBUF *sub_out; + + tx_log(TX_LOG_INFO, "[AC_OL_0006] 매입 트랜잭션 오케스트레이션 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AC_OL_0006] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + if (!amount_is_valid(amount) || !date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[AC_OL_0006] 입력 검증 실패 amount=%ld date=%s", + amount, bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + /* 트랜잭션 시작 → 원장 반영 → 후속 서비스 연계 → 커밋 */ + if (tx_begin() != TX_OK) { + tx_return(ctx, TX_FAIL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, AC_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; + + rc = ac_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[AC_OL_0006] 원장반영 실패 rc=%d", rc); + tx_abort(); + tx_return(ctx, rc, ctx->out); + return; + } + + /* 정산 영업일 = 거래일의 다음 영업일 */ + if (date_next_business(bizdate, nextbiz) != 0) { + memcpy(nextbiz, bizdate, 8); + nextbiz[8] = '\0'; + } + + /* 후속 정산집계 서비스 연계 (레지스트리 문자열 디스패치) */ + sub_in = tx_buf_alloc(); + sub_out = tx_buf_alloc(); + if (sub_in && sub_out) { + tx_buf_sets(sub_in, "MERCHID", merch); + tx_buf_sets(sub_in, "BIZDATE", nextbiz); + tx_buf_setlong(sub_in, "AMOUNT", amount); + rc = tx_call("AC_POST", sub_in, sub_out); + if (rc != TX_OK) + tx_log(TX_LOG_WARN, "[AC_OL_0006] 후속연계 경고 rc=%d", rc); + } + tx_buf_free(sub_in); + tx_buf_free(sub_out); + + /* 교차 검증: 당일 합계 재계산 */ + if (ac_rec_sum(bizdate, &daysum) != TX_OK) + daysum = 0; + + tx_commit(); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYSUM", daysum); + tx_log(TX_LOG_INFO, "[AC_OL_0006] 완료 key=%s 당일합계=%ld", key, daysum); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/ac_ol_0007.c b/app/online/ac_ol_0007.c new file mode 100644 index 0000000..8cac8d5 --- /dev/null +++ b/app/online/ac_ol_0007.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/ac_ol_0007.pgc" +/* @tier easy @module ac @transform acquire-online */ +/* + * ac_ol_0007.pgc - 매입 온라인 서비스 (AC_OL_0007) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 ac 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "ac_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/ac_ol_0007.pgc" + + +TX_SERVICE(AC_OL_0007, ctx) +{ + ac_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[AC_OL_0007] 매입 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AC_OL_0007] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = ac_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[AC_OL_0007] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[AC_OL_0007] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/ac_ol_0007.pgc b/app/online/ac_ol_0007.pgc new file mode 100644 index 0000000..560d318 --- /dev/null +++ b/app/online/ac_ol_0007.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module ac @transform acquire-online */ +/* + * ac_ol_0007.pgc - 매입 온라인 서비스 (AC_OL_0007) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 ac 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "ac_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(AC_OL_0007, ctx) +{ + ac_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[AC_OL_0007] 매입 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AC_OL_0007] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = ac_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[AC_OL_0007] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[AC_OL_0007] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/ac_ol_0008.c b/app/online/ac_ol_0008.c new file mode 100644 index 0000000..bef05f8 --- /dev/null +++ b/app/online/ac_ol_0008.c @@ -0,0 +1,176 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/ac_ol_0008.pgc" +/* @tier hard @module ac @transform acquire-online */ +/* + * ac_ol_0008.pgc - 매입 온라인 서비스 (AC_OL_0008) [tier=hard] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 ac 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "ac_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/ac_ol_0008.pgc" + + +TX_SERVICE(AC_OL_0008, ctx) +{ + ac_rec_t rec; + char key[16], merch[16], bizdate[16], nextbiz[9]; + long amount = 0, daysum = 0; + int rc; + TXBUF *sub_in; + TXBUF *sub_out; + + tx_log(TX_LOG_INFO, "[AC_OL_0008] 매입 트랜잭션 오케스트레이션 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AC_OL_0008] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + if (!amount_is_valid(amount) || !date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[AC_OL_0008] 입력 검증 실패 amount=%ld date=%s", + amount, bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + /* 트랜잭션 시작 → 원장 반영 → 후속 서비스 연계 → 커밋 */ + if (tx_begin() != TX_OK) { + tx_return(ctx, TX_FAIL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, AC_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; + + rc = ac_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[AC_OL_0008] 원장반영 실패 rc=%d", rc); + tx_abort(); + tx_return(ctx, rc, ctx->out); + return; + } + + /* 정산 영업일 = 거래일의 다음 영업일 */ + if (date_next_business(bizdate, nextbiz) != 0) { + memcpy(nextbiz, bizdate, 8); + nextbiz[8] = '\0'; + } + + /* 후속 정산집계 서비스 연계 (레지스트리 문자열 디스패치) */ + sub_in = tx_buf_alloc(); + sub_out = tx_buf_alloc(); + if (sub_in && sub_out) { + tx_buf_sets(sub_in, "MERCHID", merch); + tx_buf_sets(sub_in, "BIZDATE", nextbiz); + tx_buf_setlong(sub_in, "AMOUNT", amount); + rc = tx_call("AC_POST", sub_in, sub_out); + if (rc != TX_OK) + tx_log(TX_LOG_WARN, "[AC_OL_0008] 후속연계 경고 rc=%d", rc); + } + tx_buf_free(sub_in); + tx_buf_free(sub_out); + + /* 교차 검증: 당일 합계 재계산 */ + if (ac_rec_sum(bizdate, &daysum) != TX_OK) + daysum = 0; + + tx_commit(); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYSUM", daysum); + tx_log(TX_LOG_INFO, "[AC_OL_0008] 완료 key=%s 당일합계=%ld", key, daysum); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/ac_ol_0008.pgc b/app/online/ac_ol_0008.pgc new file mode 100644 index 0000000..8fbc128 --- /dev/null +++ b/app/online/ac_ol_0008.pgc @@ -0,0 +1,98 @@ +/* @tier hard @module ac @transform acquire-online */ +/* + * ac_ol_0008.pgc - 매입 온라인 서비스 (AC_OL_0008) [tier=hard] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 ac 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "ac_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(AC_OL_0008, ctx) +{ + ac_rec_t rec; + char key[16], merch[16], bizdate[16], nextbiz[9]; + long amount = 0, daysum = 0; + int rc; + TXBUF *sub_in; + TXBUF *sub_out; + + tx_log(TX_LOG_INFO, "[AC_OL_0008] 매입 트랜잭션 오케스트레이션 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AC_OL_0008] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + if (!amount_is_valid(amount) || !date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[AC_OL_0008] 입력 검증 실패 amount=%ld date=%s", + amount, bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + /* 트랜잭션 시작 → 원장 반영 → 후속 서비스 연계 → 커밋 */ + if (tx_begin() != TX_OK) { + tx_return(ctx, TX_FAIL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, AC_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; + + rc = ac_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[AC_OL_0008] 원장반영 실패 rc=%d", rc); + tx_abort(); + tx_return(ctx, rc, ctx->out); + return; + } + + /* 정산 영업일 = 거래일의 다음 영업일 */ + if (date_next_business(bizdate, nextbiz) != 0) { + memcpy(nextbiz, bizdate, 8); + nextbiz[8] = '\0'; + } + + /* 후속 정산집계 서비스 연계 (레지스트리 문자열 디스패치) */ + sub_in = tx_buf_alloc(); + sub_out = tx_buf_alloc(); + if (sub_in && sub_out) { + tx_buf_sets(sub_in, "MERCHID", merch); + tx_buf_sets(sub_in, "BIZDATE", nextbiz); + tx_buf_setlong(sub_in, "AMOUNT", amount); + rc = tx_call("AC_POST", sub_in, sub_out); + if (rc != TX_OK) + tx_log(TX_LOG_WARN, "[AC_OL_0008] 후속연계 경고 rc=%d", rc); + } + tx_buf_free(sub_in); + tx_buf_free(sub_out); + + /* 교차 검증: 당일 합계 재계산 */ + if (ac_rec_sum(bizdate, &daysum) != TX_OK) + daysum = 0; + + tx_commit(); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYSUM", daysum); + tx_log(TX_LOG_INFO, "[AC_OL_0008] 완료 key=%s 당일합계=%ld", key, daysum); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/ac_ol_0009.c b/app/online/ac_ol_0009.c new file mode 100644 index 0000000..79213cc --- /dev/null +++ b/app/online/ac_ol_0009.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/ac_ol_0009.pgc" +/* @tier easy @module ac @transform acquire-online */ +/* + * ac_ol_0009.pgc - 매입 온라인 서비스 (AC_OL_0009) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 ac 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "ac_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/ac_ol_0009.pgc" + + +TX_SERVICE(AC_OL_0009, ctx) +{ + ac_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[AC_OL_0009] 매입 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AC_OL_0009] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = ac_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[AC_OL_0009] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[AC_OL_0009] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/ac_ol_0009.pgc b/app/online/ac_ol_0009.pgc new file mode 100644 index 0000000..f6b65ef --- /dev/null +++ b/app/online/ac_ol_0009.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module ac @transform acquire-online */ +/* + * ac_ol_0009.pgc - 매입 온라인 서비스 (AC_OL_0009) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 ac 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "ac_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(AC_OL_0009, ctx) +{ + ac_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[AC_OL_0009] 매입 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AC_OL_0009] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = ac_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[AC_OL_0009] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[AC_OL_0009] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/ac_ol_0010.c b/app/online/ac_ol_0010.c new file mode 100644 index 0000000..3316013 --- /dev/null +++ b/app/online/ac_ol_0010.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/ac_ol_0010.pgc" +/* @tier easy @module ac @transform acquire-online */ +/* + * ac_ol_0010.pgc - 매입 온라인 서비스 (AC_OL_0010) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 ac 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "ac_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/ac_ol_0010.pgc" + + +TX_SERVICE(AC_OL_0010, ctx) +{ + ac_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[AC_OL_0010] 매입 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AC_OL_0010] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = ac_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[AC_OL_0010] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[AC_OL_0010] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/ac_ol_0010.pgc b/app/online/ac_ol_0010.pgc new file mode 100644 index 0000000..570359a --- /dev/null +++ b/app/online/ac_ol_0010.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module ac @transform acquire-online */ +/* + * ac_ol_0010.pgc - 매입 온라인 서비스 (AC_OL_0010) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 ac 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "ac_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(AC_OL_0010, ctx) +{ + ac_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[AC_OL_0010] 매입 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AC_OL_0010] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = ac_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[AC_OL_0010] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[AC_OL_0010] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/ac_ol_0011.c b/app/online/ac_ol_0011.c new file mode 100644 index 0000000..1d3e3a1 --- /dev/null +++ b/app/online/ac_ol_0011.c @@ -0,0 +1,148 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/ac_ol_0011.pgc" +/* @tier medium @module ac @transform acquire-online */ +/* + * ac_ol_0011.pgc - 매입 온라인 서비스 (AC_OL_0011) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 ac 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "ac_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/ac_ol_0011.pgc" + + +TX_SERVICE(AC_OL_0011, ctx) +{ + ac_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[AC_OL_0011] 매입 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AC_OL_0011] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[AC_OL_0011] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[AC_OL_0011] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, AC_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = ac_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[AC_OL_0011] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = ac_rec_count(bizdate, AC_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[AC_OL_0011] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/ac_ol_0011.pgc b/app/online/ac_ol_0011.pgc new file mode 100644 index 0000000..eb7a024 --- /dev/null +++ b/app/online/ac_ol_0011.pgc @@ -0,0 +1,70 @@ +/* @tier medium @module ac @transform acquire-online */ +/* + * ac_ol_0011.pgc - 매입 온라인 서비스 (AC_OL_0011) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 ac 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "ac_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(AC_OL_0011, ctx) +{ + ac_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[AC_OL_0011] 매입 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AC_OL_0011] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[AC_OL_0011] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[AC_OL_0011] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, AC_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = ac_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[AC_OL_0011] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = ac_rec_count(bizdate, AC_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[AC_OL_0011] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/ac_ol_0012.c b/app/online/ac_ol_0012.c new file mode 100644 index 0000000..bc605b7 --- /dev/null +++ b/app/online/ac_ol_0012.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/ac_ol_0012.pgc" +/* @tier easy @module ac @transform acquire-online */ +/* + * ac_ol_0012.pgc - 매입 온라인 서비스 (AC_OL_0012) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 ac 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "ac_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/ac_ol_0012.pgc" + + +TX_SERVICE(AC_OL_0012, ctx) +{ + ac_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[AC_OL_0012] 매입 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AC_OL_0012] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = ac_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[AC_OL_0012] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[AC_OL_0012] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/ac_ol_0012.pgc b/app/online/ac_ol_0012.pgc new file mode 100644 index 0000000..818cd4e --- /dev/null +++ b/app/online/ac_ol_0012.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module ac @transform acquire-online */ +/* + * ac_ol_0012.pgc - 매입 온라인 서비스 (AC_OL_0012) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 ac 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "ac_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(AC_OL_0012, ctx) +{ + ac_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[AC_OL_0012] 매입 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AC_OL_0012] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = ac_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[AC_OL_0012] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[AC_OL_0012] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/ac_ol_0013.c b/app/online/ac_ol_0013.c new file mode 100644 index 0000000..a70b857 --- /dev/null +++ b/app/online/ac_ol_0013.c @@ -0,0 +1,148 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/ac_ol_0013.pgc" +/* @tier medium @module ac @transform acquire-online */ +/* + * ac_ol_0013.pgc - 매입 온라인 서비스 (AC_OL_0013) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 ac 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "ac_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/ac_ol_0013.pgc" + + +TX_SERVICE(AC_OL_0013, ctx) +{ + ac_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[AC_OL_0013] 매입 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AC_OL_0013] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[AC_OL_0013] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[AC_OL_0013] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, AC_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = ac_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[AC_OL_0013] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = ac_rec_count(bizdate, AC_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[AC_OL_0013] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/ac_ol_0013.pgc b/app/online/ac_ol_0013.pgc new file mode 100644 index 0000000..0bad136 --- /dev/null +++ b/app/online/ac_ol_0013.pgc @@ -0,0 +1,70 @@ +/* @tier medium @module ac @transform acquire-online */ +/* + * ac_ol_0013.pgc - 매입 온라인 서비스 (AC_OL_0013) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 ac 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "ac_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(AC_OL_0013, ctx) +{ + ac_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[AC_OL_0013] 매입 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AC_OL_0013] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[AC_OL_0013] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[AC_OL_0013] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, AC_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = ac_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[AC_OL_0013] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = ac_rec_count(bizdate, AC_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[AC_OL_0013] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/ac_ol_0014.c b/app/online/ac_ol_0014.c new file mode 100644 index 0000000..027cae8 --- /dev/null +++ b/app/online/ac_ol_0014.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/ac_ol_0014.pgc" +/* @tier easy @module ac @transform acquire-online */ +/* + * ac_ol_0014.pgc - 매입 온라인 서비스 (AC_OL_0014) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 ac 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "ac_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/ac_ol_0014.pgc" + + +TX_SERVICE(AC_OL_0014, ctx) +{ + ac_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[AC_OL_0014] 매입 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AC_OL_0014] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = ac_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[AC_OL_0014] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[AC_OL_0014] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/ac_ol_0014.pgc b/app/online/ac_ol_0014.pgc new file mode 100644 index 0000000..6283b4c --- /dev/null +++ b/app/online/ac_ol_0014.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module ac @transform acquire-online */ +/* + * ac_ol_0014.pgc - 매입 온라인 서비스 (AC_OL_0014) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 ac 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "ac_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(AC_OL_0014, ctx) +{ + ac_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[AC_OL_0014] 매입 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AC_OL_0014] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = ac_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[AC_OL_0014] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[AC_OL_0014] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/ac_ol_0015.c b/app/online/ac_ol_0015.c new file mode 100644 index 0000000..71da75d --- /dev/null +++ b/app/online/ac_ol_0015.c @@ -0,0 +1,148 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/ac_ol_0015.pgc" +/* @tier medium @module ac @transform acquire-online */ +/* + * ac_ol_0015.pgc - 매입 온라인 서비스 (AC_OL_0015) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 ac 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "ac_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/ac_ol_0015.pgc" + + +TX_SERVICE(AC_OL_0015, ctx) +{ + ac_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[AC_OL_0015] 매입 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AC_OL_0015] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[AC_OL_0015] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[AC_OL_0015] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, AC_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = ac_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[AC_OL_0015] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = ac_rec_count(bizdate, AC_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[AC_OL_0015] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/ac_ol_0015.pgc b/app/online/ac_ol_0015.pgc new file mode 100644 index 0000000..66294e9 --- /dev/null +++ b/app/online/ac_ol_0015.pgc @@ -0,0 +1,70 @@ +/* @tier medium @module ac @transform acquire-online */ +/* + * ac_ol_0015.pgc - 매입 온라인 서비스 (AC_OL_0015) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 ac 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "ac_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(AC_OL_0015, ctx) +{ + ac_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[AC_OL_0015] 매입 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AC_OL_0015] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[AC_OL_0015] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[AC_OL_0015] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, AC_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = ac_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[AC_OL_0015] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = ac_rec_count(bizdate, AC_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[AC_OL_0015] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/ac_ol_0016.c b/app/online/ac_ol_0016.c new file mode 100644 index 0000000..9c46737 --- /dev/null +++ b/app/online/ac_ol_0016.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/ac_ol_0016.pgc" +/* @tier easy @module ac @transform acquire-online */ +/* + * ac_ol_0016.pgc - 매입 온라인 서비스 (AC_OL_0016) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 ac 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "ac_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/ac_ol_0016.pgc" + + +TX_SERVICE(AC_OL_0016, ctx) +{ + ac_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[AC_OL_0016] 매입 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AC_OL_0016] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = ac_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[AC_OL_0016] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[AC_OL_0016] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/ac_ol_0016.pgc b/app/online/ac_ol_0016.pgc new file mode 100644 index 0000000..65d1ec8 --- /dev/null +++ b/app/online/ac_ol_0016.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module ac @transform acquire-online */ +/* + * ac_ol_0016.pgc - 매입 온라인 서비스 (AC_OL_0016) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 ac 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "ac_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(AC_OL_0016, ctx) +{ + ac_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[AC_OL_0016] 매입 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AC_OL_0016] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = ac_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[AC_OL_0016] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[AC_OL_0016] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/ac_ol_0017.c b/app/online/ac_ol_0017.c new file mode 100644 index 0000000..6b61f3f --- /dev/null +++ b/app/online/ac_ol_0017.c @@ -0,0 +1,176 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/ac_ol_0017.pgc" +/* @tier hard @module ac @transform acquire-online */ +/* + * ac_ol_0017.pgc - 매입 온라인 서비스 (AC_OL_0017) [tier=hard] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 ac 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "ac_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/ac_ol_0017.pgc" + + +TX_SERVICE(AC_OL_0017, ctx) +{ + ac_rec_t rec; + char key[16], merch[16], bizdate[16], nextbiz[9]; + long amount = 0, daysum = 0; + int rc; + TXBUF *sub_in; + TXBUF *sub_out; + + tx_log(TX_LOG_INFO, "[AC_OL_0017] 매입 트랜잭션 오케스트레이션 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AC_OL_0017] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + if (!amount_is_valid(amount) || !date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[AC_OL_0017] 입력 검증 실패 amount=%ld date=%s", + amount, bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + /* 트랜잭션 시작 → 원장 반영 → 후속 서비스 연계 → 커밋 */ + if (tx_begin() != TX_OK) { + tx_return(ctx, TX_FAIL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, AC_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; + + rc = ac_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[AC_OL_0017] 원장반영 실패 rc=%d", rc); + tx_abort(); + tx_return(ctx, rc, ctx->out); + return; + } + + /* 정산 영업일 = 거래일의 다음 영업일 */ + if (date_next_business(bizdate, nextbiz) != 0) { + memcpy(nextbiz, bizdate, 8); + nextbiz[8] = '\0'; + } + + /* 후속 정산집계 서비스 연계 (레지스트리 문자열 디스패치) */ + sub_in = tx_buf_alloc(); + sub_out = tx_buf_alloc(); + if (sub_in && sub_out) { + tx_buf_sets(sub_in, "MERCHID", merch); + tx_buf_sets(sub_in, "BIZDATE", nextbiz); + tx_buf_setlong(sub_in, "AMOUNT", amount); + rc = tx_call("AC_POST", sub_in, sub_out); + if (rc != TX_OK) + tx_log(TX_LOG_WARN, "[AC_OL_0017] 후속연계 경고 rc=%d", rc); + } + tx_buf_free(sub_in); + tx_buf_free(sub_out); + + /* 교차 검증: 당일 합계 재계산 */ + if (ac_rec_sum(bizdate, &daysum) != TX_OK) + daysum = 0; + + tx_commit(); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYSUM", daysum); + tx_log(TX_LOG_INFO, "[AC_OL_0017] 완료 key=%s 당일합계=%ld", key, daysum); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/ac_ol_0017.pgc b/app/online/ac_ol_0017.pgc new file mode 100644 index 0000000..34c230e --- /dev/null +++ b/app/online/ac_ol_0017.pgc @@ -0,0 +1,98 @@ +/* @tier hard @module ac @transform acquire-online */ +/* + * ac_ol_0017.pgc - 매입 온라인 서비스 (AC_OL_0017) [tier=hard] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 ac 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "ac_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(AC_OL_0017, ctx) +{ + ac_rec_t rec; + char key[16], merch[16], bizdate[16], nextbiz[9]; + long amount = 0, daysum = 0; + int rc; + TXBUF *sub_in; + TXBUF *sub_out; + + tx_log(TX_LOG_INFO, "[AC_OL_0017] 매입 트랜잭션 오케스트레이션 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AC_OL_0017] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + if (!amount_is_valid(amount) || !date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[AC_OL_0017] 입력 검증 실패 amount=%ld date=%s", + amount, bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + /* 트랜잭션 시작 → 원장 반영 → 후속 서비스 연계 → 커밋 */ + if (tx_begin() != TX_OK) { + tx_return(ctx, TX_FAIL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, AC_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; + + rc = ac_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[AC_OL_0017] 원장반영 실패 rc=%d", rc); + tx_abort(); + tx_return(ctx, rc, ctx->out); + return; + } + + /* 정산 영업일 = 거래일의 다음 영업일 */ + if (date_next_business(bizdate, nextbiz) != 0) { + memcpy(nextbiz, bizdate, 8); + nextbiz[8] = '\0'; + } + + /* 후속 정산집계 서비스 연계 (레지스트리 문자열 디스패치) */ + sub_in = tx_buf_alloc(); + sub_out = tx_buf_alloc(); + if (sub_in && sub_out) { + tx_buf_sets(sub_in, "MERCHID", merch); + tx_buf_sets(sub_in, "BIZDATE", nextbiz); + tx_buf_setlong(sub_in, "AMOUNT", amount); + rc = tx_call("AC_POST", sub_in, sub_out); + if (rc != TX_OK) + tx_log(TX_LOG_WARN, "[AC_OL_0017] 후속연계 경고 rc=%d", rc); + } + tx_buf_free(sub_in); + tx_buf_free(sub_out); + + /* 교차 검증: 당일 합계 재계산 */ + if (ac_rec_sum(bizdate, &daysum) != TX_OK) + daysum = 0; + + tx_commit(); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYSUM", daysum); + tx_log(TX_LOG_INFO, "[AC_OL_0017] 완료 key=%s 당일합계=%ld", key, daysum); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/ac_ol_0018.c b/app/online/ac_ol_0018.c new file mode 100644 index 0000000..436327f --- /dev/null +++ b/app/online/ac_ol_0018.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/ac_ol_0018.pgc" +/* @tier easy @module ac @transform acquire-online */ +/* + * ac_ol_0018.pgc - 매입 온라인 서비스 (AC_OL_0018) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 ac 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "ac_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/ac_ol_0018.pgc" + + +TX_SERVICE(AC_OL_0018, ctx) +{ + ac_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[AC_OL_0018] 매입 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AC_OL_0018] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = ac_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[AC_OL_0018] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[AC_OL_0018] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/ac_ol_0018.pgc b/app/online/ac_ol_0018.pgc new file mode 100644 index 0000000..e88174d --- /dev/null +++ b/app/online/ac_ol_0018.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module ac @transform acquire-online */ +/* + * ac_ol_0018.pgc - 매입 온라인 서비스 (AC_OL_0018) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 ac 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "ac_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(AC_OL_0018, ctx) +{ + ac_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[AC_OL_0018] 매입 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AC_OL_0018] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = ac_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[AC_OL_0018] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[AC_OL_0018] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/ac_ol_0019.c b/app/online/ac_ol_0019.c new file mode 100644 index 0000000..fd537be --- /dev/null +++ b/app/online/ac_ol_0019.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/ac_ol_0019.pgc" +/* @tier easy @module ac @transform acquire-online */ +/* + * ac_ol_0019.pgc - 매입 온라인 서비스 (AC_OL_0019) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 ac 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "ac_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/ac_ol_0019.pgc" + + +TX_SERVICE(AC_OL_0019, ctx) +{ + ac_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[AC_OL_0019] 매입 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AC_OL_0019] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = ac_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[AC_OL_0019] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[AC_OL_0019] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/ac_ol_0019.pgc b/app/online/ac_ol_0019.pgc new file mode 100644 index 0000000..f84caa3 --- /dev/null +++ b/app/online/ac_ol_0019.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module ac @transform acquire-online */ +/* + * ac_ol_0019.pgc - 매입 온라인 서비스 (AC_OL_0019) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 ac 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "ac_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(AC_OL_0019, ctx) +{ + ac_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[AC_OL_0019] 매입 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AC_OL_0019] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = ac_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[AC_OL_0019] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[AC_OL_0019] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/ac_ol_0020.c b/app/online/ac_ol_0020.c new file mode 100644 index 0000000..b9073f4 --- /dev/null +++ b/app/online/ac_ol_0020.c @@ -0,0 +1,148 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/ac_ol_0020.pgc" +/* @tier medium @module ac @transform acquire-online */ +/* + * ac_ol_0020.pgc - 매입 온라인 서비스 (AC_OL_0020) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 ac 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "ac_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/ac_ol_0020.pgc" + + +TX_SERVICE(AC_OL_0020, ctx) +{ + ac_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[AC_OL_0020] 매입 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AC_OL_0020] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[AC_OL_0020] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[AC_OL_0020] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, AC_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = ac_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[AC_OL_0020] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = ac_rec_count(bizdate, AC_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[AC_OL_0020] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/ac_ol_0020.pgc b/app/online/ac_ol_0020.pgc new file mode 100644 index 0000000..1284748 --- /dev/null +++ b/app/online/ac_ol_0020.pgc @@ -0,0 +1,70 @@ +/* @tier medium @module ac @transform acquire-online */ +/* + * ac_ol_0020.pgc - 매입 온라인 서비스 (AC_OL_0020) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 ac 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "ac_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(AC_OL_0020, ctx) +{ + ac_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[AC_OL_0020] 매입 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AC_OL_0020] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[AC_OL_0020] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[AC_OL_0020] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, AC_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = ac_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[AC_OL_0020] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = ac_rec_count(bizdate, AC_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[AC_OL_0020] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/ac_ol_0021.c b/app/online/ac_ol_0021.c new file mode 100644 index 0000000..140ed31 --- /dev/null +++ b/app/online/ac_ol_0021.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/ac_ol_0021.pgc" +/* @tier easy @module ac @transform acquire-online */ +/* + * ac_ol_0021.pgc - 매입 온라인 서비스 (AC_OL_0021) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 ac 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "ac_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/ac_ol_0021.pgc" + + +TX_SERVICE(AC_OL_0021, ctx) +{ + ac_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[AC_OL_0021] 매입 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AC_OL_0021] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = ac_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[AC_OL_0021] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[AC_OL_0021] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/ac_ol_0021.pgc b/app/online/ac_ol_0021.pgc new file mode 100644 index 0000000..e8993b9 --- /dev/null +++ b/app/online/ac_ol_0021.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module ac @transform acquire-online */ +/* + * ac_ol_0021.pgc - 매입 온라인 서비스 (AC_OL_0021) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 ac 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "ac_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(AC_OL_0021, ctx) +{ + ac_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[AC_OL_0021] 매입 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AC_OL_0021] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = ac_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[AC_OL_0021] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[AC_OL_0021] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/ac_ol_0022.c b/app/online/ac_ol_0022.c new file mode 100644 index 0000000..44c6778 --- /dev/null +++ b/app/online/ac_ol_0022.c @@ -0,0 +1,148 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/ac_ol_0022.pgc" +/* @tier medium @module ac @transform acquire-online */ +/* + * ac_ol_0022.pgc - 매입 온라인 서비스 (AC_OL_0022) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 ac 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "ac_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/ac_ol_0022.pgc" + + +TX_SERVICE(AC_OL_0022, ctx) +{ + ac_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[AC_OL_0022] 매입 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AC_OL_0022] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[AC_OL_0022] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[AC_OL_0022] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, AC_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = ac_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[AC_OL_0022] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = ac_rec_count(bizdate, AC_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[AC_OL_0022] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/ac_ol_0022.pgc b/app/online/ac_ol_0022.pgc new file mode 100644 index 0000000..e84dfff --- /dev/null +++ b/app/online/ac_ol_0022.pgc @@ -0,0 +1,70 @@ +/* @tier medium @module ac @transform acquire-online */ +/* + * ac_ol_0022.pgc - 매입 온라인 서비스 (AC_OL_0022) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 ac 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "ac_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(AC_OL_0022, ctx) +{ + ac_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[AC_OL_0022] 매입 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AC_OL_0022] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[AC_OL_0022] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[AC_OL_0022] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, AC_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = ac_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[AC_OL_0022] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = ac_rec_count(bizdate, AC_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[AC_OL_0022] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/ac_ol_0023.c b/app/online/ac_ol_0023.c new file mode 100644 index 0000000..fbb2322 --- /dev/null +++ b/app/online/ac_ol_0023.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/ac_ol_0023.pgc" +/* @tier easy @module ac @transform acquire-online */ +/* + * ac_ol_0023.pgc - 매입 온라인 서비스 (AC_OL_0023) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 ac 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "ac_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/ac_ol_0023.pgc" + + +TX_SERVICE(AC_OL_0023, ctx) +{ + ac_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[AC_OL_0023] 매입 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AC_OL_0023] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = ac_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[AC_OL_0023] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[AC_OL_0023] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/ac_ol_0023.pgc b/app/online/ac_ol_0023.pgc new file mode 100644 index 0000000..82b0a38 --- /dev/null +++ b/app/online/ac_ol_0023.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module ac @transform acquire-online */ +/* + * ac_ol_0023.pgc - 매입 온라인 서비스 (AC_OL_0023) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 ac 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "ac_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(AC_OL_0023, ctx) +{ + ac_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[AC_OL_0023] 매입 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AC_OL_0023] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = ac_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[AC_OL_0023] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[AC_OL_0023] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/ac_ol_0024.c b/app/online/ac_ol_0024.c new file mode 100644 index 0000000..c1fef44 --- /dev/null +++ b/app/online/ac_ol_0024.c @@ -0,0 +1,148 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/ac_ol_0024.pgc" +/* @tier medium @module ac @transform acquire-online */ +/* + * ac_ol_0024.pgc - 매입 온라인 서비스 (AC_OL_0024) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 ac 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "ac_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/ac_ol_0024.pgc" + + +TX_SERVICE(AC_OL_0024, ctx) +{ + ac_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[AC_OL_0024] 매입 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AC_OL_0024] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[AC_OL_0024] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[AC_OL_0024] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, AC_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = ac_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[AC_OL_0024] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = ac_rec_count(bizdate, AC_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[AC_OL_0024] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/ac_ol_0024.pgc b/app/online/ac_ol_0024.pgc new file mode 100644 index 0000000..f009a71 --- /dev/null +++ b/app/online/ac_ol_0024.pgc @@ -0,0 +1,70 @@ +/* @tier medium @module ac @transform acquire-online */ +/* + * ac_ol_0024.pgc - 매입 온라인 서비스 (AC_OL_0024) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 ac 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "ac_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(AC_OL_0024, ctx) +{ + ac_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[AC_OL_0024] 매입 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AC_OL_0024] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[AC_OL_0024] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[AC_OL_0024] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, AC_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = ac_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[AC_OL_0024] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = ac_rec_count(bizdate, AC_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[AC_OL_0024] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/ac_ol_0025.c b/app/online/ac_ol_0025.c new file mode 100644 index 0000000..56b6278 --- /dev/null +++ b/app/online/ac_ol_0025.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/ac_ol_0025.pgc" +/* @tier easy @module ac @transform acquire-online */ +/* + * ac_ol_0025.pgc - 매입 온라인 서비스 (AC_OL_0025) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 ac 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "ac_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/ac_ol_0025.pgc" + + +TX_SERVICE(AC_OL_0025, ctx) +{ + ac_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[AC_OL_0025] 매입 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AC_OL_0025] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = ac_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[AC_OL_0025] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[AC_OL_0025] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/ac_ol_0025.pgc b/app/online/ac_ol_0025.pgc new file mode 100644 index 0000000..57d1d07 --- /dev/null +++ b/app/online/ac_ol_0025.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module ac @transform acquire-online */ +/* + * ac_ol_0025.pgc - 매입 온라인 서비스 (AC_OL_0025) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 ac 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "ac_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(AC_OL_0025, ctx) +{ + ac_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[AC_OL_0025] 매입 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AC_OL_0025] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = ac_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[AC_OL_0025] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[AC_OL_0025] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/ac_ol_0026.c b/app/online/ac_ol_0026.c new file mode 100644 index 0000000..088b5a6 --- /dev/null +++ b/app/online/ac_ol_0026.c @@ -0,0 +1,176 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/ac_ol_0026.pgc" +/* @tier hard @module ac @transform acquire-online */ +/* + * ac_ol_0026.pgc - 매입 온라인 서비스 (AC_OL_0026) [tier=hard] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 ac 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "ac_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/ac_ol_0026.pgc" + + +TX_SERVICE(AC_OL_0026, ctx) +{ + ac_rec_t rec; + char key[16], merch[16], bizdate[16], nextbiz[9]; + long amount = 0, daysum = 0; + int rc; + TXBUF *sub_in; + TXBUF *sub_out; + + tx_log(TX_LOG_INFO, "[AC_OL_0026] 매입 트랜잭션 오케스트레이션 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AC_OL_0026] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + if (!amount_is_valid(amount) || !date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[AC_OL_0026] 입력 검증 실패 amount=%ld date=%s", + amount, bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + /* 트랜잭션 시작 → 원장 반영 → 후속 서비스 연계 → 커밋 */ + if (tx_begin() != TX_OK) { + tx_return(ctx, TX_FAIL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, AC_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; + + rc = ac_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[AC_OL_0026] 원장반영 실패 rc=%d", rc); + tx_abort(); + tx_return(ctx, rc, ctx->out); + return; + } + + /* 정산 영업일 = 거래일의 다음 영업일 */ + if (date_next_business(bizdate, nextbiz) != 0) { + memcpy(nextbiz, bizdate, 8); + nextbiz[8] = '\0'; + } + + /* 후속 정산집계 서비스 연계 (레지스트리 문자열 디스패치) */ + sub_in = tx_buf_alloc(); + sub_out = tx_buf_alloc(); + if (sub_in && sub_out) { + tx_buf_sets(sub_in, "MERCHID", merch); + tx_buf_sets(sub_in, "BIZDATE", nextbiz); + tx_buf_setlong(sub_in, "AMOUNT", amount); + rc = tx_call("AC_POST", sub_in, sub_out); + if (rc != TX_OK) + tx_log(TX_LOG_WARN, "[AC_OL_0026] 후속연계 경고 rc=%d", rc); + } + tx_buf_free(sub_in); + tx_buf_free(sub_out); + + /* 교차 검증: 당일 합계 재계산 */ + if (ac_rec_sum(bizdate, &daysum) != TX_OK) + daysum = 0; + + tx_commit(); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYSUM", daysum); + tx_log(TX_LOG_INFO, "[AC_OL_0026] 완료 key=%s 당일합계=%ld", key, daysum); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/ac_ol_0026.pgc b/app/online/ac_ol_0026.pgc new file mode 100644 index 0000000..2bbfef9 --- /dev/null +++ b/app/online/ac_ol_0026.pgc @@ -0,0 +1,98 @@ +/* @tier hard @module ac @transform acquire-online */ +/* + * ac_ol_0026.pgc - 매입 온라인 서비스 (AC_OL_0026) [tier=hard] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 ac 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "ac_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(AC_OL_0026, ctx) +{ + ac_rec_t rec; + char key[16], merch[16], bizdate[16], nextbiz[9]; + long amount = 0, daysum = 0; + int rc; + TXBUF *sub_in; + TXBUF *sub_out; + + tx_log(TX_LOG_INFO, "[AC_OL_0026] 매입 트랜잭션 오케스트레이션 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AC_OL_0026] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + if (!amount_is_valid(amount) || !date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[AC_OL_0026] 입력 검증 실패 amount=%ld date=%s", + amount, bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + /* 트랜잭션 시작 → 원장 반영 → 후속 서비스 연계 → 커밋 */ + if (tx_begin() != TX_OK) { + tx_return(ctx, TX_FAIL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, AC_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; + + rc = ac_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[AC_OL_0026] 원장반영 실패 rc=%d", rc); + tx_abort(); + tx_return(ctx, rc, ctx->out); + return; + } + + /* 정산 영업일 = 거래일의 다음 영업일 */ + if (date_next_business(bizdate, nextbiz) != 0) { + memcpy(nextbiz, bizdate, 8); + nextbiz[8] = '\0'; + } + + /* 후속 정산집계 서비스 연계 (레지스트리 문자열 디스패치) */ + sub_in = tx_buf_alloc(); + sub_out = tx_buf_alloc(); + if (sub_in && sub_out) { + tx_buf_sets(sub_in, "MERCHID", merch); + tx_buf_sets(sub_in, "BIZDATE", nextbiz); + tx_buf_setlong(sub_in, "AMOUNT", amount); + rc = tx_call("AC_POST", sub_in, sub_out); + if (rc != TX_OK) + tx_log(TX_LOG_WARN, "[AC_OL_0026] 후속연계 경고 rc=%d", rc); + } + tx_buf_free(sub_in); + tx_buf_free(sub_out); + + /* 교차 검증: 당일 합계 재계산 */ + if (ac_rec_sum(bizdate, &daysum) != TX_OK) + daysum = 0; + + tx_commit(); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYSUM", daysum); + tx_log(TX_LOG_INFO, "[AC_OL_0026] 완료 key=%s 당일합계=%ld", key, daysum); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/ac_ol_0027.c b/app/online/ac_ol_0027.c new file mode 100644 index 0000000..82539d9 --- /dev/null +++ b/app/online/ac_ol_0027.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/ac_ol_0027.pgc" +/* @tier easy @module ac @transform acquire-online */ +/* + * ac_ol_0027.pgc - 매입 온라인 서비스 (AC_OL_0027) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 ac 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "ac_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/ac_ol_0027.pgc" + + +TX_SERVICE(AC_OL_0027, ctx) +{ + ac_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[AC_OL_0027] 매입 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AC_OL_0027] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = ac_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[AC_OL_0027] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[AC_OL_0027] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/ac_ol_0027.pgc b/app/online/ac_ol_0027.pgc new file mode 100644 index 0000000..e96164c --- /dev/null +++ b/app/online/ac_ol_0027.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module ac @transform acquire-online */ +/* + * ac_ol_0027.pgc - 매입 온라인 서비스 (AC_OL_0027) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 ac 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "ac_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(AC_OL_0027, ctx) +{ + ac_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[AC_OL_0027] 매입 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AC_OL_0027] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = ac_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[AC_OL_0027] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[AC_OL_0027] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/ac_ol_0028.c b/app/online/ac_ol_0028.c new file mode 100644 index 0000000..d418019 --- /dev/null +++ b/app/online/ac_ol_0028.c @@ -0,0 +1,176 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/ac_ol_0028.pgc" +/* @tier hard @module ac @transform acquire-online */ +/* + * ac_ol_0028.pgc - 매입 온라인 서비스 (AC_OL_0028) [tier=hard] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 ac 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "ac_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/ac_ol_0028.pgc" + + +TX_SERVICE(AC_OL_0028, ctx) +{ + ac_rec_t rec; + char key[16], merch[16], bizdate[16], nextbiz[9]; + long amount = 0, daysum = 0; + int rc; + TXBUF *sub_in; + TXBUF *sub_out; + + tx_log(TX_LOG_INFO, "[AC_OL_0028] 매입 트랜잭션 오케스트레이션 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AC_OL_0028] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + if (!amount_is_valid(amount) || !date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[AC_OL_0028] 입력 검증 실패 amount=%ld date=%s", + amount, bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + /* 트랜잭션 시작 → 원장 반영 → 후속 서비스 연계 → 커밋 */ + if (tx_begin() != TX_OK) { + tx_return(ctx, TX_FAIL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, AC_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; + + rc = ac_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[AC_OL_0028] 원장반영 실패 rc=%d", rc); + tx_abort(); + tx_return(ctx, rc, ctx->out); + return; + } + + /* 정산 영업일 = 거래일의 다음 영업일 */ + if (date_next_business(bizdate, nextbiz) != 0) { + memcpy(nextbiz, bizdate, 8); + nextbiz[8] = '\0'; + } + + /* 후속 정산집계 서비스 연계 (레지스트리 문자열 디스패치) */ + sub_in = tx_buf_alloc(); + sub_out = tx_buf_alloc(); + if (sub_in && sub_out) { + tx_buf_sets(sub_in, "MERCHID", merch); + tx_buf_sets(sub_in, "BIZDATE", nextbiz); + tx_buf_setlong(sub_in, "AMOUNT", amount); + rc = tx_call("AC_POST", sub_in, sub_out); + if (rc != TX_OK) + tx_log(TX_LOG_WARN, "[AC_OL_0028] 후속연계 경고 rc=%d", rc); + } + tx_buf_free(sub_in); + tx_buf_free(sub_out); + + /* 교차 검증: 당일 합계 재계산 */ + if (ac_rec_sum(bizdate, &daysum) != TX_OK) + daysum = 0; + + tx_commit(); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYSUM", daysum); + tx_log(TX_LOG_INFO, "[AC_OL_0028] 완료 key=%s 당일합계=%ld", key, daysum); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/ac_ol_0028.pgc b/app/online/ac_ol_0028.pgc new file mode 100644 index 0000000..3b56314 --- /dev/null +++ b/app/online/ac_ol_0028.pgc @@ -0,0 +1,98 @@ +/* @tier hard @module ac @transform acquire-online */ +/* + * ac_ol_0028.pgc - 매입 온라인 서비스 (AC_OL_0028) [tier=hard] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 ac 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "ac_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(AC_OL_0028, ctx) +{ + ac_rec_t rec; + char key[16], merch[16], bizdate[16], nextbiz[9]; + long amount = 0, daysum = 0; + int rc; + TXBUF *sub_in; + TXBUF *sub_out; + + tx_log(TX_LOG_INFO, "[AC_OL_0028] 매입 트랜잭션 오케스트레이션 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AC_OL_0028] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + if (!amount_is_valid(amount) || !date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[AC_OL_0028] 입력 검증 실패 amount=%ld date=%s", + amount, bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + /* 트랜잭션 시작 → 원장 반영 → 후속 서비스 연계 → 커밋 */ + if (tx_begin() != TX_OK) { + tx_return(ctx, TX_FAIL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, AC_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; + + rc = ac_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[AC_OL_0028] 원장반영 실패 rc=%d", rc); + tx_abort(); + tx_return(ctx, rc, ctx->out); + return; + } + + /* 정산 영업일 = 거래일의 다음 영업일 */ + if (date_next_business(bizdate, nextbiz) != 0) { + memcpy(nextbiz, bizdate, 8); + nextbiz[8] = '\0'; + } + + /* 후속 정산집계 서비스 연계 (레지스트리 문자열 디스패치) */ + sub_in = tx_buf_alloc(); + sub_out = tx_buf_alloc(); + if (sub_in && sub_out) { + tx_buf_sets(sub_in, "MERCHID", merch); + tx_buf_sets(sub_in, "BIZDATE", nextbiz); + tx_buf_setlong(sub_in, "AMOUNT", amount); + rc = tx_call("AC_POST", sub_in, sub_out); + if (rc != TX_OK) + tx_log(TX_LOG_WARN, "[AC_OL_0028] 후속연계 경고 rc=%d", rc); + } + tx_buf_free(sub_in); + tx_buf_free(sub_out); + + /* 교차 검증: 당일 합계 재계산 */ + if (ac_rec_sum(bizdate, &daysum) != TX_OK) + daysum = 0; + + tx_commit(); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYSUM", daysum); + tx_log(TX_LOG_INFO, "[AC_OL_0028] 완료 key=%s 당일합계=%ld", key, daysum); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/ac_ol_0029.c b/app/online/ac_ol_0029.c new file mode 100644 index 0000000..8501840 --- /dev/null +++ b/app/online/ac_ol_0029.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/ac_ol_0029.pgc" +/* @tier easy @module ac @transform acquire-online */ +/* + * ac_ol_0029.pgc - 매입 온라인 서비스 (AC_OL_0029) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 ac 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "ac_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/ac_ol_0029.pgc" + + +TX_SERVICE(AC_OL_0029, ctx) +{ + ac_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[AC_OL_0029] 매입 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AC_OL_0029] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = ac_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[AC_OL_0029] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[AC_OL_0029] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/ac_ol_0029.pgc b/app/online/ac_ol_0029.pgc new file mode 100644 index 0000000..94d40e5 --- /dev/null +++ b/app/online/ac_ol_0029.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module ac @transform acquire-online */ +/* + * ac_ol_0029.pgc - 매입 온라인 서비스 (AC_OL_0029) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 ac 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "ac_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(AC_OL_0029, ctx) +{ + ac_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[AC_OL_0029] 매입 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AC_OL_0029] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = ac_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[AC_OL_0029] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[AC_OL_0029] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/ac_ol_0030.c b/app/online/ac_ol_0030.c new file mode 100644 index 0000000..3b19a4f --- /dev/null +++ b/app/online/ac_ol_0030.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/ac_ol_0030.pgc" +/* @tier easy @module ac @transform acquire-online */ +/* + * ac_ol_0030.pgc - 매입 온라인 서비스 (AC_OL_0030) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 ac 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "ac_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/ac_ol_0030.pgc" + + +TX_SERVICE(AC_OL_0030, ctx) +{ + ac_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[AC_OL_0030] 매입 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AC_OL_0030] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = ac_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[AC_OL_0030] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[AC_OL_0030] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/ac_ol_0030.pgc b/app/online/ac_ol_0030.pgc new file mode 100644 index 0000000..baafa90 --- /dev/null +++ b/app/online/ac_ol_0030.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module ac @transform acquire-online */ +/* + * ac_ol_0030.pgc - 매입 온라인 서비스 (AC_OL_0030) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 ac 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "ac_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(AC_OL_0030, ctx) +{ + ac_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[AC_OL_0030] 매입 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AC_OL_0030] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = ac_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[AC_OL_0030] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[AC_OL_0030] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/ac_ol_0031.c b/app/online/ac_ol_0031.c new file mode 100644 index 0000000..b2b1300 --- /dev/null +++ b/app/online/ac_ol_0031.c @@ -0,0 +1,148 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/ac_ol_0031.pgc" +/* @tier medium @module ac @transform acquire-online */ +/* + * ac_ol_0031.pgc - 매입 온라인 서비스 (AC_OL_0031) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 ac 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "ac_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/ac_ol_0031.pgc" + + +TX_SERVICE(AC_OL_0031, ctx) +{ + ac_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[AC_OL_0031] 매입 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AC_OL_0031] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[AC_OL_0031] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[AC_OL_0031] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, AC_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = ac_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[AC_OL_0031] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = ac_rec_count(bizdate, AC_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[AC_OL_0031] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/ac_ol_0031.pgc b/app/online/ac_ol_0031.pgc new file mode 100644 index 0000000..94c4114 --- /dev/null +++ b/app/online/ac_ol_0031.pgc @@ -0,0 +1,70 @@ +/* @tier medium @module ac @transform acquire-online */ +/* + * ac_ol_0031.pgc - 매입 온라인 서비스 (AC_OL_0031) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 ac 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "ac_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(AC_OL_0031, ctx) +{ + ac_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[AC_OL_0031] 매입 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AC_OL_0031] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[AC_OL_0031] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[AC_OL_0031] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, AC_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = ac_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[AC_OL_0031] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = ac_rec_count(bizdate, AC_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[AC_OL_0031] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/ac_ol_0032.c b/app/online/ac_ol_0032.c new file mode 100644 index 0000000..24f97dc --- /dev/null +++ b/app/online/ac_ol_0032.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/ac_ol_0032.pgc" +/* @tier easy @module ac @transform acquire-online */ +/* + * ac_ol_0032.pgc - 매입 온라인 서비스 (AC_OL_0032) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 ac 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "ac_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/ac_ol_0032.pgc" + + +TX_SERVICE(AC_OL_0032, ctx) +{ + ac_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[AC_OL_0032] 매입 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AC_OL_0032] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = ac_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[AC_OL_0032] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[AC_OL_0032] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/ac_ol_0032.pgc b/app/online/ac_ol_0032.pgc new file mode 100644 index 0000000..e68d27f --- /dev/null +++ b/app/online/ac_ol_0032.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module ac @transform acquire-online */ +/* + * ac_ol_0032.pgc - 매입 온라인 서비스 (AC_OL_0032) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 ac 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "ac_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(AC_OL_0032, ctx) +{ + ac_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[AC_OL_0032] 매입 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AC_OL_0032] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = ac_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[AC_OL_0032] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[AC_OL_0032] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/au_ol_0001.c b/app/online/au_ol_0001.c new file mode 100644 index 0000000..968cfcc --- /dev/null +++ b/app/online/au_ol_0001.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/au_ol_0001.pgc" +/* @tier easy @module au @transform authorization-online */ +/* + * au_ol_0001.pgc - 승인한도 온라인 서비스 (AU_OL_0001) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 au 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "au_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/au_ol_0001.pgc" + + +TX_SERVICE(AU_OL_0001, ctx) +{ + au_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[AU_OL_0001] 승인한도 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AU_OL_0001] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = au_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[AU_OL_0001] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[AU_OL_0001] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/au_ol_0001.pgc b/app/online/au_ol_0001.pgc new file mode 100644 index 0000000..f9459e9 --- /dev/null +++ b/app/online/au_ol_0001.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module au @transform authorization-online */ +/* + * au_ol_0001.pgc - 승인한도 온라인 서비스 (AU_OL_0001) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 au 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "au_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(AU_OL_0001, ctx) +{ + au_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[AU_OL_0001] 승인한도 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AU_OL_0001] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = au_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[AU_OL_0001] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[AU_OL_0001] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/au_ol_0002.c b/app/online/au_ol_0002.c new file mode 100644 index 0000000..ec7aa7d --- /dev/null +++ b/app/online/au_ol_0002.c @@ -0,0 +1,148 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/au_ol_0002.pgc" +/* @tier medium @module au @transform authorization-online */ +/* + * au_ol_0002.pgc - 승인한도 온라인 서비스 (AU_OL_0002) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 au 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "au_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/au_ol_0002.pgc" + + +TX_SERVICE(AU_OL_0002, ctx) +{ + au_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[AU_OL_0002] 승인한도 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AU_OL_0002] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[AU_OL_0002] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[AU_OL_0002] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, AU_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = au_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[AU_OL_0002] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = au_rec_count(bizdate, AU_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[AU_OL_0002] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/au_ol_0002.pgc b/app/online/au_ol_0002.pgc new file mode 100644 index 0000000..b33b8af --- /dev/null +++ b/app/online/au_ol_0002.pgc @@ -0,0 +1,70 @@ +/* @tier medium @module au @transform authorization-online */ +/* + * au_ol_0002.pgc - 승인한도 온라인 서비스 (AU_OL_0002) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 au 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "au_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(AU_OL_0002, ctx) +{ + au_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[AU_OL_0002] 승인한도 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AU_OL_0002] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[AU_OL_0002] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[AU_OL_0002] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, AU_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = au_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[AU_OL_0002] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = au_rec_count(bizdate, AU_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[AU_OL_0002] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/au_ol_0003.c b/app/online/au_ol_0003.c new file mode 100644 index 0000000..d84f719 --- /dev/null +++ b/app/online/au_ol_0003.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/au_ol_0003.pgc" +/* @tier easy @module au @transform authorization-online */ +/* + * au_ol_0003.pgc - 승인한도 온라인 서비스 (AU_OL_0003) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 au 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "au_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/au_ol_0003.pgc" + + +TX_SERVICE(AU_OL_0003, ctx) +{ + au_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[AU_OL_0003] 승인한도 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AU_OL_0003] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = au_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[AU_OL_0003] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[AU_OL_0003] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/au_ol_0003.pgc b/app/online/au_ol_0003.pgc new file mode 100644 index 0000000..932f6a7 --- /dev/null +++ b/app/online/au_ol_0003.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module au @transform authorization-online */ +/* + * au_ol_0003.pgc - 승인한도 온라인 서비스 (AU_OL_0003) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 au 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "au_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(AU_OL_0003, ctx) +{ + au_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[AU_OL_0003] 승인한도 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AU_OL_0003] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = au_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[AU_OL_0003] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[AU_OL_0003] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/au_ol_0004.c b/app/online/au_ol_0004.c new file mode 100644 index 0000000..64d8bb7 --- /dev/null +++ b/app/online/au_ol_0004.c @@ -0,0 +1,148 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/au_ol_0004.pgc" +/* @tier medium @module au @transform authorization-online */ +/* + * au_ol_0004.pgc - 승인한도 온라인 서비스 (AU_OL_0004) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 au 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "au_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/au_ol_0004.pgc" + + +TX_SERVICE(AU_OL_0004, ctx) +{ + au_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[AU_OL_0004] 승인한도 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AU_OL_0004] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[AU_OL_0004] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[AU_OL_0004] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, AU_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = au_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[AU_OL_0004] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = au_rec_count(bizdate, AU_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[AU_OL_0004] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/au_ol_0004.pgc b/app/online/au_ol_0004.pgc new file mode 100644 index 0000000..0ef040f --- /dev/null +++ b/app/online/au_ol_0004.pgc @@ -0,0 +1,70 @@ +/* @tier medium @module au @transform authorization-online */ +/* + * au_ol_0004.pgc - 승인한도 온라인 서비스 (AU_OL_0004) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 au 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "au_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(AU_OL_0004, ctx) +{ + au_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[AU_OL_0004] 승인한도 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AU_OL_0004] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[AU_OL_0004] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[AU_OL_0004] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, AU_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = au_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[AU_OL_0004] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = au_rec_count(bizdate, AU_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[AU_OL_0004] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/au_ol_0005.c b/app/online/au_ol_0005.c new file mode 100644 index 0000000..562c015 --- /dev/null +++ b/app/online/au_ol_0005.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/au_ol_0005.pgc" +/* @tier easy @module au @transform authorization-online */ +/* + * au_ol_0005.pgc - 승인한도 온라인 서비스 (AU_OL_0005) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 au 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "au_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/au_ol_0005.pgc" + + +TX_SERVICE(AU_OL_0005, ctx) +{ + au_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[AU_OL_0005] 승인한도 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AU_OL_0005] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = au_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[AU_OL_0005] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[AU_OL_0005] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/au_ol_0005.pgc b/app/online/au_ol_0005.pgc new file mode 100644 index 0000000..7935312 --- /dev/null +++ b/app/online/au_ol_0005.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module au @transform authorization-online */ +/* + * au_ol_0005.pgc - 승인한도 온라인 서비스 (AU_OL_0005) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 au 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "au_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(AU_OL_0005, ctx) +{ + au_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[AU_OL_0005] 승인한도 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AU_OL_0005] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = au_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[AU_OL_0005] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[AU_OL_0005] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/au_ol_0006.c b/app/online/au_ol_0006.c new file mode 100644 index 0000000..4513c5a --- /dev/null +++ b/app/online/au_ol_0006.c @@ -0,0 +1,148 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/au_ol_0006.pgc" +/* @tier medium @module au @transform authorization-online */ +/* + * au_ol_0006.pgc - 승인한도 온라인 서비스 (AU_OL_0006) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 au 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "au_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/au_ol_0006.pgc" + + +TX_SERVICE(AU_OL_0006, ctx) +{ + au_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[AU_OL_0006] 승인한도 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AU_OL_0006] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[AU_OL_0006] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[AU_OL_0006] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, AU_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = au_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[AU_OL_0006] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = au_rec_count(bizdate, AU_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[AU_OL_0006] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/au_ol_0006.pgc b/app/online/au_ol_0006.pgc new file mode 100644 index 0000000..03dc5b2 --- /dev/null +++ b/app/online/au_ol_0006.pgc @@ -0,0 +1,70 @@ +/* @tier medium @module au @transform authorization-online */ +/* + * au_ol_0006.pgc - 승인한도 온라인 서비스 (AU_OL_0006) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 au 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "au_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(AU_OL_0006, ctx) +{ + au_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[AU_OL_0006] 승인한도 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AU_OL_0006] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[AU_OL_0006] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[AU_OL_0006] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, AU_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = au_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[AU_OL_0006] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = au_rec_count(bizdate, AU_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[AU_OL_0006] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/au_ol_0007.c b/app/online/au_ol_0007.c new file mode 100644 index 0000000..280e2d7 --- /dev/null +++ b/app/online/au_ol_0007.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/au_ol_0007.pgc" +/* @tier easy @module au @transform authorization-online */ +/* + * au_ol_0007.pgc - 승인한도 온라인 서비스 (AU_OL_0007) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 au 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "au_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/au_ol_0007.pgc" + + +TX_SERVICE(AU_OL_0007, ctx) +{ + au_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[AU_OL_0007] 승인한도 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AU_OL_0007] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = au_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[AU_OL_0007] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[AU_OL_0007] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/au_ol_0007.pgc b/app/online/au_ol_0007.pgc new file mode 100644 index 0000000..22384ed --- /dev/null +++ b/app/online/au_ol_0007.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module au @transform authorization-online */ +/* + * au_ol_0007.pgc - 승인한도 온라인 서비스 (AU_OL_0007) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 au 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "au_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(AU_OL_0007, ctx) +{ + au_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[AU_OL_0007] 승인한도 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AU_OL_0007] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = au_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[AU_OL_0007] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[AU_OL_0007] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/au_ol_0008.c b/app/online/au_ol_0008.c new file mode 100644 index 0000000..559812c --- /dev/null +++ b/app/online/au_ol_0008.c @@ -0,0 +1,176 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/au_ol_0008.pgc" +/* @tier hard @module au @transform authorization-online */ +/* + * au_ol_0008.pgc - 승인한도 온라인 서비스 (AU_OL_0008) [tier=hard] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 au 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "au_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/au_ol_0008.pgc" + + +TX_SERVICE(AU_OL_0008, ctx) +{ + au_rec_t rec; + char key[16], merch[16], bizdate[16], nextbiz[9]; + long amount = 0, daysum = 0; + int rc; + TXBUF *sub_in; + TXBUF *sub_out; + + tx_log(TX_LOG_INFO, "[AU_OL_0008] 승인한도 트랜잭션 오케스트레이션 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AU_OL_0008] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + if (!amount_is_valid(amount) || !date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[AU_OL_0008] 입력 검증 실패 amount=%ld date=%s", + amount, bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + /* 트랜잭션 시작 → 원장 반영 → 후속 서비스 연계 → 커밋 */ + if (tx_begin() != TX_OK) { + tx_return(ctx, TX_FAIL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, AU_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; + + rc = au_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[AU_OL_0008] 원장반영 실패 rc=%d", rc); + tx_abort(); + tx_return(ctx, rc, ctx->out); + return; + } + + /* 정산 영업일 = 거래일의 다음 영업일 */ + if (date_next_business(bizdate, nextbiz) != 0) { + memcpy(nextbiz, bizdate, 8); + nextbiz[8] = '\0'; + } + + /* 후속 정산집계 서비스 연계 (레지스트리 문자열 디스패치) */ + sub_in = tx_buf_alloc(); + sub_out = tx_buf_alloc(); + if (sub_in && sub_out) { + tx_buf_sets(sub_in, "MERCHID", merch); + tx_buf_sets(sub_in, "BIZDATE", nextbiz); + tx_buf_setlong(sub_in, "AMOUNT", amount); + rc = tx_call("AU_POST", sub_in, sub_out); + if (rc != TX_OK) + tx_log(TX_LOG_WARN, "[AU_OL_0008] 후속연계 경고 rc=%d", rc); + } + tx_buf_free(sub_in); + tx_buf_free(sub_out); + + /* 교차 검증: 당일 합계 재계산 */ + if (au_rec_sum(bizdate, &daysum) != TX_OK) + daysum = 0; + + tx_commit(); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYSUM", daysum); + tx_log(TX_LOG_INFO, "[AU_OL_0008] 완료 key=%s 당일합계=%ld", key, daysum); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/au_ol_0008.pgc b/app/online/au_ol_0008.pgc new file mode 100644 index 0000000..6ff2762 --- /dev/null +++ b/app/online/au_ol_0008.pgc @@ -0,0 +1,98 @@ +/* @tier hard @module au @transform authorization-online */ +/* + * au_ol_0008.pgc - 승인한도 온라인 서비스 (AU_OL_0008) [tier=hard] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 au 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "au_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(AU_OL_0008, ctx) +{ + au_rec_t rec; + char key[16], merch[16], bizdate[16], nextbiz[9]; + long amount = 0, daysum = 0; + int rc; + TXBUF *sub_in; + TXBUF *sub_out; + + tx_log(TX_LOG_INFO, "[AU_OL_0008] 승인한도 트랜잭션 오케스트레이션 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AU_OL_0008] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + if (!amount_is_valid(amount) || !date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[AU_OL_0008] 입력 검증 실패 amount=%ld date=%s", + amount, bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + /* 트랜잭션 시작 → 원장 반영 → 후속 서비스 연계 → 커밋 */ + if (tx_begin() != TX_OK) { + tx_return(ctx, TX_FAIL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, AU_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; + + rc = au_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[AU_OL_0008] 원장반영 실패 rc=%d", rc); + tx_abort(); + tx_return(ctx, rc, ctx->out); + return; + } + + /* 정산 영업일 = 거래일의 다음 영업일 */ + if (date_next_business(bizdate, nextbiz) != 0) { + memcpy(nextbiz, bizdate, 8); + nextbiz[8] = '\0'; + } + + /* 후속 정산집계 서비스 연계 (레지스트리 문자열 디스패치) */ + sub_in = tx_buf_alloc(); + sub_out = tx_buf_alloc(); + if (sub_in && sub_out) { + tx_buf_sets(sub_in, "MERCHID", merch); + tx_buf_sets(sub_in, "BIZDATE", nextbiz); + tx_buf_setlong(sub_in, "AMOUNT", amount); + rc = tx_call("AU_POST", sub_in, sub_out); + if (rc != TX_OK) + tx_log(TX_LOG_WARN, "[AU_OL_0008] 후속연계 경고 rc=%d", rc); + } + tx_buf_free(sub_in); + tx_buf_free(sub_out); + + /* 교차 검증: 당일 합계 재계산 */ + if (au_rec_sum(bizdate, &daysum) != TX_OK) + daysum = 0; + + tx_commit(); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYSUM", daysum); + tx_log(TX_LOG_INFO, "[AU_OL_0008] 완료 key=%s 당일합계=%ld", key, daysum); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/au_ol_0009.c b/app/online/au_ol_0009.c new file mode 100644 index 0000000..f54810e --- /dev/null +++ b/app/online/au_ol_0009.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/au_ol_0009.pgc" +/* @tier easy @module au @transform authorization-online */ +/* + * au_ol_0009.pgc - 승인한도 온라인 서비스 (AU_OL_0009) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 au 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "au_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/au_ol_0009.pgc" + + +TX_SERVICE(AU_OL_0009, ctx) +{ + au_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[AU_OL_0009] 승인한도 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AU_OL_0009] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = au_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[AU_OL_0009] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[AU_OL_0009] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/au_ol_0009.pgc b/app/online/au_ol_0009.pgc new file mode 100644 index 0000000..3def24b --- /dev/null +++ b/app/online/au_ol_0009.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module au @transform authorization-online */ +/* + * au_ol_0009.pgc - 승인한도 온라인 서비스 (AU_OL_0009) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 au 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "au_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(AU_OL_0009, ctx) +{ + au_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[AU_OL_0009] 승인한도 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AU_OL_0009] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = au_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[AU_OL_0009] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[AU_OL_0009] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/au_ol_0010.c b/app/online/au_ol_0010.c new file mode 100644 index 0000000..b9b4959 --- /dev/null +++ b/app/online/au_ol_0010.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/au_ol_0010.pgc" +/* @tier easy @module au @transform authorization-online */ +/* + * au_ol_0010.pgc - 승인한도 온라인 서비스 (AU_OL_0010) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 au 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "au_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/au_ol_0010.pgc" + + +TX_SERVICE(AU_OL_0010, ctx) +{ + au_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[AU_OL_0010] 승인한도 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AU_OL_0010] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = au_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[AU_OL_0010] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[AU_OL_0010] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/au_ol_0010.pgc b/app/online/au_ol_0010.pgc new file mode 100644 index 0000000..453e9c4 --- /dev/null +++ b/app/online/au_ol_0010.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module au @transform authorization-online */ +/* + * au_ol_0010.pgc - 승인한도 온라인 서비스 (AU_OL_0010) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 au 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "au_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(AU_OL_0010, ctx) +{ + au_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[AU_OL_0010] 승인한도 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AU_OL_0010] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = au_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[AU_OL_0010] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[AU_OL_0010] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/au_ol_0011.c b/app/online/au_ol_0011.c new file mode 100644 index 0000000..c94e200 --- /dev/null +++ b/app/online/au_ol_0011.c @@ -0,0 +1,148 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/au_ol_0011.pgc" +/* @tier medium @module au @transform authorization-online */ +/* + * au_ol_0011.pgc - 승인한도 온라인 서비스 (AU_OL_0011) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 au 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "au_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/au_ol_0011.pgc" + + +TX_SERVICE(AU_OL_0011, ctx) +{ + au_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[AU_OL_0011] 승인한도 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AU_OL_0011] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[AU_OL_0011] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[AU_OL_0011] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, AU_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = au_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[AU_OL_0011] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = au_rec_count(bizdate, AU_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[AU_OL_0011] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/au_ol_0011.pgc b/app/online/au_ol_0011.pgc new file mode 100644 index 0000000..36a3a95 --- /dev/null +++ b/app/online/au_ol_0011.pgc @@ -0,0 +1,70 @@ +/* @tier medium @module au @transform authorization-online */ +/* + * au_ol_0011.pgc - 승인한도 온라인 서비스 (AU_OL_0011) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 au 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "au_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(AU_OL_0011, ctx) +{ + au_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[AU_OL_0011] 승인한도 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AU_OL_0011] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[AU_OL_0011] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[AU_OL_0011] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, AU_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = au_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[AU_OL_0011] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = au_rec_count(bizdate, AU_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[AU_OL_0011] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/au_ol_0012.c b/app/online/au_ol_0012.c new file mode 100644 index 0000000..9b60028 --- /dev/null +++ b/app/online/au_ol_0012.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/au_ol_0012.pgc" +/* @tier easy @module au @transform authorization-online */ +/* + * au_ol_0012.pgc - 승인한도 온라인 서비스 (AU_OL_0012) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 au 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "au_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/au_ol_0012.pgc" + + +TX_SERVICE(AU_OL_0012, ctx) +{ + au_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[AU_OL_0012] 승인한도 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AU_OL_0012] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = au_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[AU_OL_0012] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[AU_OL_0012] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/au_ol_0012.pgc b/app/online/au_ol_0012.pgc new file mode 100644 index 0000000..3c93a7a --- /dev/null +++ b/app/online/au_ol_0012.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module au @transform authorization-online */ +/* + * au_ol_0012.pgc - 승인한도 온라인 서비스 (AU_OL_0012) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 au 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "au_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(AU_OL_0012, ctx) +{ + au_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[AU_OL_0012] 승인한도 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AU_OL_0012] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = au_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[AU_OL_0012] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[AU_OL_0012] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/au_ol_0013.c b/app/online/au_ol_0013.c new file mode 100644 index 0000000..8e782da --- /dev/null +++ b/app/online/au_ol_0013.c @@ -0,0 +1,148 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/au_ol_0013.pgc" +/* @tier medium @module au @transform authorization-online */ +/* + * au_ol_0013.pgc - 승인한도 온라인 서비스 (AU_OL_0013) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 au 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "au_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/au_ol_0013.pgc" + + +TX_SERVICE(AU_OL_0013, ctx) +{ + au_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[AU_OL_0013] 승인한도 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AU_OL_0013] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[AU_OL_0013] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[AU_OL_0013] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, AU_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = au_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[AU_OL_0013] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = au_rec_count(bizdate, AU_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[AU_OL_0013] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/au_ol_0013.pgc b/app/online/au_ol_0013.pgc new file mode 100644 index 0000000..4122d17 --- /dev/null +++ b/app/online/au_ol_0013.pgc @@ -0,0 +1,70 @@ +/* @tier medium @module au @transform authorization-online */ +/* + * au_ol_0013.pgc - 승인한도 온라인 서비스 (AU_OL_0013) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 au 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "au_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(AU_OL_0013, ctx) +{ + au_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[AU_OL_0013] 승인한도 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AU_OL_0013] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[AU_OL_0013] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[AU_OL_0013] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, AU_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = au_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[AU_OL_0013] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = au_rec_count(bizdate, AU_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[AU_OL_0013] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/au_ol_0014.c b/app/online/au_ol_0014.c new file mode 100644 index 0000000..7a938a5 --- /dev/null +++ b/app/online/au_ol_0014.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/au_ol_0014.pgc" +/* @tier easy @module au @transform authorization-online */ +/* + * au_ol_0014.pgc - 승인한도 온라인 서비스 (AU_OL_0014) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 au 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "au_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/au_ol_0014.pgc" + + +TX_SERVICE(AU_OL_0014, ctx) +{ + au_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[AU_OL_0014] 승인한도 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AU_OL_0014] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = au_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[AU_OL_0014] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[AU_OL_0014] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/au_ol_0014.pgc b/app/online/au_ol_0014.pgc new file mode 100644 index 0000000..4b09598 --- /dev/null +++ b/app/online/au_ol_0014.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module au @transform authorization-online */ +/* + * au_ol_0014.pgc - 승인한도 온라인 서비스 (AU_OL_0014) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 au 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "au_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(AU_OL_0014, ctx) +{ + au_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[AU_OL_0014] 승인한도 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AU_OL_0014] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = au_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[AU_OL_0014] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[AU_OL_0014] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/au_ol_0015.c b/app/online/au_ol_0015.c new file mode 100644 index 0000000..306ca79 --- /dev/null +++ b/app/online/au_ol_0015.c @@ -0,0 +1,148 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/au_ol_0015.pgc" +/* @tier medium @module au @transform authorization-online */ +/* + * au_ol_0015.pgc - 승인한도 온라인 서비스 (AU_OL_0015) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 au 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "au_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/au_ol_0015.pgc" + + +TX_SERVICE(AU_OL_0015, ctx) +{ + au_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[AU_OL_0015] 승인한도 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AU_OL_0015] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[AU_OL_0015] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[AU_OL_0015] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, AU_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = au_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[AU_OL_0015] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = au_rec_count(bizdate, AU_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[AU_OL_0015] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/au_ol_0015.pgc b/app/online/au_ol_0015.pgc new file mode 100644 index 0000000..6c731df --- /dev/null +++ b/app/online/au_ol_0015.pgc @@ -0,0 +1,70 @@ +/* @tier medium @module au @transform authorization-online */ +/* + * au_ol_0015.pgc - 승인한도 온라인 서비스 (AU_OL_0015) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 au 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "au_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(AU_OL_0015, ctx) +{ + au_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[AU_OL_0015] 승인한도 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AU_OL_0015] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[AU_OL_0015] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[AU_OL_0015] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, AU_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = au_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[AU_OL_0015] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = au_rec_count(bizdate, AU_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[AU_OL_0015] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/au_ol_0016.c b/app/online/au_ol_0016.c new file mode 100644 index 0000000..5aba921 --- /dev/null +++ b/app/online/au_ol_0016.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/au_ol_0016.pgc" +/* @tier easy @module au @transform authorization-online */ +/* + * au_ol_0016.pgc - 승인한도 온라인 서비스 (AU_OL_0016) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 au 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "au_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/au_ol_0016.pgc" + + +TX_SERVICE(AU_OL_0016, ctx) +{ + au_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[AU_OL_0016] 승인한도 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AU_OL_0016] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = au_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[AU_OL_0016] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[AU_OL_0016] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/au_ol_0016.pgc b/app/online/au_ol_0016.pgc new file mode 100644 index 0000000..735b59a --- /dev/null +++ b/app/online/au_ol_0016.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module au @transform authorization-online */ +/* + * au_ol_0016.pgc - 승인한도 온라인 서비스 (AU_OL_0016) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 au 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "au_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(AU_OL_0016, ctx) +{ + au_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[AU_OL_0016] 승인한도 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AU_OL_0016] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = au_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[AU_OL_0016] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[AU_OL_0016] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/au_ol_0017.c b/app/online/au_ol_0017.c new file mode 100644 index 0000000..5898990 --- /dev/null +++ b/app/online/au_ol_0017.c @@ -0,0 +1,176 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/au_ol_0017.pgc" +/* @tier hard @module au @transform authorization-online */ +/* + * au_ol_0017.pgc - 승인한도 온라인 서비스 (AU_OL_0017) [tier=hard] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 au 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "au_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/au_ol_0017.pgc" + + +TX_SERVICE(AU_OL_0017, ctx) +{ + au_rec_t rec; + char key[16], merch[16], bizdate[16], nextbiz[9]; + long amount = 0, daysum = 0; + int rc; + TXBUF *sub_in; + TXBUF *sub_out; + + tx_log(TX_LOG_INFO, "[AU_OL_0017] 승인한도 트랜잭션 오케스트레이션 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AU_OL_0017] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + if (!amount_is_valid(amount) || !date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[AU_OL_0017] 입력 검증 실패 amount=%ld date=%s", + amount, bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + /* 트랜잭션 시작 → 원장 반영 → 후속 서비스 연계 → 커밋 */ + if (tx_begin() != TX_OK) { + tx_return(ctx, TX_FAIL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, AU_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; + + rc = au_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[AU_OL_0017] 원장반영 실패 rc=%d", rc); + tx_abort(); + tx_return(ctx, rc, ctx->out); + return; + } + + /* 정산 영업일 = 거래일의 다음 영업일 */ + if (date_next_business(bizdate, nextbiz) != 0) { + memcpy(nextbiz, bizdate, 8); + nextbiz[8] = '\0'; + } + + /* 후속 정산집계 서비스 연계 (레지스트리 문자열 디스패치) */ + sub_in = tx_buf_alloc(); + sub_out = tx_buf_alloc(); + if (sub_in && sub_out) { + tx_buf_sets(sub_in, "MERCHID", merch); + tx_buf_sets(sub_in, "BIZDATE", nextbiz); + tx_buf_setlong(sub_in, "AMOUNT", amount); + rc = tx_call("AU_POST", sub_in, sub_out); + if (rc != TX_OK) + tx_log(TX_LOG_WARN, "[AU_OL_0017] 후속연계 경고 rc=%d", rc); + } + tx_buf_free(sub_in); + tx_buf_free(sub_out); + + /* 교차 검증: 당일 합계 재계산 */ + if (au_rec_sum(bizdate, &daysum) != TX_OK) + daysum = 0; + + tx_commit(); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYSUM", daysum); + tx_log(TX_LOG_INFO, "[AU_OL_0017] 완료 key=%s 당일합계=%ld", key, daysum); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/au_ol_0017.pgc b/app/online/au_ol_0017.pgc new file mode 100644 index 0000000..de9f935 --- /dev/null +++ b/app/online/au_ol_0017.pgc @@ -0,0 +1,98 @@ +/* @tier hard @module au @transform authorization-online */ +/* + * au_ol_0017.pgc - 승인한도 온라인 서비스 (AU_OL_0017) [tier=hard] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 au 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "au_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(AU_OL_0017, ctx) +{ + au_rec_t rec; + char key[16], merch[16], bizdate[16], nextbiz[9]; + long amount = 0, daysum = 0; + int rc; + TXBUF *sub_in; + TXBUF *sub_out; + + tx_log(TX_LOG_INFO, "[AU_OL_0017] 승인한도 트랜잭션 오케스트레이션 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AU_OL_0017] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + if (!amount_is_valid(amount) || !date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[AU_OL_0017] 입력 검증 실패 amount=%ld date=%s", + amount, bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + /* 트랜잭션 시작 → 원장 반영 → 후속 서비스 연계 → 커밋 */ + if (tx_begin() != TX_OK) { + tx_return(ctx, TX_FAIL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, AU_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; + + rc = au_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[AU_OL_0017] 원장반영 실패 rc=%d", rc); + tx_abort(); + tx_return(ctx, rc, ctx->out); + return; + } + + /* 정산 영업일 = 거래일의 다음 영업일 */ + if (date_next_business(bizdate, nextbiz) != 0) { + memcpy(nextbiz, bizdate, 8); + nextbiz[8] = '\0'; + } + + /* 후속 정산집계 서비스 연계 (레지스트리 문자열 디스패치) */ + sub_in = tx_buf_alloc(); + sub_out = tx_buf_alloc(); + if (sub_in && sub_out) { + tx_buf_sets(sub_in, "MERCHID", merch); + tx_buf_sets(sub_in, "BIZDATE", nextbiz); + tx_buf_setlong(sub_in, "AMOUNT", amount); + rc = tx_call("AU_POST", sub_in, sub_out); + if (rc != TX_OK) + tx_log(TX_LOG_WARN, "[AU_OL_0017] 후속연계 경고 rc=%d", rc); + } + tx_buf_free(sub_in); + tx_buf_free(sub_out); + + /* 교차 검증: 당일 합계 재계산 */ + if (au_rec_sum(bizdate, &daysum) != TX_OK) + daysum = 0; + + tx_commit(); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYSUM", daysum); + tx_log(TX_LOG_INFO, "[AU_OL_0017] 완료 key=%s 당일합계=%ld", key, daysum); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/au_ol_0018.c b/app/online/au_ol_0018.c new file mode 100644 index 0000000..5b867f1 --- /dev/null +++ b/app/online/au_ol_0018.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/au_ol_0018.pgc" +/* @tier easy @module au @transform authorization-online */ +/* + * au_ol_0018.pgc - 승인한도 온라인 서비스 (AU_OL_0018) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 au 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "au_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/au_ol_0018.pgc" + + +TX_SERVICE(AU_OL_0018, ctx) +{ + au_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[AU_OL_0018] 승인한도 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AU_OL_0018] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = au_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[AU_OL_0018] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[AU_OL_0018] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/au_ol_0018.pgc b/app/online/au_ol_0018.pgc new file mode 100644 index 0000000..311cfbe --- /dev/null +++ b/app/online/au_ol_0018.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module au @transform authorization-online */ +/* + * au_ol_0018.pgc - 승인한도 온라인 서비스 (AU_OL_0018) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 au 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "au_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(AU_OL_0018, ctx) +{ + au_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[AU_OL_0018] 승인한도 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AU_OL_0018] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = au_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[AU_OL_0018] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[AU_OL_0018] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/au_ol_0019.c b/app/online/au_ol_0019.c new file mode 100644 index 0000000..5404cff --- /dev/null +++ b/app/online/au_ol_0019.c @@ -0,0 +1,176 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/au_ol_0019.pgc" +/* @tier hard @module au @transform authorization-online */ +/* + * au_ol_0019.pgc - 승인한도 온라인 서비스 (AU_OL_0019) [tier=hard] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 au 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "au_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/au_ol_0019.pgc" + + +TX_SERVICE(AU_OL_0019, ctx) +{ + au_rec_t rec; + char key[16], merch[16], bizdate[16], nextbiz[9]; + long amount = 0, daysum = 0; + int rc; + TXBUF *sub_in; + TXBUF *sub_out; + + tx_log(TX_LOG_INFO, "[AU_OL_0019] 승인한도 트랜잭션 오케스트레이션 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AU_OL_0019] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + if (!amount_is_valid(amount) || !date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[AU_OL_0019] 입력 검증 실패 amount=%ld date=%s", + amount, bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + /* 트랜잭션 시작 → 원장 반영 → 후속 서비스 연계 → 커밋 */ + if (tx_begin() != TX_OK) { + tx_return(ctx, TX_FAIL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, AU_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; + + rc = au_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[AU_OL_0019] 원장반영 실패 rc=%d", rc); + tx_abort(); + tx_return(ctx, rc, ctx->out); + return; + } + + /* 정산 영업일 = 거래일의 다음 영업일 */ + if (date_next_business(bizdate, nextbiz) != 0) { + memcpy(nextbiz, bizdate, 8); + nextbiz[8] = '\0'; + } + + /* 후속 정산집계 서비스 연계 (레지스트리 문자열 디스패치) */ + sub_in = tx_buf_alloc(); + sub_out = tx_buf_alloc(); + if (sub_in && sub_out) { + tx_buf_sets(sub_in, "MERCHID", merch); + tx_buf_sets(sub_in, "BIZDATE", nextbiz); + tx_buf_setlong(sub_in, "AMOUNT", amount); + rc = tx_call("AU_POST", sub_in, sub_out); + if (rc != TX_OK) + tx_log(TX_LOG_WARN, "[AU_OL_0019] 후속연계 경고 rc=%d", rc); + } + tx_buf_free(sub_in); + tx_buf_free(sub_out); + + /* 교차 검증: 당일 합계 재계산 */ + if (au_rec_sum(bizdate, &daysum) != TX_OK) + daysum = 0; + + tx_commit(); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYSUM", daysum); + tx_log(TX_LOG_INFO, "[AU_OL_0019] 완료 key=%s 당일합계=%ld", key, daysum); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/au_ol_0019.pgc b/app/online/au_ol_0019.pgc new file mode 100644 index 0000000..b03d3f6 --- /dev/null +++ b/app/online/au_ol_0019.pgc @@ -0,0 +1,98 @@ +/* @tier hard @module au @transform authorization-online */ +/* + * au_ol_0019.pgc - 승인한도 온라인 서비스 (AU_OL_0019) [tier=hard] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 au 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "au_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(AU_OL_0019, ctx) +{ + au_rec_t rec; + char key[16], merch[16], bizdate[16], nextbiz[9]; + long amount = 0, daysum = 0; + int rc; + TXBUF *sub_in; + TXBUF *sub_out; + + tx_log(TX_LOG_INFO, "[AU_OL_0019] 승인한도 트랜잭션 오케스트레이션 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AU_OL_0019] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + if (!amount_is_valid(amount) || !date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[AU_OL_0019] 입력 검증 실패 amount=%ld date=%s", + amount, bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + /* 트랜잭션 시작 → 원장 반영 → 후속 서비스 연계 → 커밋 */ + if (tx_begin() != TX_OK) { + tx_return(ctx, TX_FAIL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, AU_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; + + rc = au_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[AU_OL_0019] 원장반영 실패 rc=%d", rc); + tx_abort(); + tx_return(ctx, rc, ctx->out); + return; + } + + /* 정산 영업일 = 거래일의 다음 영업일 */ + if (date_next_business(bizdate, nextbiz) != 0) { + memcpy(nextbiz, bizdate, 8); + nextbiz[8] = '\0'; + } + + /* 후속 정산집계 서비스 연계 (레지스트리 문자열 디스패치) */ + sub_in = tx_buf_alloc(); + sub_out = tx_buf_alloc(); + if (sub_in && sub_out) { + tx_buf_sets(sub_in, "MERCHID", merch); + tx_buf_sets(sub_in, "BIZDATE", nextbiz); + tx_buf_setlong(sub_in, "AMOUNT", amount); + rc = tx_call("AU_POST", sub_in, sub_out); + if (rc != TX_OK) + tx_log(TX_LOG_WARN, "[AU_OL_0019] 후속연계 경고 rc=%d", rc); + } + tx_buf_free(sub_in); + tx_buf_free(sub_out); + + /* 교차 검증: 당일 합계 재계산 */ + if (au_rec_sum(bizdate, &daysum) != TX_OK) + daysum = 0; + + tx_commit(); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYSUM", daysum); + tx_log(TX_LOG_INFO, "[AU_OL_0019] 완료 key=%s 당일합계=%ld", key, daysum); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/au_ol_0020.c b/app/online/au_ol_0020.c new file mode 100644 index 0000000..e24f401 --- /dev/null +++ b/app/online/au_ol_0020.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/au_ol_0020.pgc" +/* @tier easy @module au @transform authorization-online */ +/* + * au_ol_0020.pgc - 승인한도 온라인 서비스 (AU_OL_0020) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 au 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "au_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/au_ol_0020.pgc" + + +TX_SERVICE(AU_OL_0020, ctx) +{ + au_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[AU_OL_0020] 승인한도 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AU_OL_0020] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = au_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[AU_OL_0020] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[AU_OL_0020] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/au_ol_0020.pgc b/app/online/au_ol_0020.pgc new file mode 100644 index 0000000..6c93689 --- /dev/null +++ b/app/online/au_ol_0020.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module au @transform authorization-online */ +/* + * au_ol_0020.pgc - 승인한도 온라인 서비스 (AU_OL_0020) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 au 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "au_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(AU_OL_0020, ctx) +{ + au_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[AU_OL_0020] 승인한도 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AU_OL_0020] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = au_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[AU_OL_0020] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[AU_OL_0020] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/au_ol_0021.c b/app/online/au_ol_0021.c new file mode 100644 index 0000000..b28ddc9 --- /dev/null +++ b/app/online/au_ol_0021.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/au_ol_0021.pgc" +/* @tier easy @module au @transform authorization-online */ +/* + * au_ol_0021.pgc - 승인한도 온라인 서비스 (AU_OL_0021) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 au 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "au_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/au_ol_0021.pgc" + + +TX_SERVICE(AU_OL_0021, ctx) +{ + au_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[AU_OL_0021] 승인한도 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AU_OL_0021] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = au_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[AU_OL_0021] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[AU_OL_0021] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/au_ol_0021.pgc b/app/online/au_ol_0021.pgc new file mode 100644 index 0000000..f2abd38 --- /dev/null +++ b/app/online/au_ol_0021.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module au @transform authorization-online */ +/* + * au_ol_0021.pgc - 승인한도 온라인 서비스 (AU_OL_0021) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 au 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "au_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(AU_OL_0021, ctx) +{ + au_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[AU_OL_0021] 승인한도 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AU_OL_0021] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = au_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[AU_OL_0021] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[AU_OL_0021] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/au_ol_0022.c b/app/online/au_ol_0022.c new file mode 100644 index 0000000..6b5fb7a --- /dev/null +++ b/app/online/au_ol_0022.c @@ -0,0 +1,148 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/au_ol_0022.pgc" +/* @tier medium @module au @transform authorization-online */ +/* + * au_ol_0022.pgc - 승인한도 온라인 서비스 (AU_OL_0022) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 au 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "au_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/au_ol_0022.pgc" + + +TX_SERVICE(AU_OL_0022, ctx) +{ + au_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[AU_OL_0022] 승인한도 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AU_OL_0022] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[AU_OL_0022] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[AU_OL_0022] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, AU_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = au_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[AU_OL_0022] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = au_rec_count(bizdate, AU_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[AU_OL_0022] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/au_ol_0022.pgc b/app/online/au_ol_0022.pgc new file mode 100644 index 0000000..e7b6aa3 --- /dev/null +++ b/app/online/au_ol_0022.pgc @@ -0,0 +1,70 @@ +/* @tier medium @module au @transform authorization-online */ +/* + * au_ol_0022.pgc - 승인한도 온라인 서비스 (AU_OL_0022) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 au 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "au_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(AU_OL_0022, ctx) +{ + au_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[AU_OL_0022] 승인한도 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AU_OL_0022] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[AU_OL_0022] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[AU_OL_0022] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, AU_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = au_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[AU_OL_0022] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = au_rec_count(bizdate, AU_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[AU_OL_0022] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/au_ol_0023.c b/app/online/au_ol_0023.c new file mode 100644 index 0000000..b755c04 --- /dev/null +++ b/app/online/au_ol_0023.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/au_ol_0023.pgc" +/* @tier easy @module au @transform authorization-online */ +/* + * au_ol_0023.pgc - 승인한도 온라인 서비스 (AU_OL_0023) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 au 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "au_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/au_ol_0023.pgc" + + +TX_SERVICE(AU_OL_0023, ctx) +{ + au_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[AU_OL_0023] 승인한도 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AU_OL_0023] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = au_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[AU_OL_0023] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[AU_OL_0023] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/au_ol_0023.pgc b/app/online/au_ol_0023.pgc new file mode 100644 index 0000000..860e444 --- /dev/null +++ b/app/online/au_ol_0023.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module au @transform authorization-online */ +/* + * au_ol_0023.pgc - 승인한도 온라인 서비스 (AU_OL_0023) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 au 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "au_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(AU_OL_0023, ctx) +{ + au_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[AU_OL_0023] 승인한도 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AU_OL_0023] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = au_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[AU_OL_0023] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[AU_OL_0023] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/au_ol_0024.c b/app/online/au_ol_0024.c new file mode 100644 index 0000000..6fa87f4 --- /dev/null +++ b/app/online/au_ol_0024.c @@ -0,0 +1,148 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/au_ol_0024.pgc" +/* @tier medium @module au @transform authorization-online */ +/* + * au_ol_0024.pgc - 승인한도 온라인 서비스 (AU_OL_0024) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 au 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "au_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/au_ol_0024.pgc" + + +TX_SERVICE(AU_OL_0024, ctx) +{ + au_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[AU_OL_0024] 승인한도 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AU_OL_0024] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[AU_OL_0024] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[AU_OL_0024] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, AU_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = au_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[AU_OL_0024] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = au_rec_count(bizdate, AU_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[AU_OL_0024] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/au_ol_0024.pgc b/app/online/au_ol_0024.pgc new file mode 100644 index 0000000..600e8db --- /dev/null +++ b/app/online/au_ol_0024.pgc @@ -0,0 +1,70 @@ +/* @tier medium @module au @transform authorization-online */ +/* + * au_ol_0024.pgc - 승인한도 온라인 서비스 (AU_OL_0024) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 au 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "au_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(AU_OL_0024, ctx) +{ + au_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[AU_OL_0024] 승인한도 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AU_OL_0024] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[AU_OL_0024] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[AU_OL_0024] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, AU_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = au_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[AU_OL_0024] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = au_rec_count(bizdate, AU_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[AU_OL_0024] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/au_ol_0025.c b/app/online/au_ol_0025.c new file mode 100644 index 0000000..400f3c6 --- /dev/null +++ b/app/online/au_ol_0025.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/au_ol_0025.pgc" +/* @tier easy @module au @transform authorization-online */ +/* + * au_ol_0025.pgc - 승인한도 온라인 서비스 (AU_OL_0025) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 au 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "au_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/au_ol_0025.pgc" + + +TX_SERVICE(AU_OL_0025, ctx) +{ + au_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[AU_OL_0025] 승인한도 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AU_OL_0025] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = au_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[AU_OL_0025] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[AU_OL_0025] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/au_ol_0025.pgc b/app/online/au_ol_0025.pgc new file mode 100644 index 0000000..f99b387 --- /dev/null +++ b/app/online/au_ol_0025.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module au @transform authorization-online */ +/* + * au_ol_0025.pgc - 승인한도 온라인 서비스 (AU_OL_0025) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 au 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "au_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(AU_OL_0025, ctx) +{ + au_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[AU_OL_0025] 승인한도 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AU_OL_0025] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = au_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[AU_OL_0025] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[AU_OL_0025] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/au_ol_0026.c b/app/online/au_ol_0026.c new file mode 100644 index 0000000..102db42 --- /dev/null +++ b/app/online/au_ol_0026.c @@ -0,0 +1,148 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/au_ol_0026.pgc" +/* @tier medium @module au @transform authorization-online */ +/* + * au_ol_0026.pgc - 승인한도 온라인 서비스 (AU_OL_0026) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 au 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "au_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/au_ol_0026.pgc" + + +TX_SERVICE(AU_OL_0026, ctx) +{ + au_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[AU_OL_0026] 승인한도 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AU_OL_0026] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[AU_OL_0026] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[AU_OL_0026] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, AU_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = au_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[AU_OL_0026] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = au_rec_count(bizdate, AU_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[AU_OL_0026] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/au_ol_0026.pgc b/app/online/au_ol_0026.pgc new file mode 100644 index 0000000..de7faf7 --- /dev/null +++ b/app/online/au_ol_0026.pgc @@ -0,0 +1,70 @@ +/* @tier medium @module au @transform authorization-online */ +/* + * au_ol_0026.pgc - 승인한도 온라인 서비스 (AU_OL_0026) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 au 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "au_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(AU_OL_0026, ctx) +{ + au_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[AU_OL_0026] 승인한도 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AU_OL_0026] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[AU_OL_0026] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[AU_OL_0026] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, AU_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = au_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[AU_OL_0026] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = au_rec_count(bizdate, AU_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[AU_OL_0026] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/au_ol_0027.c b/app/online/au_ol_0027.c new file mode 100644 index 0000000..b889566 --- /dev/null +++ b/app/online/au_ol_0027.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/au_ol_0027.pgc" +/* @tier easy @module au @transform authorization-online */ +/* + * au_ol_0027.pgc - 승인한도 온라인 서비스 (AU_OL_0027) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 au 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "au_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/au_ol_0027.pgc" + + +TX_SERVICE(AU_OL_0027, ctx) +{ + au_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[AU_OL_0027] 승인한도 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AU_OL_0027] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = au_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[AU_OL_0027] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[AU_OL_0027] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/au_ol_0027.pgc b/app/online/au_ol_0027.pgc new file mode 100644 index 0000000..e71e761 --- /dev/null +++ b/app/online/au_ol_0027.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module au @transform authorization-online */ +/* + * au_ol_0027.pgc - 승인한도 온라인 서비스 (AU_OL_0027) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 au 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "au_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(AU_OL_0027, ctx) +{ + au_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[AU_OL_0027] 승인한도 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AU_OL_0027] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = au_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[AU_OL_0027] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[AU_OL_0027] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/au_ol_0028.c b/app/online/au_ol_0028.c new file mode 100644 index 0000000..dea7248 --- /dev/null +++ b/app/online/au_ol_0028.c @@ -0,0 +1,176 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/au_ol_0028.pgc" +/* @tier hard @module au @transform authorization-online */ +/* + * au_ol_0028.pgc - 승인한도 온라인 서비스 (AU_OL_0028) [tier=hard] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 au 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "au_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/au_ol_0028.pgc" + + +TX_SERVICE(AU_OL_0028, ctx) +{ + au_rec_t rec; + char key[16], merch[16], bizdate[16], nextbiz[9]; + long amount = 0, daysum = 0; + int rc; + TXBUF *sub_in; + TXBUF *sub_out; + + tx_log(TX_LOG_INFO, "[AU_OL_0028] 승인한도 트랜잭션 오케스트레이션 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AU_OL_0028] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + if (!amount_is_valid(amount) || !date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[AU_OL_0028] 입력 검증 실패 amount=%ld date=%s", + amount, bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + /* 트랜잭션 시작 → 원장 반영 → 후속 서비스 연계 → 커밋 */ + if (tx_begin() != TX_OK) { + tx_return(ctx, TX_FAIL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, AU_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; + + rc = au_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[AU_OL_0028] 원장반영 실패 rc=%d", rc); + tx_abort(); + tx_return(ctx, rc, ctx->out); + return; + } + + /* 정산 영업일 = 거래일의 다음 영업일 */ + if (date_next_business(bizdate, nextbiz) != 0) { + memcpy(nextbiz, bizdate, 8); + nextbiz[8] = '\0'; + } + + /* 후속 정산집계 서비스 연계 (레지스트리 문자열 디스패치) */ + sub_in = tx_buf_alloc(); + sub_out = tx_buf_alloc(); + if (sub_in && sub_out) { + tx_buf_sets(sub_in, "MERCHID", merch); + tx_buf_sets(sub_in, "BIZDATE", nextbiz); + tx_buf_setlong(sub_in, "AMOUNT", amount); + rc = tx_call("AU_POST", sub_in, sub_out); + if (rc != TX_OK) + tx_log(TX_LOG_WARN, "[AU_OL_0028] 후속연계 경고 rc=%d", rc); + } + tx_buf_free(sub_in); + tx_buf_free(sub_out); + + /* 교차 검증: 당일 합계 재계산 */ + if (au_rec_sum(bizdate, &daysum) != TX_OK) + daysum = 0; + + tx_commit(); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYSUM", daysum); + tx_log(TX_LOG_INFO, "[AU_OL_0028] 완료 key=%s 당일합계=%ld", key, daysum); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/au_ol_0028.pgc b/app/online/au_ol_0028.pgc new file mode 100644 index 0000000..c8d2d32 --- /dev/null +++ b/app/online/au_ol_0028.pgc @@ -0,0 +1,98 @@ +/* @tier hard @module au @transform authorization-online */ +/* + * au_ol_0028.pgc - 승인한도 온라인 서비스 (AU_OL_0028) [tier=hard] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 au 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "au_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(AU_OL_0028, ctx) +{ + au_rec_t rec; + char key[16], merch[16], bizdate[16], nextbiz[9]; + long amount = 0, daysum = 0; + int rc; + TXBUF *sub_in; + TXBUF *sub_out; + + tx_log(TX_LOG_INFO, "[AU_OL_0028] 승인한도 트랜잭션 오케스트레이션 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AU_OL_0028] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + if (!amount_is_valid(amount) || !date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[AU_OL_0028] 입력 검증 실패 amount=%ld date=%s", + amount, bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + /* 트랜잭션 시작 → 원장 반영 → 후속 서비스 연계 → 커밋 */ + if (tx_begin() != TX_OK) { + tx_return(ctx, TX_FAIL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, AU_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; + + rc = au_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[AU_OL_0028] 원장반영 실패 rc=%d", rc); + tx_abort(); + tx_return(ctx, rc, ctx->out); + return; + } + + /* 정산 영업일 = 거래일의 다음 영업일 */ + if (date_next_business(bizdate, nextbiz) != 0) { + memcpy(nextbiz, bizdate, 8); + nextbiz[8] = '\0'; + } + + /* 후속 정산집계 서비스 연계 (레지스트리 문자열 디스패치) */ + sub_in = tx_buf_alloc(); + sub_out = tx_buf_alloc(); + if (sub_in && sub_out) { + tx_buf_sets(sub_in, "MERCHID", merch); + tx_buf_sets(sub_in, "BIZDATE", nextbiz); + tx_buf_setlong(sub_in, "AMOUNT", amount); + rc = tx_call("AU_POST", sub_in, sub_out); + if (rc != TX_OK) + tx_log(TX_LOG_WARN, "[AU_OL_0028] 후속연계 경고 rc=%d", rc); + } + tx_buf_free(sub_in); + tx_buf_free(sub_out); + + /* 교차 검증: 당일 합계 재계산 */ + if (au_rec_sum(bizdate, &daysum) != TX_OK) + daysum = 0; + + tx_commit(); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYSUM", daysum); + tx_log(TX_LOG_INFO, "[AU_OL_0028] 완료 key=%s 당일합계=%ld", key, daysum); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/au_ol_0029.c b/app/online/au_ol_0029.c new file mode 100644 index 0000000..ad0551f --- /dev/null +++ b/app/online/au_ol_0029.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/au_ol_0029.pgc" +/* @tier easy @module au @transform authorization-online */ +/* + * au_ol_0029.pgc - 승인한도 온라인 서비스 (AU_OL_0029) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 au 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "au_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/au_ol_0029.pgc" + + +TX_SERVICE(AU_OL_0029, ctx) +{ + au_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[AU_OL_0029] 승인한도 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AU_OL_0029] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = au_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[AU_OL_0029] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[AU_OL_0029] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/au_ol_0029.pgc b/app/online/au_ol_0029.pgc new file mode 100644 index 0000000..d7642db --- /dev/null +++ b/app/online/au_ol_0029.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module au @transform authorization-online */ +/* + * au_ol_0029.pgc - 승인한도 온라인 서비스 (AU_OL_0029) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 au 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "au_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(AU_OL_0029, ctx) +{ + au_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[AU_OL_0029] 승인한도 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AU_OL_0029] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = au_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[AU_OL_0029] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[AU_OL_0029] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/au_ol_0030.c b/app/online/au_ol_0030.c new file mode 100644 index 0000000..558aa6c --- /dev/null +++ b/app/online/au_ol_0030.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/au_ol_0030.pgc" +/* @tier easy @module au @transform authorization-online */ +/* + * au_ol_0030.pgc - 승인한도 온라인 서비스 (AU_OL_0030) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 au 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "au_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/au_ol_0030.pgc" + + +TX_SERVICE(AU_OL_0030, ctx) +{ + au_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[AU_OL_0030] 승인한도 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AU_OL_0030] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = au_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[AU_OL_0030] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[AU_OL_0030] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/au_ol_0030.pgc b/app/online/au_ol_0030.pgc new file mode 100644 index 0000000..085132f --- /dev/null +++ b/app/online/au_ol_0030.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module au @transform authorization-online */ +/* + * au_ol_0030.pgc - 승인한도 온라인 서비스 (AU_OL_0030) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 au 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "au_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(AU_OL_0030, ctx) +{ + au_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[AU_OL_0030] 승인한도 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AU_OL_0030] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = au_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[AU_OL_0030] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[AU_OL_0030] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/au_ol_0031.c b/app/online/au_ol_0031.c new file mode 100644 index 0000000..67ddd19 --- /dev/null +++ b/app/online/au_ol_0031.c @@ -0,0 +1,148 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/au_ol_0031.pgc" +/* @tier medium @module au @transform authorization-online */ +/* + * au_ol_0031.pgc - 승인한도 온라인 서비스 (AU_OL_0031) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 au 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "au_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/au_ol_0031.pgc" + + +TX_SERVICE(AU_OL_0031, ctx) +{ + au_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[AU_OL_0031] 승인한도 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AU_OL_0031] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[AU_OL_0031] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[AU_OL_0031] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, AU_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = au_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[AU_OL_0031] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = au_rec_count(bizdate, AU_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[AU_OL_0031] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/au_ol_0031.pgc b/app/online/au_ol_0031.pgc new file mode 100644 index 0000000..3ba10c4 --- /dev/null +++ b/app/online/au_ol_0031.pgc @@ -0,0 +1,70 @@ +/* @tier medium @module au @transform authorization-online */ +/* + * au_ol_0031.pgc - 승인한도 온라인 서비스 (AU_OL_0031) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 au 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "au_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(AU_OL_0031, ctx) +{ + au_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[AU_OL_0031] 승인한도 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AU_OL_0031] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[AU_OL_0031] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[AU_OL_0031] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, AU_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = au_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[AU_OL_0031] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = au_rec_count(bizdate, AU_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[AU_OL_0031] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/au_ol_0032.c b/app/online/au_ol_0032.c new file mode 100644 index 0000000..07427ea --- /dev/null +++ b/app/online/au_ol_0032.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/au_ol_0032.pgc" +/* @tier easy @module au @transform authorization-online */ +/* + * au_ol_0032.pgc - 승인한도 온라인 서비스 (AU_OL_0032) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 au 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "au_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/au_ol_0032.pgc" + + +TX_SERVICE(AU_OL_0032, ctx) +{ + au_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[AU_OL_0032] 승인한도 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AU_OL_0032] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = au_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[AU_OL_0032] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[AU_OL_0032] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/au_ol_0032.pgc b/app/online/au_ol_0032.pgc new file mode 100644 index 0000000..b485c6c --- /dev/null +++ b/app/online/au_ol_0032.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module au @transform authorization-online */ +/* + * au_ol_0032.pgc - 승인한도 온라인 서비스 (AU_OL_0032) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 au 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "au_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(AU_OL_0032, ctx) +{ + au_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[AU_OL_0032] 승인한도 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[AU_OL_0032] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = au_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[AU_OL_0032] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[AU_OL_0032] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cl_ol_0001.c b/app/online/cl_ol_0001.c new file mode 100644 index 0000000..76f426d --- /dev/null +++ b/app/online/cl_ol_0001.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/cl_ol_0001.pgc" +/* @tier easy @module cl @transform closing-online */ +/* + * cl_ol_0001.pgc - 마감 온라인 서비스 (CL_OL_0001) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cl_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/cl_ol_0001.pgc" + + +TX_SERVICE(CL_OL_0001, ctx) +{ + cl_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[CL_OL_0001] 마감 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CL_OL_0001] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = cl_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[CL_OL_0001] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[CL_OL_0001] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cl_ol_0001.pgc b/app/online/cl_ol_0001.pgc new file mode 100644 index 0000000..4d65ae1 --- /dev/null +++ b/app/online/cl_ol_0001.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module cl @transform closing-online */ +/* + * cl_ol_0001.pgc - 마감 온라인 서비스 (CL_OL_0001) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cl_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(CL_OL_0001, ctx) +{ + cl_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[CL_OL_0001] 마감 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CL_OL_0001] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = cl_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[CL_OL_0001] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[CL_OL_0001] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cl_ol_0002.c b/app/online/cl_ol_0002.c new file mode 100644 index 0000000..0367483 --- /dev/null +++ b/app/online/cl_ol_0002.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/cl_ol_0002.pgc" +/* @tier easy @module cl @transform closing-online */ +/* + * cl_ol_0002.pgc - 마감 온라인 서비스 (CL_OL_0002) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cl_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/cl_ol_0002.pgc" + + +TX_SERVICE(CL_OL_0002, ctx) +{ + cl_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[CL_OL_0002] 마감 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CL_OL_0002] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = cl_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[CL_OL_0002] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[CL_OL_0002] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cl_ol_0002.pgc b/app/online/cl_ol_0002.pgc new file mode 100644 index 0000000..6a8498a --- /dev/null +++ b/app/online/cl_ol_0002.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module cl @transform closing-online */ +/* + * cl_ol_0002.pgc - 마감 온라인 서비스 (CL_OL_0002) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cl_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(CL_OL_0002, ctx) +{ + cl_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[CL_OL_0002] 마감 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CL_OL_0002] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = cl_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[CL_OL_0002] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[CL_OL_0002] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cl_ol_0003.c b/app/online/cl_ol_0003.c new file mode 100644 index 0000000..1567590 --- /dev/null +++ b/app/online/cl_ol_0003.c @@ -0,0 +1,148 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/cl_ol_0003.pgc" +/* @tier medium @module cl @transform closing-online */ +/* + * cl_ol_0003.pgc - 마감 온라인 서비스 (CL_OL_0003) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cl_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/cl_ol_0003.pgc" + + +TX_SERVICE(CL_OL_0003, ctx) +{ + cl_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[CL_OL_0003] 마감 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CL_OL_0003] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[CL_OL_0003] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[CL_OL_0003] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, CL_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = cl_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[CL_OL_0003] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = cl_rec_count(bizdate, CL_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[CL_OL_0003] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cl_ol_0003.pgc b/app/online/cl_ol_0003.pgc new file mode 100644 index 0000000..292fc41 --- /dev/null +++ b/app/online/cl_ol_0003.pgc @@ -0,0 +1,70 @@ +/* @tier medium @module cl @transform closing-online */ +/* + * cl_ol_0003.pgc - 마감 온라인 서비스 (CL_OL_0003) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cl_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(CL_OL_0003, ctx) +{ + cl_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[CL_OL_0003] 마감 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CL_OL_0003] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[CL_OL_0003] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[CL_OL_0003] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, CL_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = cl_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[CL_OL_0003] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = cl_rec_count(bizdate, CL_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[CL_OL_0003] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cl_ol_0004.c b/app/online/cl_ol_0004.c new file mode 100644 index 0000000..43f84a7 --- /dev/null +++ b/app/online/cl_ol_0004.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/cl_ol_0004.pgc" +/* @tier easy @module cl @transform closing-online */ +/* + * cl_ol_0004.pgc - 마감 온라인 서비스 (CL_OL_0004) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cl_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/cl_ol_0004.pgc" + + +TX_SERVICE(CL_OL_0004, ctx) +{ + cl_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[CL_OL_0004] 마감 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CL_OL_0004] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = cl_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[CL_OL_0004] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[CL_OL_0004] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cl_ol_0004.pgc b/app/online/cl_ol_0004.pgc new file mode 100644 index 0000000..6e82273 --- /dev/null +++ b/app/online/cl_ol_0004.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module cl @transform closing-online */ +/* + * cl_ol_0004.pgc - 마감 온라인 서비스 (CL_OL_0004) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cl_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(CL_OL_0004, ctx) +{ + cl_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[CL_OL_0004] 마감 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CL_OL_0004] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = cl_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[CL_OL_0004] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[CL_OL_0004] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cl_ol_0005.c b/app/online/cl_ol_0005.c new file mode 100644 index 0000000..e9a1552 --- /dev/null +++ b/app/online/cl_ol_0005.c @@ -0,0 +1,148 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/cl_ol_0005.pgc" +/* @tier medium @module cl @transform closing-online */ +/* + * cl_ol_0005.pgc - 마감 온라인 서비스 (CL_OL_0005) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cl_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/cl_ol_0005.pgc" + + +TX_SERVICE(CL_OL_0005, ctx) +{ + cl_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[CL_OL_0005] 마감 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CL_OL_0005] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[CL_OL_0005] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[CL_OL_0005] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, CL_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = cl_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[CL_OL_0005] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = cl_rec_count(bizdate, CL_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[CL_OL_0005] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cl_ol_0005.pgc b/app/online/cl_ol_0005.pgc new file mode 100644 index 0000000..c21eec7 --- /dev/null +++ b/app/online/cl_ol_0005.pgc @@ -0,0 +1,70 @@ +/* @tier medium @module cl @transform closing-online */ +/* + * cl_ol_0005.pgc - 마감 온라인 서비스 (CL_OL_0005) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cl_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(CL_OL_0005, ctx) +{ + cl_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[CL_OL_0005] 마감 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CL_OL_0005] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[CL_OL_0005] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[CL_OL_0005] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, CL_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = cl_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[CL_OL_0005] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = cl_rec_count(bizdate, CL_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[CL_OL_0005] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cl_ol_0006.c b/app/online/cl_ol_0006.c new file mode 100644 index 0000000..c0c8628 --- /dev/null +++ b/app/online/cl_ol_0006.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/cl_ol_0006.pgc" +/* @tier easy @module cl @transform closing-online */ +/* + * cl_ol_0006.pgc - 마감 온라인 서비스 (CL_OL_0006) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cl_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/cl_ol_0006.pgc" + + +TX_SERVICE(CL_OL_0006, ctx) +{ + cl_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[CL_OL_0006] 마감 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CL_OL_0006] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = cl_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[CL_OL_0006] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[CL_OL_0006] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cl_ol_0006.pgc b/app/online/cl_ol_0006.pgc new file mode 100644 index 0000000..35c26b4 --- /dev/null +++ b/app/online/cl_ol_0006.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module cl @transform closing-online */ +/* + * cl_ol_0006.pgc - 마감 온라인 서비스 (CL_OL_0006) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cl_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(CL_OL_0006, ctx) +{ + cl_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[CL_OL_0006] 마감 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CL_OL_0006] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = cl_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[CL_OL_0006] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[CL_OL_0006] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cl_ol_0007.c b/app/online/cl_ol_0007.c new file mode 100644 index 0000000..feb4f5d --- /dev/null +++ b/app/online/cl_ol_0007.c @@ -0,0 +1,148 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/cl_ol_0007.pgc" +/* @tier medium @module cl @transform closing-online */ +/* + * cl_ol_0007.pgc - 마감 온라인 서비스 (CL_OL_0007) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cl_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/cl_ol_0007.pgc" + + +TX_SERVICE(CL_OL_0007, ctx) +{ + cl_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[CL_OL_0007] 마감 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CL_OL_0007] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[CL_OL_0007] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[CL_OL_0007] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, CL_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = cl_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[CL_OL_0007] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = cl_rec_count(bizdate, CL_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[CL_OL_0007] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cl_ol_0007.pgc b/app/online/cl_ol_0007.pgc new file mode 100644 index 0000000..80d21ed --- /dev/null +++ b/app/online/cl_ol_0007.pgc @@ -0,0 +1,70 @@ +/* @tier medium @module cl @transform closing-online */ +/* + * cl_ol_0007.pgc - 마감 온라인 서비스 (CL_OL_0007) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cl_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(CL_OL_0007, ctx) +{ + cl_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[CL_OL_0007] 마감 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CL_OL_0007] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[CL_OL_0007] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[CL_OL_0007] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, CL_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = cl_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[CL_OL_0007] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = cl_rec_count(bizdate, CL_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[CL_OL_0007] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cl_ol_0008.c b/app/online/cl_ol_0008.c new file mode 100644 index 0000000..fe611b1 --- /dev/null +++ b/app/online/cl_ol_0008.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/cl_ol_0008.pgc" +/* @tier easy @module cl @transform closing-online */ +/* + * cl_ol_0008.pgc - 마감 온라인 서비스 (CL_OL_0008) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cl_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/cl_ol_0008.pgc" + + +TX_SERVICE(CL_OL_0008, ctx) +{ + cl_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[CL_OL_0008] 마감 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CL_OL_0008] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = cl_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[CL_OL_0008] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[CL_OL_0008] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cl_ol_0008.pgc b/app/online/cl_ol_0008.pgc new file mode 100644 index 0000000..360ec1a --- /dev/null +++ b/app/online/cl_ol_0008.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module cl @transform closing-online */ +/* + * cl_ol_0008.pgc - 마감 온라인 서비스 (CL_OL_0008) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cl_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(CL_OL_0008, ctx) +{ + cl_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[CL_OL_0008] 마감 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CL_OL_0008] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = cl_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[CL_OL_0008] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[CL_OL_0008] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cl_ol_0009.c b/app/online/cl_ol_0009.c new file mode 100644 index 0000000..21a26b1 --- /dev/null +++ b/app/online/cl_ol_0009.c @@ -0,0 +1,176 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/cl_ol_0009.pgc" +/* @tier hard @module cl @transform closing-online */ +/* + * cl_ol_0009.pgc - 마감 온라인 서비스 (CL_OL_0009) [tier=hard] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cl_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/cl_ol_0009.pgc" + + +TX_SERVICE(CL_OL_0009, ctx) +{ + cl_rec_t rec; + char key[16], merch[16], bizdate[16], nextbiz[9]; + long amount = 0, daysum = 0; + int rc; + TXBUF *sub_in; + TXBUF *sub_out; + + tx_log(TX_LOG_INFO, "[CL_OL_0009] 마감 트랜잭션 오케스트레이션 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CL_OL_0009] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + if (!amount_is_valid(amount) || !date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[CL_OL_0009] 입력 검증 실패 amount=%ld date=%s", + amount, bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + /* 트랜잭션 시작 → 원장 반영 → 후속 서비스 연계 → 커밋 */ + if (tx_begin() != TX_OK) { + tx_return(ctx, TX_FAIL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, CL_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; + + rc = cl_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[CL_OL_0009] 원장반영 실패 rc=%d", rc); + tx_abort(); + tx_return(ctx, rc, ctx->out); + return; + } + + /* 정산 영업일 = 거래일의 다음 영업일 */ + if (date_next_business(bizdate, nextbiz) != 0) { + memcpy(nextbiz, bizdate, 8); + nextbiz[8] = '\0'; + } + + /* 후속 정산집계 서비스 연계 (레지스트리 문자열 디스패치) */ + sub_in = tx_buf_alloc(); + sub_out = tx_buf_alloc(); + if (sub_in && sub_out) { + tx_buf_sets(sub_in, "MERCHID", merch); + tx_buf_sets(sub_in, "BIZDATE", nextbiz); + tx_buf_setlong(sub_in, "AMOUNT", amount); + rc = tx_call("CL_POST", sub_in, sub_out); + if (rc != TX_OK) + tx_log(TX_LOG_WARN, "[CL_OL_0009] 후속연계 경고 rc=%d", rc); + } + tx_buf_free(sub_in); + tx_buf_free(sub_out); + + /* 교차 검증: 당일 합계 재계산 */ + if (cl_rec_sum(bizdate, &daysum) != TX_OK) + daysum = 0; + + tx_commit(); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYSUM", daysum); + tx_log(TX_LOG_INFO, "[CL_OL_0009] 완료 key=%s 당일합계=%ld", key, daysum); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cl_ol_0009.pgc b/app/online/cl_ol_0009.pgc new file mode 100644 index 0000000..0cb3511 --- /dev/null +++ b/app/online/cl_ol_0009.pgc @@ -0,0 +1,98 @@ +/* @tier hard @module cl @transform closing-online */ +/* + * cl_ol_0009.pgc - 마감 온라인 서비스 (CL_OL_0009) [tier=hard] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cl_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(CL_OL_0009, ctx) +{ + cl_rec_t rec; + char key[16], merch[16], bizdate[16], nextbiz[9]; + long amount = 0, daysum = 0; + int rc; + TXBUF *sub_in; + TXBUF *sub_out; + + tx_log(TX_LOG_INFO, "[CL_OL_0009] 마감 트랜잭션 오케스트레이션 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CL_OL_0009] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + if (!amount_is_valid(amount) || !date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[CL_OL_0009] 입력 검증 실패 amount=%ld date=%s", + amount, bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + /* 트랜잭션 시작 → 원장 반영 → 후속 서비스 연계 → 커밋 */ + if (tx_begin() != TX_OK) { + tx_return(ctx, TX_FAIL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, CL_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; + + rc = cl_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[CL_OL_0009] 원장반영 실패 rc=%d", rc); + tx_abort(); + tx_return(ctx, rc, ctx->out); + return; + } + + /* 정산 영업일 = 거래일의 다음 영업일 */ + if (date_next_business(bizdate, nextbiz) != 0) { + memcpy(nextbiz, bizdate, 8); + nextbiz[8] = '\0'; + } + + /* 후속 정산집계 서비스 연계 (레지스트리 문자열 디스패치) */ + sub_in = tx_buf_alloc(); + sub_out = tx_buf_alloc(); + if (sub_in && sub_out) { + tx_buf_sets(sub_in, "MERCHID", merch); + tx_buf_sets(sub_in, "BIZDATE", nextbiz); + tx_buf_setlong(sub_in, "AMOUNT", amount); + rc = tx_call("CL_POST", sub_in, sub_out); + if (rc != TX_OK) + tx_log(TX_LOG_WARN, "[CL_OL_0009] 후속연계 경고 rc=%d", rc); + } + tx_buf_free(sub_in); + tx_buf_free(sub_out); + + /* 교차 검증: 당일 합계 재계산 */ + if (cl_rec_sum(bizdate, &daysum) != TX_OK) + daysum = 0; + + tx_commit(); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYSUM", daysum); + tx_log(TX_LOG_INFO, "[CL_OL_0009] 완료 key=%s 당일합계=%ld", key, daysum); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cl_ol_0010.c b/app/online/cl_ol_0010.c new file mode 100644 index 0000000..4aca1eb --- /dev/null +++ b/app/online/cl_ol_0010.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/cl_ol_0010.pgc" +/* @tier easy @module cl @transform closing-online */ +/* + * cl_ol_0010.pgc - 마감 온라인 서비스 (CL_OL_0010) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cl_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/cl_ol_0010.pgc" + + +TX_SERVICE(CL_OL_0010, ctx) +{ + cl_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[CL_OL_0010] 마감 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CL_OL_0010] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = cl_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[CL_OL_0010] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[CL_OL_0010] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cl_ol_0010.pgc b/app/online/cl_ol_0010.pgc new file mode 100644 index 0000000..56b87fa --- /dev/null +++ b/app/online/cl_ol_0010.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module cl @transform closing-online */ +/* + * cl_ol_0010.pgc - 마감 온라인 서비스 (CL_OL_0010) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cl_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(CL_OL_0010, ctx) +{ + cl_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[CL_OL_0010] 마감 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CL_OL_0010] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = cl_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[CL_OL_0010] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[CL_OL_0010] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cl_ol_0011.c b/app/online/cl_ol_0011.c new file mode 100644 index 0000000..0b18f9b --- /dev/null +++ b/app/online/cl_ol_0011.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/cl_ol_0011.pgc" +/* @tier easy @module cl @transform closing-online */ +/* + * cl_ol_0011.pgc - 마감 온라인 서비스 (CL_OL_0011) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cl_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/cl_ol_0011.pgc" + + +TX_SERVICE(CL_OL_0011, ctx) +{ + cl_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[CL_OL_0011] 마감 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CL_OL_0011] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = cl_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[CL_OL_0011] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[CL_OL_0011] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cl_ol_0011.pgc b/app/online/cl_ol_0011.pgc new file mode 100644 index 0000000..28083f2 --- /dev/null +++ b/app/online/cl_ol_0011.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module cl @transform closing-online */ +/* + * cl_ol_0011.pgc - 마감 온라인 서비스 (CL_OL_0011) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cl_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(CL_OL_0011, ctx) +{ + cl_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[CL_OL_0011] 마감 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CL_OL_0011] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = cl_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[CL_OL_0011] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[CL_OL_0011] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cl_ol_0012.c b/app/online/cl_ol_0012.c new file mode 100644 index 0000000..de87b56 --- /dev/null +++ b/app/online/cl_ol_0012.c @@ -0,0 +1,148 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/cl_ol_0012.pgc" +/* @tier medium @module cl @transform closing-online */ +/* + * cl_ol_0012.pgc - 마감 온라인 서비스 (CL_OL_0012) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cl_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/cl_ol_0012.pgc" + + +TX_SERVICE(CL_OL_0012, ctx) +{ + cl_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[CL_OL_0012] 마감 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CL_OL_0012] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[CL_OL_0012] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[CL_OL_0012] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, CL_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = cl_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[CL_OL_0012] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = cl_rec_count(bizdate, CL_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[CL_OL_0012] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cl_ol_0012.pgc b/app/online/cl_ol_0012.pgc new file mode 100644 index 0000000..690fe2e --- /dev/null +++ b/app/online/cl_ol_0012.pgc @@ -0,0 +1,70 @@ +/* @tier medium @module cl @transform closing-online */ +/* + * cl_ol_0012.pgc - 마감 온라인 서비스 (CL_OL_0012) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cl_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(CL_OL_0012, ctx) +{ + cl_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[CL_OL_0012] 마감 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CL_OL_0012] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[CL_OL_0012] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[CL_OL_0012] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, CL_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = cl_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[CL_OL_0012] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = cl_rec_count(bizdate, CL_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[CL_OL_0012] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cl_ol_0013.c b/app/online/cl_ol_0013.c new file mode 100644 index 0000000..6a1153e --- /dev/null +++ b/app/online/cl_ol_0013.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/cl_ol_0013.pgc" +/* @tier easy @module cl @transform closing-online */ +/* + * cl_ol_0013.pgc - 마감 온라인 서비스 (CL_OL_0013) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cl_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/cl_ol_0013.pgc" + + +TX_SERVICE(CL_OL_0013, ctx) +{ + cl_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[CL_OL_0013] 마감 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CL_OL_0013] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = cl_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[CL_OL_0013] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[CL_OL_0013] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cl_ol_0013.pgc b/app/online/cl_ol_0013.pgc new file mode 100644 index 0000000..a8a4292 --- /dev/null +++ b/app/online/cl_ol_0013.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module cl @transform closing-online */ +/* + * cl_ol_0013.pgc - 마감 온라인 서비스 (CL_OL_0013) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cl_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(CL_OL_0013, ctx) +{ + cl_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[CL_OL_0013] 마감 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CL_OL_0013] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = cl_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[CL_OL_0013] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[CL_OL_0013] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cl_ol_0014.c b/app/online/cl_ol_0014.c new file mode 100644 index 0000000..a20f9fd --- /dev/null +++ b/app/online/cl_ol_0014.c @@ -0,0 +1,148 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/cl_ol_0014.pgc" +/* @tier medium @module cl @transform closing-online */ +/* + * cl_ol_0014.pgc - 마감 온라인 서비스 (CL_OL_0014) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cl_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/cl_ol_0014.pgc" + + +TX_SERVICE(CL_OL_0014, ctx) +{ + cl_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[CL_OL_0014] 마감 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CL_OL_0014] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[CL_OL_0014] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[CL_OL_0014] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, CL_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = cl_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[CL_OL_0014] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = cl_rec_count(bizdate, CL_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[CL_OL_0014] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cl_ol_0014.pgc b/app/online/cl_ol_0014.pgc new file mode 100644 index 0000000..f7d0b43 --- /dev/null +++ b/app/online/cl_ol_0014.pgc @@ -0,0 +1,70 @@ +/* @tier medium @module cl @transform closing-online */ +/* + * cl_ol_0014.pgc - 마감 온라인 서비스 (CL_OL_0014) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cl_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(CL_OL_0014, ctx) +{ + cl_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[CL_OL_0014] 마감 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CL_OL_0014] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[CL_OL_0014] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[CL_OL_0014] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, CL_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = cl_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[CL_OL_0014] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = cl_rec_count(bizdate, CL_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[CL_OL_0014] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cl_ol_0015.c b/app/online/cl_ol_0015.c new file mode 100644 index 0000000..b6d61f6 --- /dev/null +++ b/app/online/cl_ol_0015.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/cl_ol_0015.pgc" +/* @tier easy @module cl @transform closing-online */ +/* + * cl_ol_0015.pgc - 마감 온라인 서비스 (CL_OL_0015) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cl_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/cl_ol_0015.pgc" + + +TX_SERVICE(CL_OL_0015, ctx) +{ + cl_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[CL_OL_0015] 마감 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CL_OL_0015] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = cl_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[CL_OL_0015] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[CL_OL_0015] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cl_ol_0015.pgc b/app/online/cl_ol_0015.pgc new file mode 100644 index 0000000..e757fe0 --- /dev/null +++ b/app/online/cl_ol_0015.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module cl @transform closing-online */ +/* + * cl_ol_0015.pgc - 마감 온라인 서비스 (CL_OL_0015) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cl_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(CL_OL_0015, ctx) +{ + cl_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[CL_OL_0015] 마감 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CL_OL_0015] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = cl_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[CL_OL_0015] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[CL_OL_0015] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cl_ol_0016.c b/app/online/cl_ol_0016.c new file mode 100644 index 0000000..915f6d2 --- /dev/null +++ b/app/online/cl_ol_0016.c @@ -0,0 +1,148 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/cl_ol_0016.pgc" +/* @tier medium @module cl @transform closing-online */ +/* + * cl_ol_0016.pgc - 마감 온라인 서비스 (CL_OL_0016) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cl_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/cl_ol_0016.pgc" + + +TX_SERVICE(CL_OL_0016, ctx) +{ + cl_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[CL_OL_0016] 마감 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CL_OL_0016] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[CL_OL_0016] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[CL_OL_0016] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, CL_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = cl_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[CL_OL_0016] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = cl_rec_count(bizdate, CL_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[CL_OL_0016] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cl_ol_0016.pgc b/app/online/cl_ol_0016.pgc new file mode 100644 index 0000000..616ccc7 --- /dev/null +++ b/app/online/cl_ol_0016.pgc @@ -0,0 +1,70 @@ +/* @tier medium @module cl @transform closing-online */ +/* + * cl_ol_0016.pgc - 마감 온라인 서비스 (CL_OL_0016) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cl_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(CL_OL_0016, ctx) +{ + cl_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[CL_OL_0016] 마감 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CL_OL_0016] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[CL_OL_0016] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[CL_OL_0016] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, CL_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = cl_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[CL_OL_0016] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = cl_rec_count(bizdate, CL_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[CL_OL_0016] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cl_ol_0017.c b/app/online/cl_ol_0017.c new file mode 100644 index 0000000..6d8a9d8 --- /dev/null +++ b/app/online/cl_ol_0017.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/cl_ol_0017.pgc" +/* @tier easy @module cl @transform closing-online */ +/* + * cl_ol_0017.pgc - 마감 온라인 서비스 (CL_OL_0017) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cl_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/cl_ol_0017.pgc" + + +TX_SERVICE(CL_OL_0017, ctx) +{ + cl_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[CL_OL_0017] 마감 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CL_OL_0017] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = cl_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[CL_OL_0017] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[CL_OL_0017] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cl_ol_0017.pgc b/app/online/cl_ol_0017.pgc new file mode 100644 index 0000000..7e3d69e --- /dev/null +++ b/app/online/cl_ol_0017.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module cl @transform closing-online */ +/* + * cl_ol_0017.pgc - 마감 온라인 서비스 (CL_OL_0017) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cl_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(CL_OL_0017, ctx) +{ + cl_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[CL_OL_0017] 마감 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CL_OL_0017] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = cl_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[CL_OL_0017] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[CL_OL_0017] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cl_ol_0018.c b/app/online/cl_ol_0018.c new file mode 100644 index 0000000..1edb355 --- /dev/null +++ b/app/online/cl_ol_0018.c @@ -0,0 +1,176 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/cl_ol_0018.pgc" +/* @tier hard @module cl @transform closing-online */ +/* + * cl_ol_0018.pgc - 마감 온라인 서비스 (CL_OL_0018) [tier=hard] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cl_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/cl_ol_0018.pgc" + + +TX_SERVICE(CL_OL_0018, ctx) +{ + cl_rec_t rec; + char key[16], merch[16], bizdate[16], nextbiz[9]; + long amount = 0, daysum = 0; + int rc; + TXBUF *sub_in; + TXBUF *sub_out; + + tx_log(TX_LOG_INFO, "[CL_OL_0018] 마감 트랜잭션 오케스트레이션 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CL_OL_0018] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + if (!amount_is_valid(amount) || !date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[CL_OL_0018] 입력 검증 실패 amount=%ld date=%s", + amount, bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + /* 트랜잭션 시작 → 원장 반영 → 후속 서비스 연계 → 커밋 */ + if (tx_begin() != TX_OK) { + tx_return(ctx, TX_FAIL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, CL_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; + + rc = cl_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[CL_OL_0018] 원장반영 실패 rc=%d", rc); + tx_abort(); + tx_return(ctx, rc, ctx->out); + return; + } + + /* 정산 영업일 = 거래일의 다음 영업일 */ + if (date_next_business(bizdate, nextbiz) != 0) { + memcpy(nextbiz, bizdate, 8); + nextbiz[8] = '\0'; + } + + /* 후속 정산집계 서비스 연계 (레지스트리 문자열 디스패치) */ + sub_in = tx_buf_alloc(); + sub_out = tx_buf_alloc(); + if (sub_in && sub_out) { + tx_buf_sets(sub_in, "MERCHID", merch); + tx_buf_sets(sub_in, "BIZDATE", nextbiz); + tx_buf_setlong(sub_in, "AMOUNT", amount); + rc = tx_call("CL_POST", sub_in, sub_out); + if (rc != TX_OK) + tx_log(TX_LOG_WARN, "[CL_OL_0018] 후속연계 경고 rc=%d", rc); + } + tx_buf_free(sub_in); + tx_buf_free(sub_out); + + /* 교차 검증: 당일 합계 재계산 */ + if (cl_rec_sum(bizdate, &daysum) != TX_OK) + daysum = 0; + + tx_commit(); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYSUM", daysum); + tx_log(TX_LOG_INFO, "[CL_OL_0018] 완료 key=%s 당일합계=%ld", key, daysum); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cl_ol_0018.pgc b/app/online/cl_ol_0018.pgc new file mode 100644 index 0000000..bc3dee9 --- /dev/null +++ b/app/online/cl_ol_0018.pgc @@ -0,0 +1,98 @@ +/* @tier hard @module cl @transform closing-online */ +/* + * cl_ol_0018.pgc - 마감 온라인 서비스 (CL_OL_0018) [tier=hard] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cl_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(CL_OL_0018, ctx) +{ + cl_rec_t rec; + char key[16], merch[16], bizdate[16], nextbiz[9]; + long amount = 0, daysum = 0; + int rc; + TXBUF *sub_in; + TXBUF *sub_out; + + tx_log(TX_LOG_INFO, "[CL_OL_0018] 마감 트랜잭션 오케스트레이션 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CL_OL_0018] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + if (!amount_is_valid(amount) || !date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[CL_OL_0018] 입력 검증 실패 amount=%ld date=%s", + amount, bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + /* 트랜잭션 시작 → 원장 반영 → 후속 서비스 연계 → 커밋 */ + if (tx_begin() != TX_OK) { + tx_return(ctx, TX_FAIL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, CL_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; + + rc = cl_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[CL_OL_0018] 원장반영 실패 rc=%d", rc); + tx_abort(); + tx_return(ctx, rc, ctx->out); + return; + } + + /* 정산 영업일 = 거래일의 다음 영업일 */ + if (date_next_business(bizdate, nextbiz) != 0) { + memcpy(nextbiz, bizdate, 8); + nextbiz[8] = '\0'; + } + + /* 후속 정산집계 서비스 연계 (레지스트리 문자열 디스패치) */ + sub_in = tx_buf_alloc(); + sub_out = tx_buf_alloc(); + if (sub_in && sub_out) { + tx_buf_sets(sub_in, "MERCHID", merch); + tx_buf_sets(sub_in, "BIZDATE", nextbiz); + tx_buf_setlong(sub_in, "AMOUNT", amount); + rc = tx_call("CL_POST", sub_in, sub_out); + if (rc != TX_OK) + tx_log(TX_LOG_WARN, "[CL_OL_0018] 후속연계 경고 rc=%d", rc); + } + tx_buf_free(sub_in); + tx_buf_free(sub_out); + + /* 교차 검증: 당일 합계 재계산 */ + if (cl_rec_sum(bizdate, &daysum) != TX_OK) + daysum = 0; + + tx_commit(); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYSUM", daysum); + tx_log(TX_LOG_INFO, "[CL_OL_0018] 완료 key=%s 당일합계=%ld", key, daysum); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cl_ol_0019.c b/app/online/cl_ol_0019.c new file mode 100644 index 0000000..d5fccbc --- /dev/null +++ b/app/online/cl_ol_0019.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/cl_ol_0019.pgc" +/* @tier easy @module cl @transform closing-online */ +/* + * cl_ol_0019.pgc - 마감 온라인 서비스 (CL_OL_0019) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cl_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/cl_ol_0019.pgc" + + +TX_SERVICE(CL_OL_0019, ctx) +{ + cl_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[CL_OL_0019] 마감 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CL_OL_0019] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = cl_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[CL_OL_0019] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[CL_OL_0019] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cl_ol_0019.pgc b/app/online/cl_ol_0019.pgc new file mode 100644 index 0000000..3ce30e3 --- /dev/null +++ b/app/online/cl_ol_0019.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module cl @transform closing-online */ +/* + * cl_ol_0019.pgc - 마감 온라인 서비스 (CL_OL_0019) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cl_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(CL_OL_0019, ctx) +{ + cl_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[CL_OL_0019] 마감 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CL_OL_0019] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = cl_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[CL_OL_0019] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[CL_OL_0019] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cl_ol_0020.c b/app/online/cl_ol_0020.c new file mode 100644 index 0000000..f8bafea --- /dev/null +++ b/app/online/cl_ol_0020.c @@ -0,0 +1,176 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/cl_ol_0020.pgc" +/* @tier hard @module cl @transform closing-online */ +/* + * cl_ol_0020.pgc - 마감 온라인 서비스 (CL_OL_0020) [tier=hard] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cl_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/cl_ol_0020.pgc" + + +TX_SERVICE(CL_OL_0020, ctx) +{ + cl_rec_t rec; + char key[16], merch[16], bizdate[16], nextbiz[9]; + long amount = 0, daysum = 0; + int rc; + TXBUF *sub_in; + TXBUF *sub_out; + + tx_log(TX_LOG_INFO, "[CL_OL_0020] 마감 트랜잭션 오케스트레이션 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CL_OL_0020] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + if (!amount_is_valid(amount) || !date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[CL_OL_0020] 입력 검증 실패 amount=%ld date=%s", + amount, bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + /* 트랜잭션 시작 → 원장 반영 → 후속 서비스 연계 → 커밋 */ + if (tx_begin() != TX_OK) { + tx_return(ctx, TX_FAIL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, CL_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; + + rc = cl_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[CL_OL_0020] 원장반영 실패 rc=%d", rc); + tx_abort(); + tx_return(ctx, rc, ctx->out); + return; + } + + /* 정산 영업일 = 거래일의 다음 영업일 */ + if (date_next_business(bizdate, nextbiz) != 0) { + memcpy(nextbiz, bizdate, 8); + nextbiz[8] = '\0'; + } + + /* 후속 정산집계 서비스 연계 (레지스트리 문자열 디스패치) */ + sub_in = tx_buf_alloc(); + sub_out = tx_buf_alloc(); + if (sub_in && sub_out) { + tx_buf_sets(sub_in, "MERCHID", merch); + tx_buf_sets(sub_in, "BIZDATE", nextbiz); + tx_buf_setlong(sub_in, "AMOUNT", amount); + rc = tx_call("CL_POST", sub_in, sub_out); + if (rc != TX_OK) + tx_log(TX_LOG_WARN, "[CL_OL_0020] 후속연계 경고 rc=%d", rc); + } + tx_buf_free(sub_in); + tx_buf_free(sub_out); + + /* 교차 검증: 당일 합계 재계산 */ + if (cl_rec_sum(bizdate, &daysum) != TX_OK) + daysum = 0; + + tx_commit(); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYSUM", daysum); + tx_log(TX_LOG_INFO, "[CL_OL_0020] 완료 key=%s 당일합계=%ld", key, daysum); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cl_ol_0020.pgc b/app/online/cl_ol_0020.pgc new file mode 100644 index 0000000..deb08c0 --- /dev/null +++ b/app/online/cl_ol_0020.pgc @@ -0,0 +1,98 @@ +/* @tier hard @module cl @transform closing-online */ +/* + * cl_ol_0020.pgc - 마감 온라인 서비스 (CL_OL_0020) [tier=hard] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cl_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(CL_OL_0020, ctx) +{ + cl_rec_t rec; + char key[16], merch[16], bizdate[16], nextbiz[9]; + long amount = 0, daysum = 0; + int rc; + TXBUF *sub_in; + TXBUF *sub_out; + + tx_log(TX_LOG_INFO, "[CL_OL_0020] 마감 트랜잭션 오케스트레이션 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CL_OL_0020] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + if (!amount_is_valid(amount) || !date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[CL_OL_0020] 입력 검증 실패 amount=%ld date=%s", + amount, bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + /* 트랜잭션 시작 → 원장 반영 → 후속 서비스 연계 → 커밋 */ + if (tx_begin() != TX_OK) { + tx_return(ctx, TX_FAIL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, CL_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; + + rc = cl_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[CL_OL_0020] 원장반영 실패 rc=%d", rc); + tx_abort(); + tx_return(ctx, rc, ctx->out); + return; + } + + /* 정산 영업일 = 거래일의 다음 영업일 */ + if (date_next_business(bizdate, nextbiz) != 0) { + memcpy(nextbiz, bizdate, 8); + nextbiz[8] = '\0'; + } + + /* 후속 정산집계 서비스 연계 (레지스트리 문자열 디스패치) */ + sub_in = tx_buf_alloc(); + sub_out = tx_buf_alloc(); + if (sub_in && sub_out) { + tx_buf_sets(sub_in, "MERCHID", merch); + tx_buf_sets(sub_in, "BIZDATE", nextbiz); + tx_buf_setlong(sub_in, "AMOUNT", amount); + rc = tx_call("CL_POST", sub_in, sub_out); + if (rc != TX_OK) + tx_log(TX_LOG_WARN, "[CL_OL_0020] 후속연계 경고 rc=%d", rc); + } + tx_buf_free(sub_in); + tx_buf_free(sub_out); + + /* 교차 검증: 당일 합계 재계산 */ + if (cl_rec_sum(bizdate, &daysum) != TX_OK) + daysum = 0; + + tx_commit(); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYSUM", daysum); + tx_log(TX_LOG_INFO, "[CL_OL_0020] 완료 key=%s 당일합계=%ld", key, daysum); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cl_ol_0021.c b/app/online/cl_ol_0021.c new file mode 100644 index 0000000..ab83683 --- /dev/null +++ b/app/online/cl_ol_0021.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/cl_ol_0021.pgc" +/* @tier easy @module cl @transform closing-online */ +/* + * cl_ol_0021.pgc - 마감 온라인 서비스 (CL_OL_0021) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cl_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/cl_ol_0021.pgc" + + +TX_SERVICE(CL_OL_0021, ctx) +{ + cl_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[CL_OL_0021] 마감 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CL_OL_0021] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = cl_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[CL_OL_0021] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[CL_OL_0021] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cl_ol_0021.pgc b/app/online/cl_ol_0021.pgc new file mode 100644 index 0000000..985fb5b --- /dev/null +++ b/app/online/cl_ol_0021.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module cl @transform closing-online */ +/* + * cl_ol_0021.pgc - 마감 온라인 서비스 (CL_OL_0021) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cl_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(CL_OL_0021, ctx) +{ + cl_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[CL_OL_0021] 마감 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CL_OL_0021] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = cl_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[CL_OL_0021] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[CL_OL_0021] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cl_ol_0022.c b/app/online/cl_ol_0022.c new file mode 100644 index 0000000..707a681 --- /dev/null +++ b/app/online/cl_ol_0022.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/cl_ol_0022.pgc" +/* @tier easy @module cl @transform closing-online */ +/* + * cl_ol_0022.pgc - 마감 온라인 서비스 (CL_OL_0022) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cl_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/cl_ol_0022.pgc" + + +TX_SERVICE(CL_OL_0022, ctx) +{ + cl_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[CL_OL_0022] 마감 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CL_OL_0022] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = cl_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[CL_OL_0022] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[CL_OL_0022] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cl_ol_0022.pgc b/app/online/cl_ol_0022.pgc new file mode 100644 index 0000000..00f290c --- /dev/null +++ b/app/online/cl_ol_0022.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module cl @transform closing-online */ +/* + * cl_ol_0022.pgc - 마감 온라인 서비스 (CL_OL_0022) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cl_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(CL_OL_0022, ctx) +{ + cl_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[CL_OL_0022] 마감 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CL_OL_0022] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = cl_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[CL_OL_0022] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[CL_OL_0022] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cl_ol_0023.c b/app/online/cl_ol_0023.c new file mode 100644 index 0000000..2224842 --- /dev/null +++ b/app/online/cl_ol_0023.c @@ -0,0 +1,148 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/cl_ol_0023.pgc" +/* @tier medium @module cl @transform closing-online */ +/* + * cl_ol_0023.pgc - 마감 온라인 서비스 (CL_OL_0023) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cl_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/cl_ol_0023.pgc" + + +TX_SERVICE(CL_OL_0023, ctx) +{ + cl_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[CL_OL_0023] 마감 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CL_OL_0023] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[CL_OL_0023] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[CL_OL_0023] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, CL_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = cl_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[CL_OL_0023] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = cl_rec_count(bizdate, CL_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[CL_OL_0023] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cl_ol_0023.pgc b/app/online/cl_ol_0023.pgc new file mode 100644 index 0000000..4a395cf --- /dev/null +++ b/app/online/cl_ol_0023.pgc @@ -0,0 +1,70 @@ +/* @tier medium @module cl @transform closing-online */ +/* + * cl_ol_0023.pgc - 마감 온라인 서비스 (CL_OL_0023) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cl_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(CL_OL_0023, ctx) +{ + cl_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[CL_OL_0023] 마감 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CL_OL_0023] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[CL_OL_0023] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[CL_OL_0023] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, CL_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = cl_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[CL_OL_0023] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = cl_rec_count(bizdate, CL_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[CL_OL_0023] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cl_ol_0024.c b/app/online/cl_ol_0024.c new file mode 100644 index 0000000..6d5182c --- /dev/null +++ b/app/online/cl_ol_0024.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/cl_ol_0024.pgc" +/* @tier easy @module cl @transform closing-online */ +/* + * cl_ol_0024.pgc - 마감 온라인 서비스 (CL_OL_0024) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cl_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/cl_ol_0024.pgc" + + +TX_SERVICE(CL_OL_0024, ctx) +{ + cl_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[CL_OL_0024] 마감 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CL_OL_0024] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = cl_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[CL_OL_0024] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[CL_OL_0024] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cl_ol_0024.pgc b/app/online/cl_ol_0024.pgc new file mode 100644 index 0000000..1c5276d --- /dev/null +++ b/app/online/cl_ol_0024.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module cl @transform closing-online */ +/* + * cl_ol_0024.pgc - 마감 온라인 서비스 (CL_OL_0024) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cl_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(CL_OL_0024, ctx) +{ + cl_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[CL_OL_0024] 마감 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CL_OL_0024] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = cl_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[CL_OL_0024] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[CL_OL_0024] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cl_ol_0025.c b/app/online/cl_ol_0025.c new file mode 100644 index 0000000..29b3081 --- /dev/null +++ b/app/online/cl_ol_0025.c @@ -0,0 +1,148 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/cl_ol_0025.pgc" +/* @tier medium @module cl @transform closing-online */ +/* + * cl_ol_0025.pgc - 마감 온라인 서비스 (CL_OL_0025) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cl_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/cl_ol_0025.pgc" + + +TX_SERVICE(CL_OL_0025, ctx) +{ + cl_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[CL_OL_0025] 마감 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CL_OL_0025] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[CL_OL_0025] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[CL_OL_0025] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, CL_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = cl_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[CL_OL_0025] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = cl_rec_count(bizdate, CL_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[CL_OL_0025] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cl_ol_0025.pgc b/app/online/cl_ol_0025.pgc new file mode 100644 index 0000000..892b31b --- /dev/null +++ b/app/online/cl_ol_0025.pgc @@ -0,0 +1,70 @@ +/* @tier medium @module cl @transform closing-online */ +/* + * cl_ol_0025.pgc - 마감 온라인 서비스 (CL_OL_0025) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cl_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(CL_OL_0025, ctx) +{ + cl_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[CL_OL_0025] 마감 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CL_OL_0025] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[CL_OL_0025] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[CL_OL_0025] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, CL_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = cl_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[CL_OL_0025] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = cl_rec_count(bizdate, CL_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[CL_OL_0025] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cl_ol_0026.c b/app/online/cl_ol_0026.c new file mode 100644 index 0000000..6a4a202 --- /dev/null +++ b/app/online/cl_ol_0026.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/cl_ol_0026.pgc" +/* @tier easy @module cl @transform closing-online */ +/* + * cl_ol_0026.pgc - 마감 온라인 서비스 (CL_OL_0026) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cl_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/cl_ol_0026.pgc" + + +TX_SERVICE(CL_OL_0026, ctx) +{ + cl_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[CL_OL_0026] 마감 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CL_OL_0026] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = cl_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[CL_OL_0026] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[CL_OL_0026] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cl_ol_0026.pgc b/app/online/cl_ol_0026.pgc new file mode 100644 index 0000000..6c2c88c --- /dev/null +++ b/app/online/cl_ol_0026.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module cl @transform closing-online */ +/* + * cl_ol_0026.pgc - 마감 온라인 서비스 (CL_OL_0026) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cl_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(CL_OL_0026, ctx) +{ + cl_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[CL_OL_0026] 마감 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CL_OL_0026] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = cl_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[CL_OL_0026] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[CL_OL_0026] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cl_ol_0027.c b/app/online/cl_ol_0027.c new file mode 100644 index 0000000..9955f17 --- /dev/null +++ b/app/online/cl_ol_0027.c @@ -0,0 +1,148 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/cl_ol_0027.pgc" +/* @tier medium @module cl @transform closing-online */ +/* + * cl_ol_0027.pgc - 마감 온라인 서비스 (CL_OL_0027) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cl_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/cl_ol_0027.pgc" + + +TX_SERVICE(CL_OL_0027, ctx) +{ + cl_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[CL_OL_0027] 마감 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CL_OL_0027] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[CL_OL_0027] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[CL_OL_0027] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, CL_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = cl_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[CL_OL_0027] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = cl_rec_count(bizdate, CL_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[CL_OL_0027] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cl_ol_0027.pgc b/app/online/cl_ol_0027.pgc new file mode 100644 index 0000000..5d233db --- /dev/null +++ b/app/online/cl_ol_0027.pgc @@ -0,0 +1,70 @@ +/* @tier medium @module cl @transform closing-online */ +/* + * cl_ol_0027.pgc - 마감 온라인 서비스 (CL_OL_0027) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cl_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(CL_OL_0027, ctx) +{ + cl_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[CL_OL_0027] 마감 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CL_OL_0027] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[CL_OL_0027] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[CL_OL_0027] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, CL_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = cl_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[CL_OL_0027] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = cl_rec_count(bizdate, CL_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[CL_OL_0027] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cl_ol_0028.c b/app/online/cl_ol_0028.c new file mode 100644 index 0000000..6ee1176 --- /dev/null +++ b/app/online/cl_ol_0028.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/cl_ol_0028.pgc" +/* @tier easy @module cl @transform closing-online */ +/* + * cl_ol_0028.pgc - 마감 온라인 서비스 (CL_OL_0028) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cl_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/cl_ol_0028.pgc" + + +TX_SERVICE(CL_OL_0028, ctx) +{ + cl_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[CL_OL_0028] 마감 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CL_OL_0028] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = cl_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[CL_OL_0028] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[CL_OL_0028] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cl_ol_0028.pgc b/app/online/cl_ol_0028.pgc new file mode 100644 index 0000000..51faa0a --- /dev/null +++ b/app/online/cl_ol_0028.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module cl @transform closing-online */ +/* + * cl_ol_0028.pgc - 마감 온라인 서비스 (CL_OL_0028) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cl_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(CL_OL_0028, ctx) +{ + cl_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[CL_OL_0028] 마감 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CL_OL_0028] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = cl_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[CL_OL_0028] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[CL_OL_0028] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cl_ol_0029.c b/app/online/cl_ol_0029.c new file mode 100644 index 0000000..5f54902 --- /dev/null +++ b/app/online/cl_ol_0029.c @@ -0,0 +1,176 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/cl_ol_0029.pgc" +/* @tier hard @module cl @transform closing-online */ +/* + * cl_ol_0029.pgc - 마감 온라인 서비스 (CL_OL_0029) [tier=hard] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cl_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/cl_ol_0029.pgc" + + +TX_SERVICE(CL_OL_0029, ctx) +{ + cl_rec_t rec; + char key[16], merch[16], bizdate[16], nextbiz[9]; + long amount = 0, daysum = 0; + int rc; + TXBUF *sub_in; + TXBUF *sub_out; + + tx_log(TX_LOG_INFO, "[CL_OL_0029] 마감 트랜잭션 오케스트레이션 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CL_OL_0029] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + if (!amount_is_valid(amount) || !date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[CL_OL_0029] 입력 검증 실패 amount=%ld date=%s", + amount, bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + /* 트랜잭션 시작 → 원장 반영 → 후속 서비스 연계 → 커밋 */ + if (tx_begin() != TX_OK) { + tx_return(ctx, TX_FAIL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, CL_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; + + rc = cl_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[CL_OL_0029] 원장반영 실패 rc=%d", rc); + tx_abort(); + tx_return(ctx, rc, ctx->out); + return; + } + + /* 정산 영업일 = 거래일의 다음 영업일 */ + if (date_next_business(bizdate, nextbiz) != 0) { + memcpy(nextbiz, bizdate, 8); + nextbiz[8] = '\0'; + } + + /* 후속 정산집계 서비스 연계 (레지스트리 문자열 디스패치) */ + sub_in = tx_buf_alloc(); + sub_out = tx_buf_alloc(); + if (sub_in && sub_out) { + tx_buf_sets(sub_in, "MERCHID", merch); + tx_buf_sets(sub_in, "BIZDATE", nextbiz); + tx_buf_setlong(sub_in, "AMOUNT", amount); + rc = tx_call("CL_POST", sub_in, sub_out); + if (rc != TX_OK) + tx_log(TX_LOG_WARN, "[CL_OL_0029] 후속연계 경고 rc=%d", rc); + } + tx_buf_free(sub_in); + tx_buf_free(sub_out); + + /* 교차 검증: 당일 합계 재계산 */ + if (cl_rec_sum(bizdate, &daysum) != TX_OK) + daysum = 0; + + tx_commit(); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYSUM", daysum); + tx_log(TX_LOG_INFO, "[CL_OL_0029] 완료 key=%s 당일합계=%ld", key, daysum); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cl_ol_0029.pgc b/app/online/cl_ol_0029.pgc new file mode 100644 index 0000000..c319953 --- /dev/null +++ b/app/online/cl_ol_0029.pgc @@ -0,0 +1,98 @@ +/* @tier hard @module cl @transform closing-online */ +/* + * cl_ol_0029.pgc - 마감 온라인 서비스 (CL_OL_0029) [tier=hard] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cl_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(CL_OL_0029, ctx) +{ + cl_rec_t rec; + char key[16], merch[16], bizdate[16], nextbiz[9]; + long amount = 0, daysum = 0; + int rc; + TXBUF *sub_in; + TXBUF *sub_out; + + tx_log(TX_LOG_INFO, "[CL_OL_0029] 마감 트랜잭션 오케스트레이션 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CL_OL_0029] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + if (!amount_is_valid(amount) || !date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[CL_OL_0029] 입력 검증 실패 amount=%ld date=%s", + amount, bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + /* 트랜잭션 시작 → 원장 반영 → 후속 서비스 연계 → 커밋 */ + if (tx_begin() != TX_OK) { + tx_return(ctx, TX_FAIL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, CL_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; + + rc = cl_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[CL_OL_0029] 원장반영 실패 rc=%d", rc); + tx_abort(); + tx_return(ctx, rc, ctx->out); + return; + } + + /* 정산 영업일 = 거래일의 다음 영업일 */ + if (date_next_business(bizdate, nextbiz) != 0) { + memcpy(nextbiz, bizdate, 8); + nextbiz[8] = '\0'; + } + + /* 후속 정산집계 서비스 연계 (레지스트리 문자열 디스패치) */ + sub_in = tx_buf_alloc(); + sub_out = tx_buf_alloc(); + if (sub_in && sub_out) { + tx_buf_sets(sub_in, "MERCHID", merch); + tx_buf_sets(sub_in, "BIZDATE", nextbiz); + tx_buf_setlong(sub_in, "AMOUNT", amount); + rc = tx_call("CL_POST", sub_in, sub_out); + if (rc != TX_OK) + tx_log(TX_LOG_WARN, "[CL_OL_0029] 후속연계 경고 rc=%d", rc); + } + tx_buf_free(sub_in); + tx_buf_free(sub_out); + + /* 교차 검증: 당일 합계 재계산 */ + if (cl_rec_sum(bizdate, &daysum) != TX_OK) + daysum = 0; + + tx_commit(); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYSUM", daysum); + tx_log(TX_LOG_INFO, "[CL_OL_0029] 완료 key=%s 당일합계=%ld", key, daysum); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cl_ol_0030.c b/app/online/cl_ol_0030.c new file mode 100644 index 0000000..8d87135 --- /dev/null +++ b/app/online/cl_ol_0030.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/cl_ol_0030.pgc" +/* @tier easy @module cl @transform closing-online */ +/* + * cl_ol_0030.pgc - 마감 온라인 서비스 (CL_OL_0030) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cl_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/cl_ol_0030.pgc" + + +TX_SERVICE(CL_OL_0030, ctx) +{ + cl_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[CL_OL_0030] 마감 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CL_OL_0030] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = cl_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[CL_OL_0030] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[CL_OL_0030] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cl_ol_0030.pgc b/app/online/cl_ol_0030.pgc new file mode 100644 index 0000000..9a8f915 --- /dev/null +++ b/app/online/cl_ol_0030.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module cl @transform closing-online */ +/* + * cl_ol_0030.pgc - 마감 온라인 서비스 (CL_OL_0030) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cl_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(CL_OL_0030, ctx) +{ + cl_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[CL_OL_0030] 마감 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CL_OL_0030] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = cl_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[CL_OL_0030] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[CL_OL_0030] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cl_ol_0031.c b/app/online/cl_ol_0031.c new file mode 100644 index 0000000..8752a19 --- /dev/null +++ b/app/online/cl_ol_0031.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/cl_ol_0031.pgc" +/* @tier easy @module cl @transform closing-online */ +/* + * cl_ol_0031.pgc - 마감 온라인 서비스 (CL_OL_0031) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cl_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/cl_ol_0031.pgc" + + +TX_SERVICE(CL_OL_0031, ctx) +{ + cl_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[CL_OL_0031] 마감 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CL_OL_0031] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = cl_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[CL_OL_0031] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[CL_OL_0031] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cl_ol_0031.pgc b/app/online/cl_ol_0031.pgc new file mode 100644 index 0000000..20e8267 --- /dev/null +++ b/app/online/cl_ol_0031.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module cl @transform closing-online */ +/* + * cl_ol_0031.pgc - 마감 온라인 서비스 (CL_OL_0031) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cl_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(CL_OL_0031, ctx) +{ + cl_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[CL_OL_0031] 마감 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CL_OL_0031] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = cl_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[CL_OL_0031] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[CL_OL_0031] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cm_ol_0001.c b/app/online/cm_ol_0001.c new file mode 100644 index 0000000..6b3212a --- /dev/null +++ b/app/online/cm_ol_0001.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/cm_ol_0001.pgc" +/* @tier easy @module cm @transform common-online */ +/* + * cm_ol_0001.pgc - 공통 온라인 서비스 (CM_OL_0001) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cm_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/cm_ol_0001.pgc" + + +TX_SERVICE(CM_OL_0001, ctx) +{ + cm_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[CM_OL_0001] 공통 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CM_OL_0001] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = cm_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[CM_OL_0001] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[CM_OL_0001] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cm_ol_0001.pgc b/app/online/cm_ol_0001.pgc new file mode 100644 index 0000000..6ff40dd --- /dev/null +++ b/app/online/cm_ol_0001.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module cm @transform common-online */ +/* + * cm_ol_0001.pgc - 공통 온라인 서비스 (CM_OL_0001) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cm_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(CM_OL_0001, ctx) +{ + cm_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[CM_OL_0001] 공통 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CM_OL_0001] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = cm_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[CM_OL_0001] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[CM_OL_0001] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cm_ol_0002.c b/app/online/cm_ol_0002.c new file mode 100644 index 0000000..d587e2e --- /dev/null +++ b/app/online/cm_ol_0002.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/cm_ol_0002.pgc" +/* @tier easy @module cm @transform common-online */ +/* + * cm_ol_0002.pgc - 공통 온라인 서비스 (CM_OL_0002) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cm_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/cm_ol_0002.pgc" + + +TX_SERVICE(CM_OL_0002, ctx) +{ + cm_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[CM_OL_0002] 공통 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CM_OL_0002] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = cm_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[CM_OL_0002] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[CM_OL_0002] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cm_ol_0002.pgc b/app/online/cm_ol_0002.pgc new file mode 100644 index 0000000..2469399 --- /dev/null +++ b/app/online/cm_ol_0002.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module cm @transform common-online */ +/* + * cm_ol_0002.pgc - 공통 온라인 서비스 (CM_OL_0002) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cm_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(CM_OL_0002, ctx) +{ + cm_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[CM_OL_0002] 공통 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CM_OL_0002] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = cm_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[CM_OL_0002] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[CM_OL_0002] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cm_ol_0003.c b/app/online/cm_ol_0003.c new file mode 100644 index 0000000..cdfb6bf --- /dev/null +++ b/app/online/cm_ol_0003.c @@ -0,0 +1,148 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/cm_ol_0003.pgc" +/* @tier medium @module cm @transform common-online */ +/* + * cm_ol_0003.pgc - 공통 온라인 서비스 (CM_OL_0003) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cm_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/cm_ol_0003.pgc" + + +TX_SERVICE(CM_OL_0003, ctx) +{ + cm_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[CM_OL_0003] 공통 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CM_OL_0003] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[CM_OL_0003] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[CM_OL_0003] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, CM_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = cm_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[CM_OL_0003] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = cm_rec_count(bizdate, CM_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[CM_OL_0003] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cm_ol_0003.pgc b/app/online/cm_ol_0003.pgc new file mode 100644 index 0000000..b50b4ed --- /dev/null +++ b/app/online/cm_ol_0003.pgc @@ -0,0 +1,70 @@ +/* @tier medium @module cm @transform common-online */ +/* + * cm_ol_0003.pgc - 공통 온라인 서비스 (CM_OL_0003) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cm_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(CM_OL_0003, ctx) +{ + cm_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[CM_OL_0003] 공통 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CM_OL_0003] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[CM_OL_0003] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[CM_OL_0003] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, CM_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = cm_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[CM_OL_0003] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = cm_rec_count(bizdate, CM_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[CM_OL_0003] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cm_ol_0004.c b/app/online/cm_ol_0004.c new file mode 100644 index 0000000..a1f9933 --- /dev/null +++ b/app/online/cm_ol_0004.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/cm_ol_0004.pgc" +/* @tier easy @module cm @transform common-online */ +/* + * cm_ol_0004.pgc - 공통 온라인 서비스 (CM_OL_0004) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cm_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/cm_ol_0004.pgc" + + +TX_SERVICE(CM_OL_0004, ctx) +{ + cm_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[CM_OL_0004] 공통 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CM_OL_0004] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = cm_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[CM_OL_0004] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[CM_OL_0004] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cm_ol_0004.pgc b/app/online/cm_ol_0004.pgc new file mode 100644 index 0000000..b664626 --- /dev/null +++ b/app/online/cm_ol_0004.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module cm @transform common-online */ +/* + * cm_ol_0004.pgc - 공통 온라인 서비스 (CM_OL_0004) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cm_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(CM_OL_0004, ctx) +{ + cm_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[CM_OL_0004] 공통 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CM_OL_0004] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = cm_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[CM_OL_0004] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[CM_OL_0004] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cm_ol_0005.c b/app/online/cm_ol_0005.c new file mode 100644 index 0000000..7de9dbe --- /dev/null +++ b/app/online/cm_ol_0005.c @@ -0,0 +1,148 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/cm_ol_0005.pgc" +/* @tier medium @module cm @transform common-online */ +/* + * cm_ol_0005.pgc - 공통 온라인 서비스 (CM_OL_0005) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cm_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/cm_ol_0005.pgc" + + +TX_SERVICE(CM_OL_0005, ctx) +{ + cm_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[CM_OL_0005] 공통 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CM_OL_0005] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[CM_OL_0005] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[CM_OL_0005] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, CM_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = cm_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[CM_OL_0005] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = cm_rec_count(bizdate, CM_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[CM_OL_0005] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cm_ol_0005.pgc b/app/online/cm_ol_0005.pgc new file mode 100644 index 0000000..4d05d0b --- /dev/null +++ b/app/online/cm_ol_0005.pgc @@ -0,0 +1,70 @@ +/* @tier medium @module cm @transform common-online */ +/* + * cm_ol_0005.pgc - 공통 온라인 서비스 (CM_OL_0005) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cm_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(CM_OL_0005, ctx) +{ + cm_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[CM_OL_0005] 공통 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CM_OL_0005] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[CM_OL_0005] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[CM_OL_0005] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, CM_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = cm_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[CM_OL_0005] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = cm_rec_count(bizdate, CM_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[CM_OL_0005] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cm_ol_0006.c b/app/online/cm_ol_0006.c new file mode 100644 index 0000000..d64535c --- /dev/null +++ b/app/online/cm_ol_0006.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/cm_ol_0006.pgc" +/* @tier easy @module cm @transform common-online */ +/* + * cm_ol_0006.pgc - 공통 온라인 서비스 (CM_OL_0006) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cm_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/cm_ol_0006.pgc" + + +TX_SERVICE(CM_OL_0006, ctx) +{ + cm_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[CM_OL_0006] 공통 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CM_OL_0006] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = cm_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[CM_OL_0006] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[CM_OL_0006] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cm_ol_0006.pgc b/app/online/cm_ol_0006.pgc new file mode 100644 index 0000000..c2a0fc6 --- /dev/null +++ b/app/online/cm_ol_0006.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module cm @transform common-online */ +/* + * cm_ol_0006.pgc - 공통 온라인 서비스 (CM_OL_0006) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cm_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(CM_OL_0006, ctx) +{ + cm_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[CM_OL_0006] 공통 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CM_OL_0006] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = cm_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[CM_OL_0006] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[CM_OL_0006] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cm_ol_0007.c b/app/online/cm_ol_0007.c new file mode 100644 index 0000000..a9d7271 --- /dev/null +++ b/app/online/cm_ol_0007.c @@ -0,0 +1,148 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/cm_ol_0007.pgc" +/* @tier medium @module cm @transform common-online */ +/* + * cm_ol_0007.pgc - 공통 온라인 서비스 (CM_OL_0007) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cm_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/cm_ol_0007.pgc" + + +TX_SERVICE(CM_OL_0007, ctx) +{ + cm_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[CM_OL_0007] 공통 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CM_OL_0007] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[CM_OL_0007] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[CM_OL_0007] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, CM_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = cm_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[CM_OL_0007] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = cm_rec_count(bizdate, CM_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[CM_OL_0007] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cm_ol_0007.pgc b/app/online/cm_ol_0007.pgc new file mode 100644 index 0000000..c9f1942 --- /dev/null +++ b/app/online/cm_ol_0007.pgc @@ -0,0 +1,70 @@ +/* @tier medium @module cm @transform common-online */ +/* + * cm_ol_0007.pgc - 공통 온라인 서비스 (CM_OL_0007) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cm_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(CM_OL_0007, ctx) +{ + cm_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[CM_OL_0007] 공통 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CM_OL_0007] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[CM_OL_0007] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[CM_OL_0007] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, CM_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = cm_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[CM_OL_0007] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = cm_rec_count(bizdate, CM_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[CM_OL_0007] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cm_ol_0008.c b/app/online/cm_ol_0008.c new file mode 100644 index 0000000..52d56f3 --- /dev/null +++ b/app/online/cm_ol_0008.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/cm_ol_0008.pgc" +/* @tier easy @module cm @transform common-online */ +/* + * cm_ol_0008.pgc - 공통 온라인 서비스 (CM_OL_0008) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cm_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/cm_ol_0008.pgc" + + +TX_SERVICE(CM_OL_0008, ctx) +{ + cm_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[CM_OL_0008] 공통 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CM_OL_0008] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = cm_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[CM_OL_0008] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[CM_OL_0008] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cm_ol_0008.pgc b/app/online/cm_ol_0008.pgc new file mode 100644 index 0000000..772fce3 --- /dev/null +++ b/app/online/cm_ol_0008.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module cm @transform common-online */ +/* + * cm_ol_0008.pgc - 공통 온라인 서비스 (CM_OL_0008) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cm_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(CM_OL_0008, ctx) +{ + cm_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[CM_OL_0008] 공통 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CM_OL_0008] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = cm_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[CM_OL_0008] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[CM_OL_0008] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cm_ol_0009.c b/app/online/cm_ol_0009.c new file mode 100644 index 0000000..30ed70d --- /dev/null +++ b/app/online/cm_ol_0009.c @@ -0,0 +1,176 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/cm_ol_0009.pgc" +/* @tier hard @module cm @transform common-online */ +/* + * cm_ol_0009.pgc - 공통 온라인 서비스 (CM_OL_0009) [tier=hard] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cm_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/cm_ol_0009.pgc" + + +TX_SERVICE(CM_OL_0009, ctx) +{ + cm_rec_t rec; + char key[16], merch[16], bizdate[16], nextbiz[9]; + long amount = 0, daysum = 0; + int rc; + TXBUF *sub_in; + TXBUF *sub_out; + + tx_log(TX_LOG_INFO, "[CM_OL_0009] 공통 트랜잭션 오케스트레이션 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CM_OL_0009] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + if (!amount_is_valid(amount) || !date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[CM_OL_0009] 입력 검증 실패 amount=%ld date=%s", + amount, bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + /* 트랜잭션 시작 → 원장 반영 → 후속 서비스 연계 → 커밋 */ + if (tx_begin() != TX_OK) { + tx_return(ctx, TX_FAIL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, CM_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; + + rc = cm_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[CM_OL_0009] 원장반영 실패 rc=%d", rc); + tx_abort(); + tx_return(ctx, rc, ctx->out); + return; + } + + /* 정산 영업일 = 거래일의 다음 영업일 */ + if (date_next_business(bizdate, nextbiz) != 0) { + memcpy(nextbiz, bizdate, 8); + nextbiz[8] = '\0'; + } + + /* 후속 정산집계 서비스 연계 (레지스트리 문자열 디스패치) */ + sub_in = tx_buf_alloc(); + sub_out = tx_buf_alloc(); + if (sub_in && sub_out) { + tx_buf_sets(sub_in, "MERCHID", merch); + tx_buf_sets(sub_in, "BIZDATE", nextbiz); + tx_buf_setlong(sub_in, "AMOUNT", amount); + rc = tx_call("CM_POST", sub_in, sub_out); + if (rc != TX_OK) + tx_log(TX_LOG_WARN, "[CM_OL_0009] 후속연계 경고 rc=%d", rc); + } + tx_buf_free(sub_in); + tx_buf_free(sub_out); + + /* 교차 검증: 당일 합계 재계산 */ + if (cm_rec_sum(bizdate, &daysum) != TX_OK) + daysum = 0; + + tx_commit(); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYSUM", daysum); + tx_log(TX_LOG_INFO, "[CM_OL_0009] 완료 key=%s 당일합계=%ld", key, daysum); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cm_ol_0009.pgc b/app/online/cm_ol_0009.pgc new file mode 100644 index 0000000..58caee6 --- /dev/null +++ b/app/online/cm_ol_0009.pgc @@ -0,0 +1,98 @@ +/* @tier hard @module cm @transform common-online */ +/* + * cm_ol_0009.pgc - 공통 온라인 서비스 (CM_OL_0009) [tier=hard] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cm_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(CM_OL_0009, ctx) +{ + cm_rec_t rec; + char key[16], merch[16], bizdate[16], nextbiz[9]; + long amount = 0, daysum = 0; + int rc; + TXBUF *sub_in; + TXBUF *sub_out; + + tx_log(TX_LOG_INFO, "[CM_OL_0009] 공통 트랜잭션 오케스트레이션 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CM_OL_0009] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + if (!amount_is_valid(amount) || !date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[CM_OL_0009] 입력 검증 실패 amount=%ld date=%s", + amount, bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + /* 트랜잭션 시작 → 원장 반영 → 후속 서비스 연계 → 커밋 */ + if (tx_begin() != TX_OK) { + tx_return(ctx, TX_FAIL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, CM_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; + + rc = cm_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[CM_OL_0009] 원장반영 실패 rc=%d", rc); + tx_abort(); + tx_return(ctx, rc, ctx->out); + return; + } + + /* 정산 영업일 = 거래일의 다음 영업일 */ + if (date_next_business(bizdate, nextbiz) != 0) { + memcpy(nextbiz, bizdate, 8); + nextbiz[8] = '\0'; + } + + /* 후속 정산집계 서비스 연계 (레지스트리 문자열 디스패치) */ + sub_in = tx_buf_alloc(); + sub_out = tx_buf_alloc(); + if (sub_in && sub_out) { + tx_buf_sets(sub_in, "MERCHID", merch); + tx_buf_sets(sub_in, "BIZDATE", nextbiz); + tx_buf_setlong(sub_in, "AMOUNT", amount); + rc = tx_call("CM_POST", sub_in, sub_out); + if (rc != TX_OK) + tx_log(TX_LOG_WARN, "[CM_OL_0009] 후속연계 경고 rc=%d", rc); + } + tx_buf_free(sub_in); + tx_buf_free(sub_out); + + /* 교차 검증: 당일 합계 재계산 */ + if (cm_rec_sum(bizdate, &daysum) != TX_OK) + daysum = 0; + + tx_commit(); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYSUM", daysum); + tx_log(TX_LOG_INFO, "[CM_OL_0009] 완료 key=%s 당일합계=%ld", key, daysum); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cm_ol_0010.c b/app/online/cm_ol_0010.c new file mode 100644 index 0000000..f93ae1d --- /dev/null +++ b/app/online/cm_ol_0010.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/cm_ol_0010.pgc" +/* @tier easy @module cm @transform common-online */ +/* + * cm_ol_0010.pgc - 공통 온라인 서비스 (CM_OL_0010) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cm_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/cm_ol_0010.pgc" + + +TX_SERVICE(CM_OL_0010, ctx) +{ + cm_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[CM_OL_0010] 공통 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CM_OL_0010] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = cm_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[CM_OL_0010] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[CM_OL_0010] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cm_ol_0010.pgc b/app/online/cm_ol_0010.pgc new file mode 100644 index 0000000..f7a8890 --- /dev/null +++ b/app/online/cm_ol_0010.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module cm @transform common-online */ +/* + * cm_ol_0010.pgc - 공통 온라인 서비스 (CM_OL_0010) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cm_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(CM_OL_0010, ctx) +{ + cm_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[CM_OL_0010] 공통 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CM_OL_0010] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = cm_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[CM_OL_0010] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[CM_OL_0010] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cm_ol_0011.c b/app/online/cm_ol_0011.c new file mode 100644 index 0000000..8df0ee6 --- /dev/null +++ b/app/online/cm_ol_0011.c @@ -0,0 +1,176 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/cm_ol_0011.pgc" +/* @tier hard @module cm @transform common-online */ +/* + * cm_ol_0011.pgc - 공통 온라인 서비스 (CM_OL_0011) [tier=hard] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cm_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/cm_ol_0011.pgc" + + +TX_SERVICE(CM_OL_0011, ctx) +{ + cm_rec_t rec; + char key[16], merch[16], bizdate[16], nextbiz[9]; + long amount = 0, daysum = 0; + int rc; + TXBUF *sub_in; + TXBUF *sub_out; + + tx_log(TX_LOG_INFO, "[CM_OL_0011] 공통 트랜잭션 오케스트레이션 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CM_OL_0011] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + if (!amount_is_valid(amount) || !date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[CM_OL_0011] 입력 검증 실패 amount=%ld date=%s", + amount, bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + /* 트랜잭션 시작 → 원장 반영 → 후속 서비스 연계 → 커밋 */ + if (tx_begin() != TX_OK) { + tx_return(ctx, TX_FAIL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, CM_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; + + rc = cm_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[CM_OL_0011] 원장반영 실패 rc=%d", rc); + tx_abort(); + tx_return(ctx, rc, ctx->out); + return; + } + + /* 정산 영업일 = 거래일의 다음 영업일 */ + if (date_next_business(bizdate, nextbiz) != 0) { + memcpy(nextbiz, bizdate, 8); + nextbiz[8] = '\0'; + } + + /* 후속 정산집계 서비스 연계 (레지스트리 문자열 디스패치) */ + sub_in = tx_buf_alloc(); + sub_out = tx_buf_alloc(); + if (sub_in && sub_out) { + tx_buf_sets(sub_in, "MERCHID", merch); + tx_buf_sets(sub_in, "BIZDATE", nextbiz); + tx_buf_setlong(sub_in, "AMOUNT", amount); + rc = tx_call("CM_POST", sub_in, sub_out); + if (rc != TX_OK) + tx_log(TX_LOG_WARN, "[CM_OL_0011] 후속연계 경고 rc=%d", rc); + } + tx_buf_free(sub_in); + tx_buf_free(sub_out); + + /* 교차 검증: 당일 합계 재계산 */ + if (cm_rec_sum(bizdate, &daysum) != TX_OK) + daysum = 0; + + tx_commit(); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYSUM", daysum); + tx_log(TX_LOG_INFO, "[CM_OL_0011] 완료 key=%s 당일합계=%ld", key, daysum); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cm_ol_0011.pgc b/app/online/cm_ol_0011.pgc new file mode 100644 index 0000000..df56a29 --- /dev/null +++ b/app/online/cm_ol_0011.pgc @@ -0,0 +1,98 @@ +/* @tier hard @module cm @transform common-online */ +/* + * cm_ol_0011.pgc - 공통 온라인 서비스 (CM_OL_0011) [tier=hard] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cm_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(CM_OL_0011, ctx) +{ + cm_rec_t rec; + char key[16], merch[16], bizdate[16], nextbiz[9]; + long amount = 0, daysum = 0; + int rc; + TXBUF *sub_in; + TXBUF *sub_out; + + tx_log(TX_LOG_INFO, "[CM_OL_0011] 공통 트랜잭션 오케스트레이션 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CM_OL_0011] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + if (!amount_is_valid(amount) || !date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[CM_OL_0011] 입력 검증 실패 amount=%ld date=%s", + amount, bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + /* 트랜잭션 시작 → 원장 반영 → 후속 서비스 연계 → 커밋 */ + if (tx_begin() != TX_OK) { + tx_return(ctx, TX_FAIL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, CM_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; + + rc = cm_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[CM_OL_0011] 원장반영 실패 rc=%d", rc); + tx_abort(); + tx_return(ctx, rc, ctx->out); + return; + } + + /* 정산 영업일 = 거래일의 다음 영업일 */ + if (date_next_business(bizdate, nextbiz) != 0) { + memcpy(nextbiz, bizdate, 8); + nextbiz[8] = '\0'; + } + + /* 후속 정산집계 서비스 연계 (레지스트리 문자열 디스패치) */ + sub_in = tx_buf_alloc(); + sub_out = tx_buf_alloc(); + if (sub_in && sub_out) { + tx_buf_sets(sub_in, "MERCHID", merch); + tx_buf_sets(sub_in, "BIZDATE", nextbiz); + tx_buf_setlong(sub_in, "AMOUNT", amount); + rc = tx_call("CM_POST", sub_in, sub_out); + if (rc != TX_OK) + tx_log(TX_LOG_WARN, "[CM_OL_0011] 후속연계 경고 rc=%d", rc); + } + tx_buf_free(sub_in); + tx_buf_free(sub_out); + + /* 교차 검증: 당일 합계 재계산 */ + if (cm_rec_sum(bizdate, &daysum) != TX_OK) + daysum = 0; + + tx_commit(); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYSUM", daysum); + tx_log(TX_LOG_INFO, "[CM_OL_0011] 완료 key=%s 당일합계=%ld", key, daysum); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cm_ol_0012.c b/app/online/cm_ol_0012.c new file mode 100644 index 0000000..ee976fe --- /dev/null +++ b/app/online/cm_ol_0012.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/cm_ol_0012.pgc" +/* @tier easy @module cm @transform common-online */ +/* + * cm_ol_0012.pgc - 공통 온라인 서비스 (CM_OL_0012) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cm_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/cm_ol_0012.pgc" + + +TX_SERVICE(CM_OL_0012, ctx) +{ + cm_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[CM_OL_0012] 공통 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CM_OL_0012] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = cm_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[CM_OL_0012] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[CM_OL_0012] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cm_ol_0012.pgc b/app/online/cm_ol_0012.pgc new file mode 100644 index 0000000..affd753 --- /dev/null +++ b/app/online/cm_ol_0012.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module cm @transform common-online */ +/* + * cm_ol_0012.pgc - 공통 온라인 서비스 (CM_OL_0012) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cm_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(CM_OL_0012, ctx) +{ + cm_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[CM_OL_0012] 공통 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CM_OL_0012] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = cm_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[CM_OL_0012] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[CM_OL_0012] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cm_ol_0013.c b/app/online/cm_ol_0013.c new file mode 100644 index 0000000..34afddf --- /dev/null +++ b/app/online/cm_ol_0013.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/cm_ol_0013.pgc" +/* @tier easy @module cm @transform common-online */ +/* + * cm_ol_0013.pgc - 공통 온라인 서비스 (CM_OL_0013) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cm_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/cm_ol_0013.pgc" + + +TX_SERVICE(CM_OL_0013, ctx) +{ + cm_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[CM_OL_0013] 공통 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CM_OL_0013] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = cm_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[CM_OL_0013] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[CM_OL_0013] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cm_ol_0013.pgc b/app/online/cm_ol_0013.pgc new file mode 100644 index 0000000..9619d43 --- /dev/null +++ b/app/online/cm_ol_0013.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module cm @transform common-online */ +/* + * cm_ol_0013.pgc - 공통 온라인 서비스 (CM_OL_0013) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cm_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(CM_OL_0013, ctx) +{ + cm_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[CM_OL_0013] 공통 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CM_OL_0013] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = cm_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[CM_OL_0013] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[CM_OL_0013] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cm_ol_0014.c b/app/online/cm_ol_0014.c new file mode 100644 index 0000000..5d1a7dc --- /dev/null +++ b/app/online/cm_ol_0014.c @@ -0,0 +1,148 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/cm_ol_0014.pgc" +/* @tier medium @module cm @transform common-online */ +/* + * cm_ol_0014.pgc - 공통 온라인 서비스 (CM_OL_0014) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cm_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/cm_ol_0014.pgc" + + +TX_SERVICE(CM_OL_0014, ctx) +{ + cm_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[CM_OL_0014] 공통 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CM_OL_0014] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[CM_OL_0014] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[CM_OL_0014] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, CM_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = cm_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[CM_OL_0014] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = cm_rec_count(bizdate, CM_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[CM_OL_0014] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cm_ol_0014.pgc b/app/online/cm_ol_0014.pgc new file mode 100644 index 0000000..a8288e2 --- /dev/null +++ b/app/online/cm_ol_0014.pgc @@ -0,0 +1,70 @@ +/* @tier medium @module cm @transform common-online */ +/* + * cm_ol_0014.pgc - 공통 온라인 서비스 (CM_OL_0014) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cm_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(CM_OL_0014, ctx) +{ + cm_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[CM_OL_0014] 공통 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CM_OL_0014] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[CM_OL_0014] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[CM_OL_0014] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, CM_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = cm_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[CM_OL_0014] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = cm_rec_count(bizdate, CM_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[CM_OL_0014] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cm_ol_0015.c b/app/online/cm_ol_0015.c new file mode 100644 index 0000000..f923153 --- /dev/null +++ b/app/online/cm_ol_0015.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/cm_ol_0015.pgc" +/* @tier easy @module cm @transform common-online */ +/* + * cm_ol_0015.pgc - 공통 온라인 서비스 (CM_OL_0015) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cm_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/cm_ol_0015.pgc" + + +TX_SERVICE(CM_OL_0015, ctx) +{ + cm_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[CM_OL_0015] 공통 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CM_OL_0015] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = cm_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[CM_OL_0015] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[CM_OL_0015] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cm_ol_0015.pgc b/app/online/cm_ol_0015.pgc new file mode 100644 index 0000000..e999e5c --- /dev/null +++ b/app/online/cm_ol_0015.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module cm @transform common-online */ +/* + * cm_ol_0015.pgc - 공통 온라인 서비스 (CM_OL_0015) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cm_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(CM_OL_0015, ctx) +{ + cm_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[CM_OL_0015] 공통 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CM_OL_0015] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = cm_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[CM_OL_0015] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[CM_OL_0015] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cm_ol_0016.c b/app/online/cm_ol_0016.c new file mode 100644 index 0000000..184c30b --- /dev/null +++ b/app/online/cm_ol_0016.c @@ -0,0 +1,148 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/cm_ol_0016.pgc" +/* @tier medium @module cm @transform common-online */ +/* + * cm_ol_0016.pgc - 공통 온라인 서비스 (CM_OL_0016) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cm_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/cm_ol_0016.pgc" + + +TX_SERVICE(CM_OL_0016, ctx) +{ + cm_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[CM_OL_0016] 공통 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CM_OL_0016] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[CM_OL_0016] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[CM_OL_0016] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, CM_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = cm_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[CM_OL_0016] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = cm_rec_count(bizdate, CM_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[CM_OL_0016] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cm_ol_0016.pgc b/app/online/cm_ol_0016.pgc new file mode 100644 index 0000000..9e023e3 --- /dev/null +++ b/app/online/cm_ol_0016.pgc @@ -0,0 +1,70 @@ +/* @tier medium @module cm @transform common-online */ +/* + * cm_ol_0016.pgc - 공통 온라인 서비스 (CM_OL_0016) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cm_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(CM_OL_0016, ctx) +{ + cm_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[CM_OL_0016] 공통 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CM_OL_0016] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[CM_OL_0016] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[CM_OL_0016] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, CM_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = cm_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[CM_OL_0016] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = cm_rec_count(bizdate, CM_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[CM_OL_0016] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cm_ol_0017.c b/app/online/cm_ol_0017.c new file mode 100644 index 0000000..c53eb6d --- /dev/null +++ b/app/online/cm_ol_0017.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/cm_ol_0017.pgc" +/* @tier easy @module cm @transform common-online */ +/* + * cm_ol_0017.pgc - 공통 온라인 서비스 (CM_OL_0017) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cm_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/cm_ol_0017.pgc" + + +TX_SERVICE(CM_OL_0017, ctx) +{ + cm_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[CM_OL_0017] 공통 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CM_OL_0017] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = cm_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[CM_OL_0017] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[CM_OL_0017] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cm_ol_0017.pgc b/app/online/cm_ol_0017.pgc new file mode 100644 index 0000000..8469151 --- /dev/null +++ b/app/online/cm_ol_0017.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module cm @transform common-online */ +/* + * cm_ol_0017.pgc - 공통 온라인 서비스 (CM_OL_0017) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cm_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(CM_OL_0017, ctx) +{ + cm_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[CM_OL_0017] 공통 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CM_OL_0017] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = cm_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[CM_OL_0017] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[CM_OL_0017] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cm_ol_0018.c b/app/online/cm_ol_0018.c new file mode 100644 index 0000000..b14619a --- /dev/null +++ b/app/online/cm_ol_0018.c @@ -0,0 +1,148 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/cm_ol_0018.pgc" +/* @tier medium @module cm @transform common-online */ +/* + * cm_ol_0018.pgc - 공통 온라인 서비스 (CM_OL_0018) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cm_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/cm_ol_0018.pgc" + + +TX_SERVICE(CM_OL_0018, ctx) +{ + cm_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[CM_OL_0018] 공통 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CM_OL_0018] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[CM_OL_0018] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[CM_OL_0018] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, CM_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = cm_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[CM_OL_0018] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = cm_rec_count(bizdate, CM_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[CM_OL_0018] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cm_ol_0018.pgc b/app/online/cm_ol_0018.pgc new file mode 100644 index 0000000..9f278a3 --- /dev/null +++ b/app/online/cm_ol_0018.pgc @@ -0,0 +1,70 @@ +/* @tier medium @module cm @transform common-online */ +/* + * cm_ol_0018.pgc - 공통 온라인 서비스 (CM_OL_0018) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cm_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(CM_OL_0018, ctx) +{ + cm_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[CM_OL_0018] 공통 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CM_OL_0018] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[CM_OL_0018] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[CM_OL_0018] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, CM_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = cm_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[CM_OL_0018] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = cm_rec_count(bizdate, CM_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[CM_OL_0018] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cm_ol_0019.c b/app/online/cm_ol_0019.c new file mode 100644 index 0000000..04b7074 --- /dev/null +++ b/app/online/cm_ol_0019.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/cm_ol_0019.pgc" +/* @tier easy @module cm @transform common-online */ +/* + * cm_ol_0019.pgc - 공통 온라인 서비스 (CM_OL_0019) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cm_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/cm_ol_0019.pgc" + + +TX_SERVICE(CM_OL_0019, ctx) +{ + cm_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[CM_OL_0019] 공통 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CM_OL_0019] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = cm_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[CM_OL_0019] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[CM_OL_0019] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cm_ol_0019.pgc b/app/online/cm_ol_0019.pgc new file mode 100644 index 0000000..aee6fd5 --- /dev/null +++ b/app/online/cm_ol_0019.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module cm @transform common-online */ +/* + * cm_ol_0019.pgc - 공통 온라인 서비스 (CM_OL_0019) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cm_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(CM_OL_0019, ctx) +{ + cm_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[CM_OL_0019] 공통 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CM_OL_0019] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = cm_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[CM_OL_0019] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[CM_OL_0019] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cm_ol_0020.c b/app/online/cm_ol_0020.c new file mode 100644 index 0000000..217d7e7 --- /dev/null +++ b/app/online/cm_ol_0020.c @@ -0,0 +1,176 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/cm_ol_0020.pgc" +/* @tier hard @module cm @transform common-online */ +/* + * cm_ol_0020.pgc - 공통 온라인 서비스 (CM_OL_0020) [tier=hard] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cm_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/cm_ol_0020.pgc" + + +TX_SERVICE(CM_OL_0020, ctx) +{ + cm_rec_t rec; + char key[16], merch[16], bizdate[16], nextbiz[9]; + long amount = 0, daysum = 0; + int rc; + TXBUF *sub_in; + TXBUF *sub_out; + + tx_log(TX_LOG_INFO, "[CM_OL_0020] 공통 트랜잭션 오케스트레이션 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CM_OL_0020] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + if (!amount_is_valid(amount) || !date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[CM_OL_0020] 입력 검증 실패 amount=%ld date=%s", + amount, bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + /* 트랜잭션 시작 → 원장 반영 → 후속 서비스 연계 → 커밋 */ + if (tx_begin() != TX_OK) { + tx_return(ctx, TX_FAIL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, CM_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; + + rc = cm_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[CM_OL_0020] 원장반영 실패 rc=%d", rc); + tx_abort(); + tx_return(ctx, rc, ctx->out); + return; + } + + /* 정산 영업일 = 거래일의 다음 영업일 */ + if (date_next_business(bizdate, nextbiz) != 0) { + memcpy(nextbiz, bizdate, 8); + nextbiz[8] = '\0'; + } + + /* 후속 정산집계 서비스 연계 (레지스트리 문자열 디스패치) */ + sub_in = tx_buf_alloc(); + sub_out = tx_buf_alloc(); + if (sub_in && sub_out) { + tx_buf_sets(sub_in, "MERCHID", merch); + tx_buf_sets(sub_in, "BIZDATE", nextbiz); + tx_buf_setlong(sub_in, "AMOUNT", amount); + rc = tx_call("CM_POST", sub_in, sub_out); + if (rc != TX_OK) + tx_log(TX_LOG_WARN, "[CM_OL_0020] 후속연계 경고 rc=%d", rc); + } + tx_buf_free(sub_in); + tx_buf_free(sub_out); + + /* 교차 검증: 당일 합계 재계산 */ + if (cm_rec_sum(bizdate, &daysum) != TX_OK) + daysum = 0; + + tx_commit(); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYSUM", daysum); + tx_log(TX_LOG_INFO, "[CM_OL_0020] 완료 key=%s 당일합계=%ld", key, daysum); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cm_ol_0020.pgc b/app/online/cm_ol_0020.pgc new file mode 100644 index 0000000..fcdec9e --- /dev/null +++ b/app/online/cm_ol_0020.pgc @@ -0,0 +1,98 @@ +/* @tier hard @module cm @transform common-online */ +/* + * cm_ol_0020.pgc - 공통 온라인 서비스 (CM_OL_0020) [tier=hard] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cm_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(CM_OL_0020, ctx) +{ + cm_rec_t rec; + char key[16], merch[16], bizdate[16], nextbiz[9]; + long amount = 0, daysum = 0; + int rc; + TXBUF *sub_in; + TXBUF *sub_out; + + tx_log(TX_LOG_INFO, "[CM_OL_0020] 공통 트랜잭션 오케스트레이션 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CM_OL_0020] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + if (!amount_is_valid(amount) || !date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[CM_OL_0020] 입력 검증 실패 amount=%ld date=%s", + amount, bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + /* 트랜잭션 시작 → 원장 반영 → 후속 서비스 연계 → 커밋 */ + if (tx_begin() != TX_OK) { + tx_return(ctx, TX_FAIL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, CM_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; + + rc = cm_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[CM_OL_0020] 원장반영 실패 rc=%d", rc); + tx_abort(); + tx_return(ctx, rc, ctx->out); + return; + } + + /* 정산 영업일 = 거래일의 다음 영업일 */ + if (date_next_business(bizdate, nextbiz) != 0) { + memcpy(nextbiz, bizdate, 8); + nextbiz[8] = '\0'; + } + + /* 후속 정산집계 서비스 연계 (레지스트리 문자열 디스패치) */ + sub_in = tx_buf_alloc(); + sub_out = tx_buf_alloc(); + if (sub_in && sub_out) { + tx_buf_sets(sub_in, "MERCHID", merch); + tx_buf_sets(sub_in, "BIZDATE", nextbiz); + tx_buf_setlong(sub_in, "AMOUNT", amount); + rc = tx_call("CM_POST", sub_in, sub_out); + if (rc != TX_OK) + tx_log(TX_LOG_WARN, "[CM_OL_0020] 후속연계 경고 rc=%d", rc); + } + tx_buf_free(sub_in); + tx_buf_free(sub_out); + + /* 교차 검증: 당일 합계 재계산 */ + if (cm_rec_sum(bizdate, &daysum) != TX_OK) + daysum = 0; + + tx_commit(); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYSUM", daysum); + tx_log(TX_LOG_INFO, "[CM_OL_0020] 완료 key=%s 당일합계=%ld", key, daysum); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cm_ol_0021.c b/app/online/cm_ol_0021.c new file mode 100644 index 0000000..62b2780 --- /dev/null +++ b/app/online/cm_ol_0021.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/cm_ol_0021.pgc" +/* @tier easy @module cm @transform common-online */ +/* + * cm_ol_0021.pgc - 공통 온라인 서비스 (CM_OL_0021) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cm_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/cm_ol_0021.pgc" + + +TX_SERVICE(CM_OL_0021, ctx) +{ + cm_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[CM_OL_0021] 공통 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CM_OL_0021] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = cm_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[CM_OL_0021] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[CM_OL_0021] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cm_ol_0021.pgc b/app/online/cm_ol_0021.pgc new file mode 100644 index 0000000..de09294 --- /dev/null +++ b/app/online/cm_ol_0021.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module cm @transform common-online */ +/* + * cm_ol_0021.pgc - 공통 온라인 서비스 (CM_OL_0021) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cm_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(CM_OL_0021, ctx) +{ + cm_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[CM_OL_0021] 공통 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CM_OL_0021] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = cm_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[CM_OL_0021] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[CM_OL_0021] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cm_ol_0022.c b/app/online/cm_ol_0022.c new file mode 100644 index 0000000..9f91db0 --- /dev/null +++ b/app/online/cm_ol_0022.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/cm_ol_0022.pgc" +/* @tier easy @module cm @transform common-online */ +/* + * cm_ol_0022.pgc - 공통 온라인 서비스 (CM_OL_0022) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cm_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/cm_ol_0022.pgc" + + +TX_SERVICE(CM_OL_0022, ctx) +{ + cm_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[CM_OL_0022] 공통 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CM_OL_0022] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = cm_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[CM_OL_0022] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[CM_OL_0022] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cm_ol_0022.pgc b/app/online/cm_ol_0022.pgc new file mode 100644 index 0000000..1f76efb --- /dev/null +++ b/app/online/cm_ol_0022.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module cm @transform common-online */ +/* + * cm_ol_0022.pgc - 공통 온라인 서비스 (CM_OL_0022) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cm_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(CM_OL_0022, ctx) +{ + cm_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[CM_OL_0022] 공통 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CM_OL_0022] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = cm_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[CM_OL_0022] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[CM_OL_0022] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cm_ol_0023.c b/app/online/cm_ol_0023.c new file mode 100644 index 0000000..13a94ae --- /dev/null +++ b/app/online/cm_ol_0023.c @@ -0,0 +1,148 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/cm_ol_0023.pgc" +/* @tier medium @module cm @transform common-online */ +/* + * cm_ol_0023.pgc - 공통 온라인 서비스 (CM_OL_0023) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cm_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/cm_ol_0023.pgc" + + +TX_SERVICE(CM_OL_0023, ctx) +{ + cm_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[CM_OL_0023] 공통 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CM_OL_0023] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[CM_OL_0023] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[CM_OL_0023] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, CM_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = cm_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[CM_OL_0023] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = cm_rec_count(bizdate, CM_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[CM_OL_0023] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cm_ol_0023.pgc b/app/online/cm_ol_0023.pgc new file mode 100644 index 0000000..f25cea9 --- /dev/null +++ b/app/online/cm_ol_0023.pgc @@ -0,0 +1,70 @@ +/* @tier medium @module cm @transform common-online */ +/* + * cm_ol_0023.pgc - 공통 온라인 서비스 (CM_OL_0023) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cm_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(CM_OL_0023, ctx) +{ + cm_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[CM_OL_0023] 공통 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CM_OL_0023] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[CM_OL_0023] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[CM_OL_0023] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, CM_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = cm_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[CM_OL_0023] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = cm_rec_count(bizdate, CM_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[CM_OL_0023] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cm_ol_0024.c b/app/online/cm_ol_0024.c new file mode 100644 index 0000000..998ac7e --- /dev/null +++ b/app/online/cm_ol_0024.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/cm_ol_0024.pgc" +/* @tier easy @module cm @transform common-online */ +/* + * cm_ol_0024.pgc - 공통 온라인 서비스 (CM_OL_0024) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cm_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/cm_ol_0024.pgc" + + +TX_SERVICE(CM_OL_0024, ctx) +{ + cm_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[CM_OL_0024] 공통 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CM_OL_0024] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = cm_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[CM_OL_0024] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[CM_OL_0024] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cm_ol_0024.pgc b/app/online/cm_ol_0024.pgc new file mode 100644 index 0000000..2b9e37e --- /dev/null +++ b/app/online/cm_ol_0024.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module cm @transform common-online */ +/* + * cm_ol_0024.pgc - 공통 온라인 서비스 (CM_OL_0024) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cm_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(CM_OL_0024, ctx) +{ + cm_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[CM_OL_0024] 공통 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CM_OL_0024] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = cm_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[CM_OL_0024] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[CM_OL_0024] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cm_ol_0025.c b/app/online/cm_ol_0025.c new file mode 100644 index 0000000..f440c54 --- /dev/null +++ b/app/online/cm_ol_0025.c @@ -0,0 +1,148 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/cm_ol_0025.pgc" +/* @tier medium @module cm @transform common-online */ +/* + * cm_ol_0025.pgc - 공통 온라인 서비스 (CM_OL_0025) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cm_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/cm_ol_0025.pgc" + + +TX_SERVICE(CM_OL_0025, ctx) +{ + cm_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[CM_OL_0025] 공통 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CM_OL_0025] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[CM_OL_0025] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[CM_OL_0025] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, CM_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = cm_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[CM_OL_0025] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = cm_rec_count(bizdate, CM_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[CM_OL_0025] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cm_ol_0025.pgc b/app/online/cm_ol_0025.pgc new file mode 100644 index 0000000..c41d991 --- /dev/null +++ b/app/online/cm_ol_0025.pgc @@ -0,0 +1,70 @@ +/* @tier medium @module cm @transform common-online */ +/* + * cm_ol_0025.pgc - 공통 온라인 서비스 (CM_OL_0025) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cm_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(CM_OL_0025, ctx) +{ + cm_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[CM_OL_0025] 공통 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CM_OL_0025] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[CM_OL_0025] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[CM_OL_0025] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, CM_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = cm_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[CM_OL_0025] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = cm_rec_count(bizdate, CM_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[CM_OL_0025] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cm_ol_0026.c b/app/online/cm_ol_0026.c new file mode 100644 index 0000000..9da3022 --- /dev/null +++ b/app/online/cm_ol_0026.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/cm_ol_0026.pgc" +/* @tier easy @module cm @transform common-online */ +/* + * cm_ol_0026.pgc - 공통 온라인 서비스 (CM_OL_0026) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cm_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/cm_ol_0026.pgc" + + +TX_SERVICE(CM_OL_0026, ctx) +{ + cm_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[CM_OL_0026] 공통 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CM_OL_0026] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = cm_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[CM_OL_0026] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[CM_OL_0026] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cm_ol_0026.pgc b/app/online/cm_ol_0026.pgc new file mode 100644 index 0000000..358da18 --- /dev/null +++ b/app/online/cm_ol_0026.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module cm @transform common-online */ +/* + * cm_ol_0026.pgc - 공통 온라인 서비스 (CM_OL_0026) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cm_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(CM_OL_0026, ctx) +{ + cm_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[CM_OL_0026] 공통 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CM_OL_0026] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = cm_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[CM_OL_0026] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[CM_OL_0026] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cm_ol_0027.c b/app/online/cm_ol_0027.c new file mode 100644 index 0000000..0bc430a --- /dev/null +++ b/app/online/cm_ol_0027.c @@ -0,0 +1,148 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/cm_ol_0027.pgc" +/* @tier medium @module cm @transform common-online */ +/* + * cm_ol_0027.pgc - 공통 온라인 서비스 (CM_OL_0027) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cm_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/cm_ol_0027.pgc" + + +TX_SERVICE(CM_OL_0027, ctx) +{ + cm_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[CM_OL_0027] 공통 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CM_OL_0027] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[CM_OL_0027] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[CM_OL_0027] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, CM_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = cm_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[CM_OL_0027] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = cm_rec_count(bizdate, CM_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[CM_OL_0027] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cm_ol_0027.pgc b/app/online/cm_ol_0027.pgc new file mode 100644 index 0000000..941d559 --- /dev/null +++ b/app/online/cm_ol_0027.pgc @@ -0,0 +1,70 @@ +/* @tier medium @module cm @transform common-online */ +/* + * cm_ol_0027.pgc - 공통 온라인 서비스 (CM_OL_0027) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cm_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(CM_OL_0027, ctx) +{ + cm_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[CM_OL_0027] 공통 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CM_OL_0027] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[CM_OL_0027] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[CM_OL_0027] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, CM_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = cm_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[CM_OL_0027] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = cm_rec_count(bizdate, CM_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[CM_OL_0027] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cm_ol_0028.c b/app/online/cm_ol_0028.c new file mode 100644 index 0000000..f0a3c6c --- /dev/null +++ b/app/online/cm_ol_0028.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/cm_ol_0028.pgc" +/* @tier easy @module cm @transform common-online */ +/* + * cm_ol_0028.pgc - 공통 온라인 서비스 (CM_OL_0028) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cm_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/cm_ol_0028.pgc" + + +TX_SERVICE(CM_OL_0028, ctx) +{ + cm_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[CM_OL_0028] 공통 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CM_OL_0028] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = cm_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[CM_OL_0028] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[CM_OL_0028] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cm_ol_0028.pgc b/app/online/cm_ol_0028.pgc new file mode 100644 index 0000000..6314ef0 --- /dev/null +++ b/app/online/cm_ol_0028.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module cm @transform common-online */ +/* + * cm_ol_0028.pgc - 공통 온라인 서비스 (CM_OL_0028) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cm_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(CM_OL_0028, ctx) +{ + cm_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[CM_OL_0028] 공통 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CM_OL_0028] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = cm_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[CM_OL_0028] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[CM_OL_0028] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cm_ol_0029.c b/app/online/cm_ol_0029.c new file mode 100644 index 0000000..675efb8 --- /dev/null +++ b/app/online/cm_ol_0029.c @@ -0,0 +1,176 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/cm_ol_0029.pgc" +/* @tier hard @module cm @transform common-online */ +/* + * cm_ol_0029.pgc - 공통 온라인 서비스 (CM_OL_0029) [tier=hard] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cm_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/cm_ol_0029.pgc" + + +TX_SERVICE(CM_OL_0029, ctx) +{ + cm_rec_t rec; + char key[16], merch[16], bizdate[16], nextbiz[9]; + long amount = 0, daysum = 0; + int rc; + TXBUF *sub_in; + TXBUF *sub_out; + + tx_log(TX_LOG_INFO, "[CM_OL_0029] 공통 트랜잭션 오케스트레이션 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CM_OL_0029] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + if (!amount_is_valid(amount) || !date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[CM_OL_0029] 입력 검증 실패 amount=%ld date=%s", + amount, bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + /* 트랜잭션 시작 → 원장 반영 → 후속 서비스 연계 → 커밋 */ + if (tx_begin() != TX_OK) { + tx_return(ctx, TX_FAIL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, CM_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; + + rc = cm_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[CM_OL_0029] 원장반영 실패 rc=%d", rc); + tx_abort(); + tx_return(ctx, rc, ctx->out); + return; + } + + /* 정산 영업일 = 거래일의 다음 영업일 */ + if (date_next_business(bizdate, nextbiz) != 0) { + memcpy(nextbiz, bizdate, 8); + nextbiz[8] = '\0'; + } + + /* 후속 정산집계 서비스 연계 (레지스트리 문자열 디스패치) */ + sub_in = tx_buf_alloc(); + sub_out = tx_buf_alloc(); + if (sub_in && sub_out) { + tx_buf_sets(sub_in, "MERCHID", merch); + tx_buf_sets(sub_in, "BIZDATE", nextbiz); + tx_buf_setlong(sub_in, "AMOUNT", amount); + rc = tx_call("CM_POST", sub_in, sub_out); + if (rc != TX_OK) + tx_log(TX_LOG_WARN, "[CM_OL_0029] 후속연계 경고 rc=%d", rc); + } + tx_buf_free(sub_in); + tx_buf_free(sub_out); + + /* 교차 검증: 당일 합계 재계산 */ + if (cm_rec_sum(bizdate, &daysum) != TX_OK) + daysum = 0; + + tx_commit(); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYSUM", daysum); + tx_log(TX_LOG_INFO, "[CM_OL_0029] 완료 key=%s 당일합계=%ld", key, daysum); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cm_ol_0029.pgc b/app/online/cm_ol_0029.pgc new file mode 100644 index 0000000..2699366 --- /dev/null +++ b/app/online/cm_ol_0029.pgc @@ -0,0 +1,98 @@ +/* @tier hard @module cm @transform common-online */ +/* + * cm_ol_0029.pgc - 공통 온라인 서비스 (CM_OL_0029) [tier=hard] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cm_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(CM_OL_0029, ctx) +{ + cm_rec_t rec; + char key[16], merch[16], bizdate[16], nextbiz[9]; + long amount = 0, daysum = 0; + int rc; + TXBUF *sub_in; + TXBUF *sub_out; + + tx_log(TX_LOG_INFO, "[CM_OL_0029] 공통 트랜잭션 오케스트레이션 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CM_OL_0029] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + if (!amount_is_valid(amount) || !date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[CM_OL_0029] 입력 검증 실패 amount=%ld date=%s", + amount, bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + /* 트랜잭션 시작 → 원장 반영 → 후속 서비스 연계 → 커밋 */ + if (tx_begin() != TX_OK) { + tx_return(ctx, TX_FAIL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, CM_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; + + rc = cm_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[CM_OL_0029] 원장반영 실패 rc=%d", rc); + tx_abort(); + tx_return(ctx, rc, ctx->out); + return; + } + + /* 정산 영업일 = 거래일의 다음 영업일 */ + if (date_next_business(bizdate, nextbiz) != 0) { + memcpy(nextbiz, bizdate, 8); + nextbiz[8] = '\0'; + } + + /* 후속 정산집계 서비스 연계 (레지스트리 문자열 디스패치) */ + sub_in = tx_buf_alloc(); + sub_out = tx_buf_alloc(); + if (sub_in && sub_out) { + tx_buf_sets(sub_in, "MERCHID", merch); + tx_buf_sets(sub_in, "BIZDATE", nextbiz); + tx_buf_setlong(sub_in, "AMOUNT", amount); + rc = tx_call("CM_POST", sub_in, sub_out); + if (rc != TX_OK) + tx_log(TX_LOG_WARN, "[CM_OL_0029] 후속연계 경고 rc=%d", rc); + } + tx_buf_free(sub_in); + tx_buf_free(sub_out); + + /* 교차 검증: 당일 합계 재계산 */ + if (cm_rec_sum(bizdate, &daysum) != TX_OK) + daysum = 0; + + tx_commit(); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYSUM", daysum); + tx_log(TX_LOG_INFO, "[CM_OL_0029] 완료 key=%s 당일합계=%ld", key, daysum); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cm_ol_0030.c b/app/online/cm_ol_0030.c new file mode 100644 index 0000000..5897fef --- /dev/null +++ b/app/online/cm_ol_0030.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/cm_ol_0030.pgc" +/* @tier easy @module cm @transform common-online */ +/* + * cm_ol_0030.pgc - 공통 온라인 서비스 (CM_OL_0030) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cm_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/cm_ol_0030.pgc" + + +TX_SERVICE(CM_OL_0030, ctx) +{ + cm_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[CM_OL_0030] 공통 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CM_OL_0030] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = cm_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[CM_OL_0030] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[CM_OL_0030] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cm_ol_0030.pgc b/app/online/cm_ol_0030.pgc new file mode 100644 index 0000000..924ad74 --- /dev/null +++ b/app/online/cm_ol_0030.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module cm @transform common-online */ +/* + * cm_ol_0030.pgc - 공통 온라인 서비스 (CM_OL_0030) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cm_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(CM_OL_0030, ctx) +{ + cm_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[CM_OL_0030] 공통 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CM_OL_0030] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = cm_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[CM_OL_0030] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[CM_OL_0030] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cm_ol_0031.c b/app/online/cm_ol_0031.c new file mode 100644 index 0000000..b5a1c54 --- /dev/null +++ b/app/online/cm_ol_0031.c @@ -0,0 +1,176 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/cm_ol_0031.pgc" +/* @tier hard @module cm @transform common-online */ +/* + * cm_ol_0031.pgc - 공통 온라인 서비스 (CM_OL_0031) [tier=hard] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cm_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/cm_ol_0031.pgc" + + +TX_SERVICE(CM_OL_0031, ctx) +{ + cm_rec_t rec; + char key[16], merch[16], bizdate[16], nextbiz[9]; + long amount = 0, daysum = 0; + int rc; + TXBUF *sub_in; + TXBUF *sub_out; + + tx_log(TX_LOG_INFO, "[CM_OL_0031] 공통 트랜잭션 오케스트레이션 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CM_OL_0031] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + if (!amount_is_valid(amount) || !date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[CM_OL_0031] 입력 검증 실패 amount=%ld date=%s", + amount, bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + /* 트랜잭션 시작 → 원장 반영 → 후속 서비스 연계 → 커밋 */ + if (tx_begin() != TX_OK) { + tx_return(ctx, TX_FAIL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, CM_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; + + rc = cm_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[CM_OL_0031] 원장반영 실패 rc=%d", rc); + tx_abort(); + tx_return(ctx, rc, ctx->out); + return; + } + + /* 정산 영업일 = 거래일의 다음 영업일 */ + if (date_next_business(bizdate, nextbiz) != 0) { + memcpy(nextbiz, bizdate, 8); + nextbiz[8] = '\0'; + } + + /* 후속 정산집계 서비스 연계 (레지스트리 문자열 디스패치) */ + sub_in = tx_buf_alloc(); + sub_out = tx_buf_alloc(); + if (sub_in && sub_out) { + tx_buf_sets(sub_in, "MERCHID", merch); + tx_buf_sets(sub_in, "BIZDATE", nextbiz); + tx_buf_setlong(sub_in, "AMOUNT", amount); + rc = tx_call("CM_POST", sub_in, sub_out); + if (rc != TX_OK) + tx_log(TX_LOG_WARN, "[CM_OL_0031] 후속연계 경고 rc=%d", rc); + } + tx_buf_free(sub_in); + tx_buf_free(sub_out); + + /* 교차 검증: 당일 합계 재계산 */ + if (cm_rec_sum(bizdate, &daysum) != TX_OK) + daysum = 0; + + tx_commit(); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYSUM", daysum); + tx_log(TX_LOG_INFO, "[CM_OL_0031] 완료 key=%s 당일합계=%ld", key, daysum); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/cm_ol_0031.pgc b/app/online/cm_ol_0031.pgc new file mode 100644 index 0000000..e3ef8d7 --- /dev/null +++ b/app/online/cm_ol_0031.pgc @@ -0,0 +1,98 @@ +/* @tier hard @module cm @transform common-online */ +/* + * cm_ol_0031.pgc - 공통 온라인 서비스 (CM_OL_0031) [tier=hard] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 cm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "cm_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(CM_OL_0031, ctx) +{ + cm_rec_t rec; + char key[16], merch[16], bizdate[16], nextbiz[9]; + long amount = 0, daysum = 0; + int rc; + TXBUF *sub_in; + TXBUF *sub_out; + + tx_log(TX_LOG_INFO, "[CM_OL_0031] 공통 트랜잭션 오케스트레이션 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[CM_OL_0031] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + if (!amount_is_valid(amount) || !date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[CM_OL_0031] 입력 검증 실패 amount=%ld date=%s", + amount, bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + /* 트랜잭션 시작 → 원장 반영 → 후속 서비스 연계 → 커밋 */ + if (tx_begin() != TX_OK) { + tx_return(ctx, TX_FAIL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, CM_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; + + rc = cm_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[CM_OL_0031] 원장반영 실패 rc=%d", rc); + tx_abort(); + tx_return(ctx, rc, ctx->out); + return; + } + + /* 정산 영업일 = 거래일의 다음 영업일 */ + if (date_next_business(bizdate, nextbiz) != 0) { + memcpy(nextbiz, bizdate, 8); + nextbiz[8] = '\0'; + } + + /* 후속 정산집계 서비스 연계 (레지스트리 문자열 디스패치) */ + sub_in = tx_buf_alloc(); + sub_out = tx_buf_alloc(); + if (sub_in && sub_out) { + tx_buf_sets(sub_in, "MERCHID", merch); + tx_buf_sets(sub_in, "BIZDATE", nextbiz); + tx_buf_setlong(sub_in, "AMOUNT", amount); + rc = tx_call("CM_POST", sub_in, sub_out); + if (rc != TX_OK) + tx_log(TX_LOG_WARN, "[CM_OL_0031] 후속연계 경고 rc=%d", rc); + } + tx_buf_free(sub_in); + tx_buf_free(sub_out); + + /* 교차 검증: 당일 합계 재계산 */ + if (cm_rec_sum(bizdate, &daysum) != TX_OK) + daysum = 0; + + tx_commit(); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYSUM", daysum); + tx_log(TX_LOG_INFO, "[CM_OL_0031] 완료 key=%s 당일합계=%ld", key, daysum); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/lg_ol_0001.c b/app/online/lg_ol_0001.c new file mode 100644 index 0000000..82e2269 --- /dev/null +++ b/app/online/lg_ol_0001.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/lg_ol_0001.pgc" +/* @tier easy @module lg @transform ledger-online */ +/* + * lg_ol_0001.pgc - 원장 온라인 서비스 (LG_OL_0001) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 lg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "lg_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/lg_ol_0001.pgc" + + +TX_SERVICE(LG_OL_0001, ctx) +{ + lg_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[LG_OL_0001] 원장 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[LG_OL_0001] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = lg_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[LG_OL_0001] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[LG_OL_0001] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/lg_ol_0001.pgc b/app/online/lg_ol_0001.pgc new file mode 100644 index 0000000..b482dd6 --- /dev/null +++ b/app/online/lg_ol_0001.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module lg @transform ledger-online */ +/* + * lg_ol_0001.pgc - 원장 온라인 서비스 (LG_OL_0001) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 lg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "lg_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(LG_OL_0001, ctx) +{ + lg_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[LG_OL_0001] 원장 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[LG_OL_0001] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = lg_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[LG_OL_0001] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[LG_OL_0001] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/lg_ol_0002.c b/app/online/lg_ol_0002.c new file mode 100644 index 0000000..e70baf3 --- /dev/null +++ b/app/online/lg_ol_0002.c @@ -0,0 +1,176 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/lg_ol_0002.pgc" +/* @tier hard @module lg @transform ledger-online */ +/* + * lg_ol_0002.pgc - 원장 온라인 서비스 (LG_OL_0002) [tier=hard] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 lg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "lg_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/lg_ol_0002.pgc" + + +TX_SERVICE(LG_OL_0002, ctx) +{ + lg_rec_t rec; + char key[16], merch[16], bizdate[16], nextbiz[9]; + long amount = 0, daysum = 0; + int rc; + TXBUF *sub_in; + TXBUF *sub_out; + + tx_log(TX_LOG_INFO, "[LG_OL_0002] 원장 트랜잭션 오케스트레이션 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[LG_OL_0002] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + if (!amount_is_valid(amount) || !date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[LG_OL_0002] 입력 검증 실패 amount=%ld date=%s", + amount, bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + /* 트랜잭션 시작 → 원장 반영 → 후속 서비스 연계 → 커밋 */ + if (tx_begin() != TX_OK) { + tx_return(ctx, TX_FAIL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, LG_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; + + rc = lg_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[LG_OL_0002] 원장반영 실패 rc=%d", rc); + tx_abort(); + tx_return(ctx, rc, ctx->out); + return; + } + + /* 정산 영업일 = 거래일의 다음 영업일 */ + if (date_next_business(bizdate, nextbiz) != 0) { + memcpy(nextbiz, bizdate, 8); + nextbiz[8] = '\0'; + } + + /* 후속 정산집계 서비스 연계 (레지스트리 문자열 디스패치) */ + sub_in = tx_buf_alloc(); + sub_out = tx_buf_alloc(); + if (sub_in && sub_out) { + tx_buf_sets(sub_in, "MERCHID", merch); + tx_buf_sets(sub_in, "BIZDATE", nextbiz); + tx_buf_setlong(sub_in, "AMOUNT", amount); + rc = tx_call("LG_POST", sub_in, sub_out); + if (rc != TX_OK) + tx_log(TX_LOG_WARN, "[LG_OL_0002] 후속연계 경고 rc=%d", rc); + } + tx_buf_free(sub_in); + tx_buf_free(sub_out); + + /* 교차 검증: 당일 합계 재계산 */ + if (lg_rec_sum(bizdate, &daysum) != TX_OK) + daysum = 0; + + tx_commit(); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYSUM", daysum); + tx_log(TX_LOG_INFO, "[LG_OL_0002] 완료 key=%s 당일합계=%ld", key, daysum); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/lg_ol_0002.pgc b/app/online/lg_ol_0002.pgc new file mode 100644 index 0000000..81485ab --- /dev/null +++ b/app/online/lg_ol_0002.pgc @@ -0,0 +1,98 @@ +/* @tier hard @module lg @transform ledger-online */ +/* + * lg_ol_0002.pgc - 원장 온라인 서비스 (LG_OL_0002) [tier=hard] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 lg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "lg_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(LG_OL_0002, ctx) +{ + lg_rec_t rec; + char key[16], merch[16], bizdate[16], nextbiz[9]; + long amount = 0, daysum = 0; + int rc; + TXBUF *sub_in; + TXBUF *sub_out; + + tx_log(TX_LOG_INFO, "[LG_OL_0002] 원장 트랜잭션 오케스트레이션 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[LG_OL_0002] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + if (!amount_is_valid(amount) || !date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[LG_OL_0002] 입력 검증 실패 amount=%ld date=%s", + amount, bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + /* 트랜잭션 시작 → 원장 반영 → 후속 서비스 연계 → 커밋 */ + if (tx_begin() != TX_OK) { + tx_return(ctx, TX_FAIL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, LG_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; + + rc = lg_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[LG_OL_0002] 원장반영 실패 rc=%d", rc); + tx_abort(); + tx_return(ctx, rc, ctx->out); + return; + } + + /* 정산 영업일 = 거래일의 다음 영업일 */ + if (date_next_business(bizdate, nextbiz) != 0) { + memcpy(nextbiz, bizdate, 8); + nextbiz[8] = '\0'; + } + + /* 후속 정산집계 서비스 연계 (레지스트리 문자열 디스패치) */ + sub_in = tx_buf_alloc(); + sub_out = tx_buf_alloc(); + if (sub_in && sub_out) { + tx_buf_sets(sub_in, "MERCHID", merch); + tx_buf_sets(sub_in, "BIZDATE", nextbiz); + tx_buf_setlong(sub_in, "AMOUNT", amount); + rc = tx_call("LG_POST", sub_in, sub_out); + if (rc != TX_OK) + tx_log(TX_LOG_WARN, "[LG_OL_0002] 후속연계 경고 rc=%d", rc); + } + tx_buf_free(sub_in); + tx_buf_free(sub_out); + + /* 교차 검증: 당일 합계 재계산 */ + if (lg_rec_sum(bizdate, &daysum) != TX_OK) + daysum = 0; + + tx_commit(); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYSUM", daysum); + tx_log(TX_LOG_INFO, "[LG_OL_0002] 완료 key=%s 당일합계=%ld", key, daysum); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/lg_ol_0003.c b/app/online/lg_ol_0003.c new file mode 100644 index 0000000..2103e7e --- /dev/null +++ b/app/online/lg_ol_0003.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/lg_ol_0003.pgc" +/* @tier easy @module lg @transform ledger-online */ +/* + * lg_ol_0003.pgc - 원장 온라인 서비스 (LG_OL_0003) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 lg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "lg_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/lg_ol_0003.pgc" + + +TX_SERVICE(LG_OL_0003, ctx) +{ + lg_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[LG_OL_0003] 원장 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[LG_OL_0003] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = lg_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[LG_OL_0003] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[LG_OL_0003] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/lg_ol_0003.pgc b/app/online/lg_ol_0003.pgc new file mode 100644 index 0000000..9b2bb26 --- /dev/null +++ b/app/online/lg_ol_0003.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module lg @transform ledger-online */ +/* + * lg_ol_0003.pgc - 원장 온라인 서비스 (LG_OL_0003) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 lg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "lg_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(LG_OL_0003, ctx) +{ + lg_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[LG_OL_0003] 원장 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[LG_OL_0003] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = lg_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[LG_OL_0003] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[LG_OL_0003] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/lg_ol_0004.c b/app/online/lg_ol_0004.c new file mode 100644 index 0000000..7fc0ec7 --- /dev/null +++ b/app/online/lg_ol_0004.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/lg_ol_0004.pgc" +/* @tier easy @module lg @transform ledger-online */ +/* + * lg_ol_0004.pgc - 원장 온라인 서비스 (LG_OL_0004) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 lg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "lg_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/lg_ol_0004.pgc" + + +TX_SERVICE(LG_OL_0004, ctx) +{ + lg_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[LG_OL_0004] 원장 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[LG_OL_0004] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = lg_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[LG_OL_0004] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[LG_OL_0004] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/lg_ol_0004.pgc b/app/online/lg_ol_0004.pgc new file mode 100644 index 0000000..c100331 --- /dev/null +++ b/app/online/lg_ol_0004.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module lg @transform ledger-online */ +/* + * lg_ol_0004.pgc - 원장 온라인 서비스 (LG_OL_0004) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 lg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "lg_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(LG_OL_0004, ctx) +{ + lg_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[LG_OL_0004] 원장 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[LG_OL_0004] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = lg_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[LG_OL_0004] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[LG_OL_0004] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/lg_ol_0005.c b/app/online/lg_ol_0005.c new file mode 100644 index 0000000..703d943 --- /dev/null +++ b/app/online/lg_ol_0005.c @@ -0,0 +1,148 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/lg_ol_0005.pgc" +/* @tier medium @module lg @transform ledger-online */ +/* + * lg_ol_0005.pgc - 원장 온라인 서비스 (LG_OL_0005) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 lg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "lg_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/lg_ol_0005.pgc" + + +TX_SERVICE(LG_OL_0005, ctx) +{ + lg_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[LG_OL_0005] 원장 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[LG_OL_0005] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[LG_OL_0005] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[LG_OL_0005] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, LG_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = lg_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[LG_OL_0005] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = lg_rec_count(bizdate, LG_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[LG_OL_0005] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/lg_ol_0005.pgc b/app/online/lg_ol_0005.pgc new file mode 100644 index 0000000..7f4de59 --- /dev/null +++ b/app/online/lg_ol_0005.pgc @@ -0,0 +1,70 @@ +/* @tier medium @module lg @transform ledger-online */ +/* + * lg_ol_0005.pgc - 원장 온라인 서비스 (LG_OL_0005) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 lg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "lg_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(LG_OL_0005, ctx) +{ + lg_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[LG_OL_0005] 원장 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[LG_OL_0005] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[LG_OL_0005] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[LG_OL_0005] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, LG_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = lg_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[LG_OL_0005] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = lg_rec_count(bizdate, LG_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[LG_OL_0005] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/lg_ol_0006.c b/app/online/lg_ol_0006.c new file mode 100644 index 0000000..02be96b --- /dev/null +++ b/app/online/lg_ol_0006.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/lg_ol_0006.pgc" +/* @tier easy @module lg @transform ledger-online */ +/* + * lg_ol_0006.pgc - 원장 온라인 서비스 (LG_OL_0006) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 lg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "lg_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/lg_ol_0006.pgc" + + +TX_SERVICE(LG_OL_0006, ctx) +{ + lg_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[LG_OL_0006] 원장 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[LG_OL_0006] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = lg_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[LG_OL_0006] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[LG_OL_0006] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/lg_ol_0006.pgc b/app/online/lg_ol_0006.pgc new file mode 100644 index 0000000..e82ebfd --- /dev/null +++ b/app/online/lg_ol_0006.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module lg @transform ledger-online */ +/* + * lg_ol_0006.pgc - 원장 온라인 서비스 (LG_OL_0006) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 lg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "lg_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(LG_OL_0006, ctx) +{ + lg_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[LG_OL_0006] 원장 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[LG_OL_0006] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = lg_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[LG_OL_0006] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[LG_OL_0006] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/lg_ol_0007.c b/app/online/lg_ol_0007.c new file mode 100644 index 0000000..1e5597c --- /dev/null +++ b/app/online/lg_ol_0007.c @@ -0,0 +1,148 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/lg_ol_0007.pgc" +/* @tier medium @module lg @transform ledger-online */ +/* + * lg_ol_0007.pgc - 원장 온라인 서비스 (LG_OL_0007) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 lg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "lg_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/lg_ol_0007.pgc" + + +TX_SERVICE(LG_OL_0007, ctx) +{ + lg_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[LG_OL_0007] 원장 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[LG_OL_0007] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[LG_OL_0007] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[LG_OL_0007] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, LG_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = lg_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[LG_OL_0007] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = lg_rec_count(bizdate, LG_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[LG_OL_0007] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/lg_ol_0007.pgc b/app/online/lg_ol_0007.pgc new file mode 100644 index 0000000..a87742f --- /dev/null +++ b/app/online/lg_ol_0007.pgc @@ -0,0 +1,70 @@ +/* @tier medium @module lg @transform ledger-online */ +/* + * lg_ol_0007.pgc - 원장 온라인 서비스 (LG_OL_0007) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 lg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "lg_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(LG_OL_0007, ctx) +{ + lg_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[LG_OL_0007] 원장 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[LG_OL_0007] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[LG_OL_0007] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[LG_OL_0007] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, LG_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = lg_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[LG_OL_0007] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = lg_rec_count(bizdate, LG_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[LG_OL_0007] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/lg_ol_0008.c b/app/online/lg_ol_0008.c new file mode 100644 index 0000000..684a8ef --- /dev/null +++ b/app/online/lg_ol_0008.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/lg_ol_0008.pgc" +/* @tier easy @module lg @transform ledger-online */ +/* + * lg_ol_0008.pgc - 원장 온라인 서비스 (LG_OL_0008) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 lg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "lg_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/lg_ol_0008.pgc" + + +TX_SERVICE(LG_OL_0008, ctx) +{ + lg_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[LG_OL_0008] 원장 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[LG_OL_0008] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = lg_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[LG_OL_0008] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[LG_OL_0008] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/lg_ol_0008.pgc b/app/online/lg_ol_0008.pgc new file mode 100644 index 0000000..4f5ccc2 --- /dev/null +++ b/app/online/lg_ol_0008.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module lg @transform ledger-online */ +/* + * lg_ol_0008.pgc - 원장 온라인 서비스 (LG_OL_0008) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 lg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "lg_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(LG_OL_0008, ctx) +{ + lg_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[LG_OL_0008] 원장 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[LG_OL_0008] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = lg_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[LG_OL_0008] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[LG_OL_0008] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/lg_ol_0009.c b/app/online/lg_ol_0009.c new file mode 100644 index 0000000..f3bd7a7 --- /dev/null +++ b/app/online/lg_ol_0009.c @@ -0,0 +1,148 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/lg_ol_0009.pgc" +/* @tier medium @module lg @transform ledger-online */ +/* + * lg_ol_0009.pgc - 원장 온라인 서비스 (LG_OL_0009) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 lg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "lg_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/lg_ol_0009.pgc" + + +TX_SERVICE(LG_OL_0009, ctx) +{ + lg_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[LG_OL_0009] 원장 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[LG_OL_0009] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[LG_OL_0009] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[LG_OL_0009] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, LG_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = lg_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[LG_OL_0009] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = lg_rec_count(bizdate, LG_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[LG_OL_0009] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/lg_ol_0009.pgc b/app/online/lg_ol_0009.pgc new file mode 100644 index 0000000..92cc88a --- /dev/null +++ b/app/online/lg_ol_0009.pgc @@ -0,0 +1,70 @@ +/* @tier medium @module lg @transform ledger-online */ +/* + * lg_ol_0009.pgc - 원장 온라인 서비스 (LG_OL_0009) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 lg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "lg_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(LG_OL_0009, ctx) +{ + lg_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[LG_OL_0009] 원장 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[LG_OL_0009] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[LG_OL_0009] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[LG_OL_0009] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, LG_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = lg_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[LG_OL_0009] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = lg_rec_count(bizdate, LG_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[LG_OL_0009] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/lg_ol_0010.c b/app/online/lg_ol_0010.c new file mode 100644 index 0000000..7595edb --- /dev/null +++ b/app/online/lg_ol_0010.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/lg_ol_0010.pgc" +/* @tier easy @module lg @transform ledger-online */ +/* + * lg_ol_0010.pgc - 원장 온라인 서비스 (LG_OL_0010) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 lg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "lg_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/lg_ol_0010.pgc" + + +TX_SERVICE(LG_OL_0010, ctx) +{ + lg_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[LG_OL_0010] 원장 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[LG_OL_0010] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = lg_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[LG_OL_0010] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[LG_OL_0010] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/lg_ol_0010.pgc b/app/online/lg_ol_0010.pgc new file mode 100644 index 0000000..b950dc8 --- /dev/null +++ b/app/online/lg_ol_0010.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module lg @transform ledger-online */ +/* + * lg_ol_0010.pgc - 원장 온라인 서비스 (LG_OL_0010) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 lg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "lg_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(LG_OL_0010, ctx) +{ + lg_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[LG_OL_0010] 원장 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[LG_OL_0010] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = lg_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[LG_OL_0010] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[LG_OL_0010] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/lg_ol_0011.c b/app/online/lg_ol_0011.c new file mode 100644 index 0000000..f4b1a7c --- /dev/null +++ b/app/online/lg_ol_0011.c @@ -0,0 +1,176 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/lg_ol_0011.pgc" +/* @tier hard @module lg @transform ledger-online */ +/* + * lg_ol_0011.pgc - 원장 온라인 서비스 (LG_OL_0011) [tier=hard] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 lg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "lg_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/lg_ol_0011.pgc" + + +TX_SERVICE(LG_OL_0011, ctx) +{ + lg_rec_t rec; + char key[16], merch[16], bizdate[16], nextbiz[9]; + long amount = 0, daysum = 0; + int rc; + TXBUF *sub_in; + TXBUF *sub_out; + + tx_log(TX_LOG_INFO, "[LG_OL_0011] 원장 트랜잭션 오케스트레이션 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[LG_OL_0011] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + if (!amount_is_valid(amount) || !date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[LG_OL_0011] 입력 검증 실패 amount=%ld date=%s", + amount, bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + /* 트랜잭션 시작 → 원장 반영 → 후속 서비스 연계 → 커밋 */ + if (tx_begin() != TX_OK) { + tx_return(ctx, TX_FAIL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, LG_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; + + rc = lg_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[LG_OL_0011] 원장반영 실패 rc=%d", rc); + tx_abort(); + tx_return(ctx, rc, ctx->out); + return; + } + + /* 정산 영업일 = 거래일의 다음 영업일 */ + if (date_next_business(bizdate, nextbiz) != 0) { + memcpy(nextbiz, bizdate, 8); + nextbiz[8] = '\0'; + } + + /* 후속 정산집계 서비스 연계 (레지스트리 문자열 디스패치) */ + sub_in = tx_buf_alloc(); + sub_out = tx_buf_alloc(); + if (sub_in && sub_out) { + tx_buf_sets(sub_in, "MERCHID", merch); + tx_buf_sets(sub_in, "BIZDATE", nextbiz); + tx_buf_setlong(sub_in, "AMOUNT", amount); + rc = tx_call("LG_POST", sub_in, sub_out); + if (rc != TX_OK) + tx_log(TX_LOG_WARN, "[LG_OL_0011] 후속연계 경고 rc=%d", rc); + } + tx_buf_free(sub_in); + tx_buf_free(sub_out); + + /* 교차 검증: 당일 합계 재계산 */ + if (lg_rec_sum(bizdate, &daysum) != TX_OK) + daysum = 0; + + tx_commit(); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYSUM", daysum); + tx_log(TX_LOG_INFO, "[LG_OL_0011] 완료 key=%s 당일합계=%ld", key, daysum); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/lg_ol_0011.pgc b/app/online/lg_ol_0011.pgc new file mode 100644 index 0000000..5e6ff3e --- /dev/null +++ b/app/online/lg_ol_0011.pgc @@ -0,0 +1,98 @@ +/* @tier hard @module lg @transform ledger-online */ +/* + * lg_ol_0011.pgc - 원장 온라인 서비스 (LG_OL_0011) [tier=hard] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 lg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "lg_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(LG_OL_0011, ctx) +{ + lg_rec_t rec; + char key[16], merch[16], bizdate[16], nextbiz[9]; + long amount = 0, daysum = 0; + int rc; + TXBUF *sub_in; + TXBUF *sub_out; + + tx_log(TX_LOG_INFO, "[LG_OL_0011] 원장 트랜잭션 오케스트레이션 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[LG_OL_0011] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + if (!amount_is_valid(amount) || !date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[LG_OL_0011] 입력 검증 실패 amount=%ld date=%s", + amount, bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + /* 트랜잭션 시작 → 원장 반영 → 후속 서비스 연계 → 커밋 */ + if (tx_begin() != TX_OK) { + tx_return(ctx, TX_FAIL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, LG_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; + + rc = lg_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[LG_OL_0011] 원장반영 실패 rc=%d", rc); + tx_abort(); + tx_return(ctx, rc, ctx->out); + return; + } + + /* 정산 영업일 = 거래일의 다음 영업일 */ + if (date_next_business(bizdate, nextbiz) != 0) { + memcpy(nextbiz, bizdate, 8); + nextbiz[8] = '\0'; + } + + /* 후속 정산집계 서비스 연계 (레지스트리 문자열 디스패치) */ + sub_in = tx_buf_alloc(); + sub_out = tx_buf_alloc(); + if (sub_in && sub_out) { + tx_buf_sets(sub_in, "MERCHID", merch); + tx_buf_sets(sub_in, "BIZDATE", nextbiz); + tx_buf_setlong(sub_in, "AMOUNT", amount); + rc = tx_call("LG_POST", sub_in, sub_out); + if (rc != TX_OK) + tx_log(TX_LOG_WARN, "[LG_OL_0011] 후속연계 경고 rc=%d", rc); + } + tx_buf_free(sub_in); + tx_buf_free(sub_out); + + /* 교차 검증: 당일 합계 재계산 */ + if (lg_rec_sum(bizdate, &daysum) != TX_OK) + daysum = 0; + + tx_commit(); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYSUM", daysum); + tx_log(TX_LOG_INFO, "[LG_OL_0011] 완료 key=%s 당일합계=%ld", key, daysum); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/lg_ol_0012.c b/app/online/lg_ol_0012.c new file mode 100644 index 0000000..a4bb194 --- /dev/null +++ b/app/online/lg_ol_0012.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/lg_ol_0012.pgc" +/* @tier easy @module lg @transform ledger-online */ +/* + * lg_ol_0012.pgc - 원장 온라인 서비스 (LG_OL_0012) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 lg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "lg_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/lg_ol_0012.pgc" + + +TX_SERVICE(LG_OL_0012, ctx) +{ + lg_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[LG_OL_0012] 원장 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[LG_OL_0012] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = lg_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[LG_OL_0012] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[LG_OL_0012] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/lg_ol_0012.pgc b/app/online/lg_ol_0012.pgc new file mode 100644 index 0000000..d835094 --- /dev/null +++ b/app/online/lg_ol_0012.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module lg @transform ledger-online */ +/* + * lg_ol_0012.pgc - 원장 온라인 서비스 (LG_OL_0012) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 lg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "lg_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(LG_OL_0012, ctx) +{ + lg_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[LG_OL_0012] 원장 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[LG_OL_0012] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = lg_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[LG_OL_0012] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[LG_OL_0012] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/lg_ol_0013.c b/app/online/lg_ol_0013.c new file mode 100644 index 0000000..3f33340 --- /dev/null +++ b/app/online/lg_ol_0013.c @@ -0,0 +1,176 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/lg_ol_0013.pgc" +/* @tier hard @module lg @transform ledger-online */ +/* + * lg_ol_0013.pgc - 원장 온라인 서비스 (LG_OL_0013) [tier=hard] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 lg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "lg_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/lg_ol_0013.pgc" + + +TX_SERVICE(LG_OL_0013, ctx) +{ + lg_rec_t rec; + char key[16], merch[16], bizdate[16], nextbiz[9]; + long amount = 0, daysum = 0; + int rc; + TXBUF *sub_in; + TXBUF *sub_out; + + tx_log(TX_LOG_INFO, "[LG_OL_0013] 원장 트랜잭션 오케스트레이션 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[LG_OL_0013] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + if (!amount_is_valid(amount) || !date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[LG_OL_0013] 입력 검증 실패 amount=%ld date=%s", + amount, bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + /* 트랜잭션 시작 → 원장 반영 → 후속 서비스 연계 → 커밋 */ + if (tx_begin() != TX_OK) { + tx_return(ctx, TX_FAIL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, LG_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; + + rc = lg_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[LG_OL_0013] 원장반영 실패 rc=%d", rc); + tx_abort(); + tx_return(ctx, rc, ctx->out); + return; + } + + /* 정산 영업일 = 거래일의 다음 영업일 */ + if (date_next_business(bizdate, nextbiz) != 0) { + memcpy(nextbiz, bizdate, 8); + nextbiz[8] = '\0'; + } + + /* 후속 정산집계 서비스 연계 (레지스트리 문자열 디스패치) */ + sub_in = tx_buf_alloc(); + sub_out = tx_buf_alloc(); + if (sub_in && sub_out) { + tx_buf_sets(sub_in, "MERCHID", merch); + tx_buf_sets(sub_in, "BIZDATE", nextbiz); + tx_buf_setlong(sub_in, "AMOUNT", amount); + rc = tx_call("LG_POST", sub_in, sub_out); + if (rc != TX_OK) + tx_log(TX_LOG_WARN, "[LG_OL_0013] 후속연계 경고 rc=%d", rc); + } + tx_buf_free(sub_in); + tx_buf_free(sub_out); + + /* 교차 검증: 당일 합계 재계산 */ + if (lg_rec_sum(bizdate, &daysum) != TX_OK) + daysum = 0; + + tx_commit(); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYSUM", daysum); + tx_log(TX_LOG_INFO, "[LG_OL_0013] 완료 key=%s 당일합계=%ld", key, daysum); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/lg_ol_0013.pgc b/app/online/lg_ol_0013.pgc new file mode 100644 index 0000000..840d978 --- /dev/null +++ b/app/online/lg_ol_0013.pgc @@ -0,0 +1,98 @@ +/* @tier hard @module lg @transform ledger-online */ +/* + * lg_ol_0013.pgc - 원장 온라인 서비스 (LG_OL_0013) [tier=hard] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 lg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "lg_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(LG_OL_0013, ctx) +{ + lg_rec_t rec; + char key[16], merch[16], bizdate[16], nextbiz[9]; + long amount = 0, daysum = 0; + int rc; + TXBUF *sub_in; + TXBUF *sub_out; + + tx_log(TX_LOG_INFO, "[LG_OL_0013] 원장 트랜잭션 오케스트레이션 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[LG_OL_0013] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + if (!amount_is_valid(amount) || !date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[LG_OL_0013] 입력 검증 실패 amount=%ld date=%s", + amount, bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + /* 트랜잭션 시작 → 원장 반영 → 후속 서비스 연계 → 커밋 */ + if (tx_begin() != TX_OK) { + tx_return(ctx, TX_FAIL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, LG_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; + + rc = lg_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[LG_OL_0013] 원장반영 실패 rc=%d", rc); + tx_abort(); + tx_return(ctx, rc, ctx->out); + return; + } + + /* 정산 영업일 = 거래일의 다음 영업일 */ + if (date_next_business(bizdate, nextbiz) != 0) { + memcpy(nextbiz, bizdate, 8); + nextbiz[8] = '\0'; + } + + /* 후속 정산집계 서비스 연계 (레지스트리 문자열 디스패치) */ + sub_in = tx_buf_alloc(); + sub_out = tx_buf_alloc(); + if (sub_in && sub_out) { + tx_buf_sets(sub_in, "MERCHID", merch); + tx_buf_sets(sub_in, "BIZDATE", nextbiz); + tx_buf_setlong(sub_in, "AMOUNT", amount); + rc = tx_call("LG_POST", sub_in, sub_out); + if (rc != TX_OK) + tx_log(TX_LOG_WARN, "[LG_OL_0013] 후속연계 경고 rc=%d", rc); + } + tx_buf_free(sub_in); + tx_buf_free(sub_out); + + /* 교차 검증: 당일 합계 재계산 */ + if (lg_rec_sum(bizdate, &daysum) != TX_OK) + daysum = 0; + + tx_commit(); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYSUM", daysum); + tx_log(TX_LOG_INFO, "[LG_OL_0013] 완료 key=%s 당일합계=%ld", key, daysum); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/lg_ol_0014.c b/app/online/lg_ol_0014.c new file mode 100644 index 0000000..f92cb6e --- /dev/null +++ b/app/online/lg_ol_0014.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/lg_ol_0014.pgc" +/* @tier easy @module lg @transform ledger-online */ +/* + * lg_ol_0014.pgc - 원장 온라인 서비스 (LG_OL_0014) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 lg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "lg_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/lg_ol_0014.pgc" + + +TX_SERVICE(LG_OL_0014, ctx) +{ + lg_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[LG_OL_0014] 원장 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[LG_OL_0014] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = lg_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[LG_OL_0014] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[LG_OL_0014] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/lg_ol_0014.pgc b/app/online/lg_ol_0014.pgc new file mode 100644 index 0000000..1f4d670 --- /dev/null +++ b/app/online/lg_ol_0014.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module lg @transform ledger-online */ +/* + * lg_ol_0014.pgc - 원장 온라인 서비스 (LG_OL_0014) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 lg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "lg_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(LG_OL_0014, ctx) +{ + lg_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[LG_OL_0014] 원장 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[LG_OL_0014] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = lg_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[LG_OL_0014] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[LG_OL_0014] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/lg_ol_0015.c b/app/online/lg_ol_0015.c new file mode 100644 index 0000000..ee7ecc0 --- /dev/null +++ b/app/online/lg_ol_0015.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/lg_ol_0015.pgc" +/* @tier easy @module lg @transform ledger-online */ +/* + * lg_ol_0015.pgc - 원장 온라인 서비스 (LG_OL_0015) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 lg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "lg_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/lg_ol_0015.pgc" + + +TX_SERVICE(LG_OL_0015, ctx) +{ + lg_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[LG_OL_0015] 원장 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[LG_OL_0015] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = lg_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[LG_OL_0015] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[LG_OL_0015] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/lg_ol_0015.pgc b/app/online/lg_ol_0015.pgc new file mode 100644 index 0000000..cd6e3aa --- /dev/null +++ b/app/online/lg_ol_0015.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module lg @transform ledger-online */ +/* + * lg_ol_0015.pgc - 원장 온라인 서비스 (LG_OL_0015) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 lg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "lg_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(LG_OL_0015, ctx) +{ + lg_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[LG_OL_0015] 원장 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[LG_OL_0015] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = lg_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[LG_OL_0015] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[LG_OL_0015] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/lg_ol_0016.c b/app/online/lg_ol_0016.c new file mode 100644 index 0000000..ea48eb1 --- /dev/null +++ b/app/online/lg_ol_0016.c @@ -0,0 +1,148 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/lg_ol_0016.pgc" +/* @tier medium @module lg @transform ledger-online */ +/* + * lg_ol_0016.pgc - 원장 온라인 서비스 (LG_OL_0016) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 lg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "lg_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/lg_ol_0016.pgc" + + +TX_SERVICE(LG_OL_0016, ctx) +{ + lg_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[LG_OL_0016] 원장 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[LG_OL_0016] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[LG_OL_0016] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[LG_OL_0016] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, LG_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = lg_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[LG_OL_0016] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = lg_rec_count(bizdate, LG_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[LG_OL_0016] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/lg_ol_0016.pgc b/app/online/lg_ol_0016.pgc new file mode 100644 index 0000000..bba9657 --- /dev/null +++ b/app/online/lg_ol_0016.pgc @@ -0,0 +1,70 @@ +/* @tier medium @module lg @transform ledger-online */ +/* + * lg_ol_0016.pgc - 원장 온라인 서비스 (LG_OL_0016) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 lg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "lg_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(LG_OL_0016, ctx) +{ + lg_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[LG_OL_0016] 원장 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[LG_OL_0016] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[LG_OL_0016] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[LG_OL_0016] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, LG_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = lg_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[LG_OL_0016] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = lg_rec_count(bizdate, LG_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[LG_OL_0016] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/lg_ol_0017.c b/app/online/lg_ol_0017.c new file mode 100644 index 0000000..67f22d2 --- /dev/null +++ b/app/online/lg_ol_0017.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/lg_ol_0017.pgc" +/* @tier easy @module lg @transform ledger-online */ +/* + * lg_ol_0017.pgc - 원장 온라인 서비스 (LG_OL_0017) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 lg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "lg_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/lg_ol_0017.pgc" + + +TX_SERVICE(LG_OL_0017, ctx) +{ + lg_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[LG_OL_0017] 원장 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[LG_OL_0017] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = lg_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[LG_OL_0017] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[LG_OL_0017] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/lg_ol_0017.pgc b/app/online/lg_ol_0017.pgc new file mode 100644 index 0000000..97264f1 --- /dev/null +++ b/app/online/lg_ol_0017.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module lg @transform ledger-online */ +/* + * lg_ol_0017.pgc - 원장 온라인 서비스 (LG_OL_0017) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 lg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "lg_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(LG_OL_0017, ctx) +{ + lg_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[LG_OL_0017] 원장 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[LG_OL_0017] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = lg_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[LG_OL_0017] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[LG_OL_0017] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/lg_ol_0018.c b/app/online/lg_ol_0018.c new file mode 100644 index 0000000..ab47261 --- /dev/null +++ b/app/online/lg_ol_0018.c @@ -0,0 +1,148 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/lg_ol_0018.pgc" +/* @tier medium @module lg @transform ledger-online */ +/* + * lg_ol_0018.pgc - 원장 온라인 서비스 (LG_OL_0018) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 lg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "lg_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/lg_ol_0018.pgc" + + +TX_SERVICE(LG_OL_0018, ctx) +{ + lg_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[LG_OL_0018] 원장 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[LG_OL_0018] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[LG_OL_0018] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[LG_OL_0018] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, LG_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = lg_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[LG_OL_0018] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = lg_rec_count(bizdate, LG_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[LG_OL_0018] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/lg_ol_0018.pgc b/app/online/lg_ol_0018.pgc new file mode 100644 index 0000000..7918cb5 --- /dev/null +++ b/app/online/lg_ol_0018.pgc @@ -0,0 +1,70 @@ +/* @tier medium @module lg @transform ledger-online */ +/* + * lg_ol_0018.pgc - 원장 온라인 서비스 (LG_OL_0018) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 lg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "lg_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(LG_OL_0018, ctx) +{ + lg_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[LG_OL_0018] 원장 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[LG_OL_0018] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[LG_OL_0018] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[LG_OL_0018] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, LG_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = lg_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[LG_OL_0018] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = lg_rec_count(bizdate, LG_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[LG_OL_0018] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/lg_ol_0019.c b/app/online/lg_ol_0019.c new file mode 100644 index 0000000..870e665 --- /dev/null +++ b/app/online/lg_ol_0019.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/lg_ol_0019.pgc" +/* @tier easy @module lg @transform ledger-online */ +/* + * lg_ol_0019.pgc - 원장 온라인 서비스 (LG_OL_0019) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 lg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "lg_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/lg_ol_0019.pgc" + + +TX_SERVICE(LG_OL_0019, ctx) +{ + lg_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[LG_OL_0019] 원장 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[LG_OL_0019] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = lg_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[LG_OL_0019] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[LG_OL_0019] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/lg_ol_0019.pgc b/app/online/lg_ol_0019.pgc new file mode 100644 index 0000000..09cc963 --- /dev/null +++ b/app/online/lg_ol_0019.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module lg @transform ledger-online */ +/* + * lg_ol_0019.pgc - 원장 온라인 서비스 (LG_OL_0019) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 lg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "lg_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(LG_OL_0019, ctx) +{ + lg_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[LG_OL_0019] 원장 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[LG_OL_0019] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = lg_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[LG_OL_0019] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[LG_OL_0019] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/lg_ol_0020.c b/app/online/lg_ol_0020.c new file mode 100644 index 0000000..19ec808 --- /dev/null +++ b/app/online/lg_ol_0020.c @@ -0,0 +1,148 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/lg_ol_0020.pgc" +/* @tier medium @module lg @transform ledger-online */ +/* + * lg_ol_0020.pgc - 원장 온라인 서비스 (LG_OL_0020) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 lg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "lg_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/lg_ol_0020.pgc" + + +TX_SERVICE(LG_OL_0020, ctx) +{ + lg_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[LG_OL_0020] 원장 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[LG_OL_0020] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[LG_OL_0020] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[LG_OL_0020] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, LG_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = lg_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[LG_OL_0020] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = lg_rec_count(bizdate, LG_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[LG_OL_0020] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/lg_ol_0020.pgc b/app/online/lg_ol_0020.pgc new file mode 100644 index 0000000..3c0a915 --- /dev/null +++ b/app/online/lg_ol_0020.pgc @@ -0,0 +1,70 @@ +/* @tier medium @module lg @transform ledger-online */ +/* + * lg_ol_0020.pgc - 원장 온라인 서비스 (LG_OL_0020) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 lg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "lg_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(LG_OL_0020, ctx) +{ + lg_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[LG_OL_0020] 원장 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[LG_OL_0020] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[LG_OL_0020] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[LG_OL_0020] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, LG_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = lg_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[LG_OL_0020] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = lg_rec_count(bizdate, LG_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[LG_OL_0020] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/lg_ol_0021.c b/app/online/lg_ol_0021.c new file mode 100644 index 0000000..99e14e3 --- /dev/null +++ b/app/online/lg_ol_0021.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/lg_ol_0021.pgc" +/* @tier easy @module lg @transform ledger-online */ +/* + * lg_ol_0021.pgc - 원장 온라인 서비스 (LG_OL_0021) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 lg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "lg_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/lg_ol_0021.pgc" + + +TX_SERVICE(LG_OL_0021, ctx) +{ + lg_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[LG_OL_0021] 원장 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[LG_OL_0021] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = lg_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[LG_OL_0021] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[LG_OL_0021] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/lg_ol_0021.pgc b/app/online/lg_ol_0021.pgc new file mode 100644 index 0000000..4cd4b4e --- /dev/null +++ b/app/online/lg_ol_0021.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module lg @transform ledger-online */ +/* + * lg_ol_0021.pgc - 원장 온라인 서비스 (LG_OL_0021) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 lg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "lg_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(LG_OL_0021, ctx) +{ + lg_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[LG_OL_0021] 원장 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[LG_OL_0021] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = lg_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[LG_OL_0021] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[LG_OL_0021] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/lg_ol_0022.c b/app/online/lg_ol_0022.c new file mode 100644 index 0000000..2023f88 --- /dev/null +++ b/app/online/lg_ol_0022.c @@ -0,0 +1,176 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/lg_ol_0022.pgc" +/* @tier hard @module lg @transform ledger-online */ +/* + * lg_ol_0022.pgc - 원장 온라인 서비스 (LG_OL_0022) [tier=hard] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 lg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "lg_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/lg_ol_0022.pgc" + + +TX_SERVICE(LG_OL_0022, ctx) +{ + lg_rec_t rec; + char key[16], merch[16], bizdate[16], nextbiz[9]; + long amount = 0, daysum = 0; + int rc; + TXBUF *sub_in; + TXBUF *sub_out; + + tx_log(TX_LOG_INFO, "[LG_OL_0022] 원장 트랜잭션 오케스트레이션 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[LG_OL_0022] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + if (!amount_is_valid(amount) || !date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[LG_OL_0022] 입력 검증 실패 amount=%ld date=%s", + amount, bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + /* 트랜잭션 시작 → 원장 반영 → 후속 서비스 연계 → 커밋 */ + if (tx_begin() != TX_OK) { + tx_return(ctx, TX_FAIL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, LG_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; + + rc = lg_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[LG_OL_0022] 원장반영 실패 rc=%d", rc); + tx_abort(); + tx_return(ctx, rc, ctx->out); + return; + } + + /* 정산 영업일 = 거래일의 다음 영업일 */ + if (date_next_business(bizdate, nextbiz) != 0) { + memcpy(nextbiz, bizdate, 8); + nextbiz[8] = '\0'; + } + + /* 후속 정산집계 서비스 연계 (레지스트리 문자열 디스패치) */ + sub_in = tx_buf_alloc(); + sub_out = tx_buf_alloc(); + if (sub_in && sub_out) { + tx_buf_sets(sub_in, "MERCHID", merch); + tx_buf_sets(sub_in, "BIZDATE", nextbiz); + tx_buf_setlong(sub_in, "AMOUNT", amount); + rc = tx_call("LG_POST", sub_in, sub_out); + if (rc != TX_OK) + tx_log(TX_LOG_WARN, "[LG_OL_0022] 후속연계 경고 rc=%d", rc); + } + tx_buf_free(sub_in); + tx_buf_free(sub_out); + + /* 교차 검증: 당일 합계 재계산 */ + if (lg_rec_sum(bizdate, &daysum) != TX_OK) + daysum = 0; + + tx_commit(); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYSUM", daysum); + tx_log(TX_LOG_INFO, "[LG_OL_0022] 완료 key=%s 당일합계=%ld", key, daysum); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/lg_ol_0022.pgc b/app/online/lg_ol_0022.pgc new file mode 100644 index 0000000..f761256 --- /dev/null +++ b/app/online/lg_ol_0022.pgc @@ -0,0 +1,98 @@ +/* @tier hard @module lg @transform ledger-online */ +/* + * lg_ol_0022.pgc - 원장 온라인 서비스 (LG_OL_0022) [tier=hard] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 lg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "lg_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(LG_OL_0022, ctx) +{ + lg_rec_t rec; + char key[16], merch[16], bizdate[16], nextbiz[9]; + long amount = 0, daysum = 0; + int rc; + TXBUF *sub_in; + TXBUF *sub_out; + + tx_log(TX_LOG_INFO, "[LG_OL_0022] 원장 트랜잭션 오케스트레이션 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[LG_OL_0022] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + if (!amount_is_valid(amount) || !date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[LG_OL_0022] 입력 검증 실패 amount=%ld date=%s", + amount, bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + /* 트랜잭션 시작 → 원장 반영 → 후속 서비스 연계 → 커밋 */ + if (tx_begin() != TX_OK) { + tx_return(ctx, TX_FAIL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, LG_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; + + rc = lg_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[LG_OL_0022] 원장반영 실패 rc=%d", rc); + tx_abort(); + tx_return(ctx, rc, ctx->out); + return; + } + + /* 정산 영업일 = 거래일의 다음 영업일 */ + if (date_next_business(bizdate, nextbiz) != 0) { + memcpy(nextbiz, bizdate, 8); + nextbiz[8] = '\0'; + } + + /* 후속 정산집계 서비스 연계 (레지스트리 문자열 디스패치) */ + sub_in = tx_buf_alloc(); + sub_out = tx_buf_alloc(); + if (sub_in && sub_out) { + tx_buf_sets(sub_in, "MERCHID", merch); + tx_buf_sets(sub_in, "BIZDATE", nextbiz); + tx_buf_setlong(sub_in, "AMOUNT", amount); + rc = tx_call("LG_POST", sub_in, sub_out); + if (rc != TX_OK) + tx_log(TX_LOG_WARN, "[LG_OL_0022] 후속연계 경고 rc=%d", rc); + } + tx_buf_free(sub_in); + tx_buf_free(sub_out); + + /* 교차 검증: 당일 합계 재계산 */ + if (lg_rec_sum(bizdate, &daysum) != TX_OK) + daysum = 0; + + tx_commit(); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYSUM", daysum); + tx_log(TX_LOG_INFO, "[LG_OL_0022] 완료 key=%s 당일합계=%ld", key, daysum); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/lg_ol_0023.c b/app/online/lg_ol_0023.c new file mode 100644 index 0000000..c7ef9d1 --- /dev/null +++ b/app/online/lg_ol_0023.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/lg_ol_0023.pgc" +/* @tier easy @module lg @transform ledger-online */ +/* + * lg_ol_0023.pgc - 원장 온라인 서비스 (LG_OL_0023) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 lg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "lg_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/lg_ol_0023.pgc" + + +TX_SERVICE(LG_OL_0023, ctx) +{ + lg_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[LG_OL_0023] 원장 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[LG_OL_0023] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = lg_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[LG_OL_0023] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[LG_OL_0023] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/lg_ol_0023.pgc b/app/online/lg_ol_0023.pgc new file mode 100644 index 0000000..87e9458 --- /dev/null +++ b/app/online/lg_ol_0023.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module lg @transform ledger-online */ +/* + * lg_ol_0023.pgc - 원장 온라인 서비스 (LG_OL_0023) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 lg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "lg_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(LG_OL_0023, ctx) +{ + lg_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[LG_OL_0023] 원장 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[LG_OL_0023] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = lg_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[LG_OL_0023] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[LG_OL_0023] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/lg_ol_0024.c b/app/online/lg_ol_0024.c new file mode 100644 index 0000000..c17a80d --- /dev/null +++ b/app/online/lg_ol_0024.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/lg_ol_0024.pgc" +/* @tier easy @module lg @transform ledger-online */ +/* + * lg_ol_0024.pgc - 원장 온라인 서비스 (LG_OL_0024) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 lg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "lg_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/lg_ol_0024.pgc" + + +TX_SERVICE(LG_OL_0024, ctx) +{ + lg_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[LG_OL_0024] 원장 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[LG_OL_0024] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = lg_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[LG_OL_0024] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[LG_OL_0024] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/lg_ol_0024.pgc b/app/online/lg_ol_0024.pgc new file mode 100644 index 0000000..b3c6bc5 --- /dev/null +++ b/app/online/lg_ol_0024.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module lg @transform ledger-online */ +/* + * lg_ol_0024.pgc - 원장 온라인 서비스 (LG_OL_0024) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 lg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "lg_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(LG_OL_0024, ctx) +{ + lg_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[LG_OL_0024] 원장 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[LG_OL_0024] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = lg_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[LG_OL_0024] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[LG_OL_0024] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/lg_ol_0025.c b/app/online/lg_ol_0025.c new file mode 100644 index 0000000..e5f669c --- /dev/null +++ b/app/online/lg_ol_0025.c @@ -0,0 +1,148 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/lg_ol_0025.pgc" +/* @tier medium @module lg @transform ledger-online */ +/* + * lg_ol_0025.pgc - 원장 온라인 서비스 (LG_OL_0025) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 lg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "lg_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/lg_ol_0025.pgc" + + +TX_SERVICE(LG_OL_0025, ctx) +{ + lg_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[LG_OL_0025] 원장 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[LG_OL_0025] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[LG_OL_0025] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[LG_OL_0025] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, LG_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = lg_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[LG_OL_0025] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = lg_rec_count(bizdate, LG_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[LG_OL_0025] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/lg_ol_0025.pgc b/app/online/lg_ol_0025.pgc new file mode 100644 index 0000000..e7311c7 --- /dev/null +++ b/app/online/lg_ol_0025.pgc @@ -0,0 +1,70 @@ +/* @tier medium @module lg @transform ledger-online */ +/* + * lg_ol_0025.pgc - 원장 온라인 서비스 (LG_OL_0025) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 lg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "lg_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(LG_OL_0025, ctx) +{ + lg_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[LG_OL_0025] 원장 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[LG_OL_0025] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[LG_OL_0025] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[LG_OL_0025] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, LG_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = lg_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[LG_OL_0025] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = lg_rec_count(bizdate, LG_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[LG_OL_0025] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/lg_ol_0026.c b/app/online/lg_ol_0026.c new file mode 100644 index 0000000..331aa5c --- /dev/null +++ b/app/online/lg_ol_0026.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/lg_ol_0026.pgc" +/* @tier easy @module lg @transform ledger-online */ +/* + * lg_ol_0026.pgc - 원장 온라인 서비스 (LG_OL_0026) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 lg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "lg_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/lg_ol_0026.pgc" + + +TX_SERVICE(LG_OL_0026, ctx) +{ + lg_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[LG_OL_0026] 원장 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[LG_OL_0026] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = lg_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[LG_OL_0026] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[LG_OL_0026] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/lg_ol_0026.pgc b/app/online/lg_ol_0026.pgc new file mode 100644 index 0000000..2a4a9e0 --- /dev/null +++ b/app/online/lg_ol_0026.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module lg @transform ledger-online */ +/* + * lg_ol_0026.pgc - 원장 온라인 서비스 (LG_OL_0026) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 lg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "lg_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(LG_OL_0026, ctx) +{ + lg_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[LG_OL_0026] 원장 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[LG_OL_0026] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = lg_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[LG_OL_0026] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[LG_OL_0026] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/lg_ol_0027.c b/app/online/lg_ol_0027.c new file mode 100644 index 0000000..6af4894 --- /dev/null +++ b/app/online/lg_ol_0027.c @@ -0,0 +1,148 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/lg_ol_0027.pgc" +/* @tier medium @module lg @transform ledger-online */ +/* + * lg_ol_0027.pgc - 원장 온라인 서비스 (LG_OL_0027) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 lg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "lg_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/lg_ol_0027.pgc" + + +TX_SERVICE(LG_OL_0027, ctx) +{ + lg_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[LG_OL_0027] 원장 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[LG_OL_0027] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[LG_OL_0027] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[LG_OL_0027] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, LG_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = lg_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[LG_OL_0027] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = lg_rec_count(bizdate, LG_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[LG_OL_0027] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/lg_ol_0027.pgc b/app/online/lg_ol_0027.pgc new file mode 100644 index 0000000..4665601 --- /dev/null +++ b/app/online/lg_ol_0027.pgc @@ -0,0 +1,70 @@ +/* @tier medium @module lg @transform ledger-online */ +/* + * lg_ol_0027.pgc - 원장 온라인 서비스 (LG_OL_0027) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 lg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "lg_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(LG_OL_0027, ctx) +{ + lg_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[LG_OL_0027] 원장 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[LG_OL_0027] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[LG_OL_0027] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[LG_OL_0027] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, LG_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = lg_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[LG_OL_0027] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = lg_rec_count(bizdate, LG_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[LG_OL_0027] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/lg_ol_0028.c b/app/online/lg_ol_0028.c new file mode 100644 index 0000000..2c7b8a4 --- /dev/null +++ b/app/online/lg_ol_0028.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/lg_ol_0028.pgc" +/* @tier easy @module lg @transform ledger-online */ +/* + * lg_ol_0028.pgc - 원장 온라인 서비스 (LG_OL_0028) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 lg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "lg_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/lg_ol_0028.pgc" + + +TX_SERVICE(LG_OL_0028, ctx) +{ + lg_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[LG_OL_0028] 원장 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[LG_OL_0028] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = lg_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[LG_OL_0028] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[LG_OL_0028] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/lg_ol_0028.pgc b/app/online/lg_ol_0028.pgc new file mode 100644 index 0000000..4023825 --- /dev/null +++ b/app/online/lg_ol_0028.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module lg @transform ledger-online */ +/* + * lg_ol_0028.pgc - 원장 온라인 서비스 (LG_OL_0028) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 lg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "lg_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(LG_OL_0028, ctx) +{ + lg_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[LG_OL_0028] 원장 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[LG_OL_0028] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = lg_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[LG_OL_0028] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[LG_OL_0028] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/lg_ol_0029.c b/app/online/lg_ol_0029.c new file mode 100644 index 0000000..87fbfcc --- /dev/null +++ b/app/online/lg_ol_0029.c @@ -0,0 +1,148 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/lg_ol_0029.pgc" +/* @tier medium @module lg @transform ledger-online */ +/* + * lg_ol_0029.pgc - 원장 온라인 서비스 (LG_OL_0029) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 lg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "lg_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/lg_ol_0029.pgc" + + +TX_SERVICE(LG_OL_0029, ctx) +{ + lg_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[LG_OL_0029] 원장 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[LG_OL_0029] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[LG_OL_0029] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[LG_OL_0029] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, LG_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = lg_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[LG_OL_0029] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = lg_rec_count(bizdate, LG_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[LG_OL_0029] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/lg_ol_0029.pgc b/app/online/lg_ol_0029.pgc new file mode 100644 index 0000000..b403b9d --- /dev/null +++ b/app/online/lg_ol_0029.pgc @@ -0,0 +1,70 @@ +/* @tier medium @module lg @transform ledger-online */ +/* + * lg_ol_0029.pgc - 원장 온라인 서비스 (LG_OL_0029) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 lg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "lg_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(LG_OL_0029, ctx) +{ + lg_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[LG_OL_0029] 원장 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[LG_OL_0029] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[LG_OL_0029] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[LG_OL_0029] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, LG_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = lg_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[LG_OL_0029] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = lg_rec_count(bizdate, LG_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[LG_OL_0029] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/lg_ol_0030.c b/app/online/lg_ol_0030.c new file mode 100644 index 0000000..984b414 --- /dev/null +++ b/app/online/lg_ol_0030.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/lg_ol_0030.pgc" +/* @tier easy @module lg @transform ledger-online */ +/* + * lg_ol_0030.pgc - 원장 온라인 서비스 (LG_OL_0030) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 lg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "lg_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/lg_ol_0030.pgc" + + +TX_SERVICE(LG_OL_0030, ctx) +{ + lg_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[LG_OL_0030] 원장 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[LG_OL_0030] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = lg_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[LG_OL_0030] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[LG_OL_0030] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/lg_ol_0030.pgc b/app/online/lg_ol_0030.pgc new file mode 100644 index 0000000..d5fbab3 --- /dev/null +++ b/app/online/lg_ol_0030.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module lg @transform ledger-online */ +/* + * lg_ol_0030.pgc - 원장 온라인 서비스 (LG_OL_0030) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 lg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "lg_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(LG_OL_0030, ctx) +{ + lg_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[LG_OL_0030] 원장 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[LG_OL_0030] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = lg_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[LG_OL_0030] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[LG_OL_0030] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/lg_ol_0031.c b/app/online/lg_ol_0031.c new file mode 100644 index 0000000..4a0263a --- /dev/null +++ b/app/online/lg_ol_0031.c @@ -0,0 +1,176 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/lg_ol_0031.pgc" +/* @tier hard @module lg @transform ledger-online */ +/* + * lg_ol_0031.pgc - 원장 온라인 서비스 (LG_OL_0031) [tier=hard] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 lg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "lg_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/lg_ol_0031.pgc" + + +TX_SERVICE(LG_OL_0031, ctx) +{ + lg_rec_t rec; + char key[16], merch[16], bizdate[16], nextbiz[9]; + long amount = 0, daysum = 0; + int rc; + TXBUF *sub_in; + TXBUF *sub_out; + + tx_log(TX_LOG_INFO, "[LG_OL_0031] 원장 트랜잭션 오케스트레이션 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[LG_OL_0031] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + if (!amount_is_valid(amount) || !date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[LG_OL_0031] 입력 검증 실패 amount=%ld date=%s", + amount, bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + /* 트랜잭션 시작 → 원장 반영 → 후속 서비스 연계 → 커밋 */ + if (tx_begin() != TX_OK) { + tx_return(ctx, TX_FAIL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, LG_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; + + rc = lg_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[LG_OL_0031] 원장반영 실패 rc=%d", rc); + tx_abort(); + tx_return(ctx, rc, ctx->out); + return; + } + + /* 정산 영업일 = 거래일의 다음 영업일 */ + if (date_next_business(bizdate, nextbiz) != 0) { + memcpy(nextbiz, bizdate, 8); + nextbiz[8] = '\0'; + } + + /* 후속 정산집계 서비스 연계 (레지스트리 문자열 디스패치) */ + sub_in = tx_buf_alloc(); + sub_out = tx_buf_alloc(); + if (sub_in && sub_out) { + tx_buf_sets(sub_in, "MERCHID", merch); + tx_buf_sets(sub_in, "BIZDATE", nextbiz); + tx_buf_setlong(sub_in, "AMOUNT", amount); + rc = tx_call("LG_POST", sub_in, sub_out); + if (rc != TX_OK) + tx_log(TX_LOG_WARN, "[LG_OL_0031] 후속연계 경고 rc=%d", rc); + } + tx_buf_free(sub_in); + tx_buf_free(sub_out); + + /* 교차 검증: 당일 합계 재계산 */ + if (lg_rec_sum(bizdate, &daysum) != TX_OK) + daysum = 0; + + tx_commit(); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYSUM", daysum); + tx_log(TX_LOG_INFO, "[LG_OL_0031] 완료 key=%s 당일합계=%ld", key, daysum); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/lg_ol_0031.pgc b/app/online/lg_ol_0031.pgc new file mode 100644 index 0000000..cc74a22 --- /dev/null +++ b/app/online/lg_ol_0031.pgc @@ -0,0 +1,98 @@ +/* @tier hard @module lg @transform ledger-online */ +/* + * lg_ol_0031.pgc - 원장 온라인 서비스 (LG_OL_0031) [tier=hard] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 lg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "lg_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(LG_OL_0031, ctx) +{ + lg_rec_t rec; + char key[16], merch[16], bizdate[16], nextbiz[9]; + long amount = 0, daysum = 0; + int rc; + TXBUF *sub_in; + TXBUF *sub_out; + + tx_log(TX_LOG_INFO, "[LG_OL_0031] 원장 트랜잭션 오케스트레이션 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[LG_OL_0031] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + if (!amount_is_valid(amount) || !date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[LG_OL_0031] 입력 검증 실패 amount=%ld date=%s", + amount, bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + /* 트랜잭션 시작 → 원장 반영 → 후속 서비스 연계 → 커밋 */ + if (tx_begin() != TX_OK) { + tx_return(ctx, TX_FAIL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, LG_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; + + rc = lg_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[LG_OL_0031] 원장반영 실패 rc=%d", rc); + tx_abort(); + tx_return(ctx, rc, ctx->out); + return; + } + + /* 정산 영업일 = 거래일의 다음 영업일 */ + if (date_next_business(bizdate, nextbiz) != 0) { + memcpy(nextbiz, bizdate, 8); + nextbiz[8] = '\0'; + } + + /* 후속 정산집계 서비스 연계 (레지스트리 문자열 디스패치) */ + sub_in = tx_buf_alloc(); + sub_out = tx_buf_alloc(); + if (sub_in && sub_out) { + tx_buf_sets(sub_in, "MERCHID", merch); + tx_buf_sets(sub_in, "BIZDATE", nextbiz); + tx_buf_setlong(sub_in, "AMOUNT", amount); + rc = tx_call("LG_POST", sub_in, sub_out); + if (rc != TX_OK) + tx_log(TX_LOG_WARN, "[LG_OL_0031] 후속연계 경고 rc=%d", rc); + } + tx_buf_free(sub_in); + tx_buf_free(sub_out); + + /* 교차 검증: 당일 합계 재계산 */ + if (lg_rec_sum(bizdate, &daysum) != TX_OK) + daysum = 0; + + tx_commit(); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYSUM", daysum); + tx_log(TX_LOG_INFO, "[LG_OL_0031] 완료 key=%s 당일합계=%ld", key, daysum); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/lg_ol_0032.c b/app/online/lg_ol_0032.c new file mode 100644 index 0000000..7904da3 --- /dev/null +++ b/app/online/lg_ol_0032.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/lg_ol_0032.pgc" +/* @tier easy @module lg @transform ledger-online */ +/* + * lg_ol_0032.pgc - 원장 온라인 서비스 (LG_OL_0032) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 lg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "lg_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/lg_ol_0032.pgc" + + +TX_SERVICE(LG_OL_0032, ctx) +{ + lg_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[LG_OL_0032] 원장 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[LG_OL_0032] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = lg_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[LG_OL_0032] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[LG_OL_0032] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/lg_ol_0032.pgc b/app/online/lg_ol_0032.pgc new file mode 100644 index 0000000..27d0af1 --- /dev/null +++ b/app/online/lg_ol_0032.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module lg @transform ledger-online */ +/* + * lg_ol_0032.pgc - 원장 온라인 서비스 (LG_OL_0032) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 lg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "lg_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(LG_OL_0032, ctx) +{ + lg_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[LG_OL_0032] 원장 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[LG_OL_0032] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = lg_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[LG_OL_0032] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[LG_OL_0032] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mg_ol_0001.c b/app/online/mg_ol_0001.c new file mode 100644 index 0000000..3a55ad9 --- /dev/null +++ b/app/online/mg_ol_0001.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/mg_ol_0001.pgc" +/* @tier easy @module mg @transform msg-gateway-online */ +/* + * mg_ol_0001.pgc - 전문게이트웨이 온라인 서비스 (MG_OL_0001) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mg_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/mg_ol_0001.pgc" + + +TX_SERVICE(MG_OL_0001, ctx) +{ + mg_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[MG_OL_0001] 전문게이트웨이 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MG_OL_0001] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = mg_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[MG_OL_0001] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[MG_OL_0001] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mg_ol_0001.pgc b/app/online/mg_ol_0001.pgc new file mode 100644 index 0000000..85449ba --- /dev/null +++ b/app/online/mg_ol_0001.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module mg @transform msg-gateway-online */ +/* + * mg_ol_0001.pgc - 전문게이트웨이 온라인 서비스 (MG_OL_0001) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mg_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(MG_OL_0001, ctx) +{ + mg_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[MG_OL_0001] 전문게이트웨이 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MG_OL_0001] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = mg_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[MG_OL_0001] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[MG_OL_0001] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mg_ol_0002.c b/app/online/mg_ol_0002.c new file mode 100644 index 0000000..4abc987 --- /dev/null +++ b/app/online/mg_ol_0002.c @@ -0,0 +1,148 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/mg_ol_0002.pgc" +/* @tier medium @module mg @transform msg-gateway-online */ +/* + * mg_ol_0002.pgc - 전문게이트웨이 온라인 서비스 (MG_OL_0002) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mg_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/mg_ol_0002.pgc" + + +TX_SERVICE(MG_OL_0002, ctx) +{ + mg_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[MG_OL_0002] 전문게이트웨이 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MG_OL_0002] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[MG_OL_0002] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[MG_OL_0002] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, MG_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = mg_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[MG_OL_0002] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = mg_rec_count(bizdate, MG_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[MG_OL_0002] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mg_ol_0002.pgc b/app/online/mg_ol_0002.pgc new file mode 100644 index 0000000..a9cfda7 --- /dev/null +++ b/app/online/mg_ol_0002.pgc @@ -0,0 +1,70 @@ +/* @tier medium @module mg @transform msg-gateway-online */ +/* + * mg_ol_0002.pgc - 전문게이트웨이 온라인 서비스 (MG_OL_0002) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mg_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(MG_OL_0002, ctx) +{ + mg_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[MG_OL_0002] 전문게이트웨이 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MG_OL_0002] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[MG_OL_0002] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[MG_OL_0002] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, MG_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = mg_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[MG_OL_0002] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = mg_rec_count(bizdate, MG_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[MG_OL_0002] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mg_ol_0003.c b/app/online/mg_ol_0003.c new file mode 100644 index 0000000..a822efe --- /dev/null +++ b/app/online/mg_ol_0003.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/mg_ol_0003.pgc" +/* @tier easy @module mg @transform msg-gateway-online */ +/* + * mg_ol_0003.pgc - 전문게이트웨이 온라인 서비스 (MG_OL_0003) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mg_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/mg_ol_0003.pgc" + + +TX_SERVICE(MG_OL_0003, ctx) +{ + mg_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[MG_OL_0003] 전문게이트웨이 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MG_OL_0003] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = mg_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[MG_OL_0003] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[MG_OL_0003] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mg_ol_0003.pgc b/app/online/mg_ol_0003.pgc new file mode 100644 index 0000000..7aa8b1f --- /dev/null +++ b/app/online/mg_ol_0003.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module mg @transform msg-gateway-online */ +/* + * mg_ol_0003.pgc - 전문게이트웨이 온라인 서비스 (MG_OL_0003) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mg_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(MG_OL_0003, ctx) +{ + mg_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[MG_OL_0003] 전문게이트웨이 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MG_OL_0003] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = mg_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[MG_OL_0003] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[MG_OL_0003] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mg_ol_0004.c b/app/online/mg_ol_0004.c new file mode 100644 index 0000000..1ce038d --- /dev/null +++ b/app/online/mg_ol_0004.c @@ -0,0 +1,148 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/mg_ol_0004.pgc" +/* @tier medium @module mg @transform msg-gateway-online */ +/* + * mg_ol_0004.pgc - 전문게이트웨이 온라인 서비스 (MG_OL_0004) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mg_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/mg_ol_0004.pgc" + + +TX_SERVICE(MG_OL_0004, ctx) +{ + mg_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[MG_OL_0004] 전문게이트웨이 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MG_OL_0004] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[MG_OL_0004] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[MG_OL_0004] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, MG_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = mg_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[MG_OL_0004] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = mg_rec_count(bizdate, MG_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[MG_OL_0004] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mg_ol_0004.pgc b/app/online/mg_ol_0004.pgc new file mode 100644 index 0000000..823b5d4 --- /dev/null +++ b/app/online/mg_ol_0004.pgc @@ -0,0 +1,70 @@ +/* @tier medium @module mg @transform msg-gateway-online */ +/* + * mg_ol_0004.pgc - 전문게이트웨이 온라인 서비스 (MG_OL_0004) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mg_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(MG_OL_0004, ctx) +{ + mg_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[MG_OL_0004] 전문게이트웨이 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MG_OL_0004] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[MG_OL_0004] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[MG_OL_0004] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, MG_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = mg_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[MG_OL_0004] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = mg_rec_count(bizdate, MG_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[MG_OL_0004] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mg_ol_0005.c b/app/online/mg_ol_0005.c new file mode 100644 index 0000000..6589cde --- /dev/null +++ b/app/online/mg_ol_0005.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/mg_ol_0005.pgc" +/* @tier easy @module mg @transform msg-gateway-online */ +/* + * mg_ol_0005.pgc - 전문게이트웨이 온라인 서비스 (MG_OL_0005) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mg_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/mg_ol_0005.pgc" + + +TX_SERVICE(MG_OL_0005, ctx) +{ + mg_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[MG_OL_0005] 전문게이트웨이 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MG_OL_0005] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = mg_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[MG_OL_0005] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[MG_OL_0005] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mg_ol_0005.pgc b/app/online/mg_ol_0005.pgc new file mode 100644 index 0000000..9b3ed08 --- /dev/null +++ b/app/online/mg_ol_0005.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module mg @transform msg-gateway-online */ +/* + * mg_ol_0005.pgc - 전문게이트웨이 온라인 서비스 (MG_OL_0005) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mg_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(MG_OL_0005, ctx) +{ + mg_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[MG_OL_0005] 전문게이트웨이 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MG_OL_0005] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = mg_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[MG_OL_0005] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[MG_OL_0005] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mg_ol_0006.c b/app/online/mg_ol_0006.c new file mode 100644 index 0000000..df38f71 --- /dev/null +++ b/app/online/mg_ol_0006.c @@ -0,0 +1,148 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/mg_ol_0006.pgc" +/* @tier medium @module mg @transform msg-gateway-online */ +/* + * mg_ol_0006.pgc - 전문게이트웨이 온라인 서비스 (MG_OL_0006) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mg_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/mg_ol_0006.pgc" + + +TX_SERVICE(MG_OL_0006, ctx) +{ + mg_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[MG_OL_0006] 전문게이트웨이 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MG_OL_0006] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[MG_OL_0006] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[MG_OL_0006] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, MG_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = mg_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[MG_OL_0006] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = mg_rec_count(bizdate, MG_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[MG_OL_0006] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mg_ol_0006.pgc b/app/online/mg_ol_0006.pgc new file mode 100644 index 0000000..32b0fc8 --- /dev/null +++ b/app/online/mg_ol_0006.pgc @@ -0,0 +1,70 @@ +/* @tier medium @module mg @transform msg-gateway-online */ +/* + * mg_ol_0006.pgc - 전문게이트웨이 온라인 서비스 (MG_OL_0006) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mg_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(MG_OL_0006, ctx) +{ + mg_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[MG_OL_0006] 전문게이트웨이 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MG_OL_0006] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[MG_OL_0006] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[MG_OL_0006] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, MG_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = mg_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[MG_OL_0006] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = mg_rec_count(bizdate, MG_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[MG_OL_0006] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mg_ol_0007.c b/app/online/mg_ol_0007.c new file mode 100644 index 0000000..ae593b6 --- /dev/null +++ b/app/online/mg_ol_0007.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/mg_ol_0007.pgc" +/* @tier easy @module mg @transform msg-gateway-online */ +/* + * mg_ol_0007.pgc - 전문게이트웨이 온라인 서비스 (MG_OL_0007) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mg_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/mg_ol_0007.pgc" + + +TX_SERVICE(MG_OL_0007, ctx) +{ + mg_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[MG_OL_0007] 전문게이트웨이 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MG_OL_0007] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = mg_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[MG_OL_0007] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[MG_OL_0007] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mg_ol_0007.pgc b/app/online/mg_ol_0007.pgc new file mode 100644 index 0000000..d1217ea --- /dev/null +++ b/app/online/mg_ol_0007.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module mg @transform msg-gateway-online */ +/* + * mg_ol_0007.pgc - 전문게이트웨이 온라인 서비스 (MG_OL_0007) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mg_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(MG_OL_0007, ctx) +{ + mg_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[MG_OL_0007] 전문게이트웨이 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MG_OL_0007] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = mg_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[MG_OL_0007] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[MG_OL_0007] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mg_ol_0008.c b/app/online/mg_ol_0008.c new file mode 100644 index 0000000..4f93b6a --- /dev/null +++ b/app/online/mg_ol_0008.c @@ -0,0 +1,176 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/mg_ol_0008.pgc" +/* @tier hard @module mg @transform msg-gateway-online */ +/* + * mg_ol_0008.pgc - 전문게이트웨이 온라인 서비스 (MG_OL_0008) [tier=hard] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mg_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/mg_ol_0008.pgc" + + +TX_SERVICE(MG_OL_0008, ctx) +{ + mg_rec_t rec; + char key[16], merch[16], bizdate[16], nextbiz[9]; + long amount = 0, daysum = 0; + int rc; + TXBUF *sub_in; + TXBUF *sub_out; + + tx_log(TX_LOG_INFO, "[MG_OL_0008] 전문게이트웨이 트랜잭션 오케스트레이션 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MG_OL_0008] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + if (!amount_is_valid(amount) || !date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[MG_OL_0008] 입력 검증 실패 amount=%ld date=%s", + amount, bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + /* 트랜잭션 시작 → 원장 반영 → 후속 서비스 연계 → 커밋 */ + if (tx_begin() != TX_OK) { + tx_return(ctx, TX_FAIL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, MG_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; + + rc = mg_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[MG_OL_0008] 원장반영 실패 rc=%d", rc); + tx_abort(); + tx_return(ctx, rc, ctx->out); + return; + } + + /* 정산 영업일 = 거래일의 다음 영업일 */ + if (date_next_business(bizdate, nextbiz) != 0) { + memcpy(nextbiz, bizdate, 8); + nextbiz[8] = '\0'; + } + + /* 후속 정산집계 서비스 연계 (레지스트리 문자열 디스패치) */ + sub_in = tx_buf_alloc(); + sub_out = tx_buf_alloc(); + if (sub_in && sub_out) { + tx_buf_sets(sub_in, "MERCHID", merch); + tx_buf_sets(sub_in, "BIZDATE", nextbiz); + tx_buf_setlong(sub_in, "AMOUNT", amount); + rc = tx_call("MG_POST", sub_in, sub_out); + if (rc != TX_OK) + tx_log(TX_LOG_WARN, "[MG_OL_0008] 후속연계 경고 rc=%d", rc); + } + tx_buf_free(sub_in); + tx_buf_free(sub_out); + + /* 교차 검증: 당일 합계 재계산 */ + if (mg_rec_sum(bizdate, &daysum) != TX_OK) + daysum = 0; + + tx_commit(); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYSUM", daysum); + tx_log(TX_LOG_INFO, "[MG_OL_0008] 완료 key=%s 당일합계=%ld", key, daysum); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mg_ol_0008.pgc b/app/online/mg_ol_0008.pgc new file mode 100644 index 0000000..755af33 --- /dev/null +++ b/app/online/mg_ol_0008.pgc @@ -0,0 +1,98 @@ +/* @tier hard @module mg @transform msg-gateway-online */ +/* + * mg_ol_0008.pgc - 전문게이트웨이 온라인 서비스 (MG_OL_0008) [tier=hard] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mg_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(MG_OL_0008, ctx) +{ + mg_rec_t rec; + char key[16], merch[16], bizdate[16], nextbiz[9]; + long amount = 0, daysum = 0; + int rc; + TXBUF *sub_in; + TXBUF *sub_out; + + tx_log(TX_LOG_INFO, "[MG_OL_0008] 전문게이트웨이 트랜잭션 오케스트레이션 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MG_OL_0008] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + if (!amount_is_valid(amount) || !date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[MG_OL_0008] 입력 검증 실패 amount=%ld date=%s", + amount, bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + /* 트랜잭션 시작 → 원장 반영 → 후속 서비스 연계 → 커밋 */ + if (tx_begin() != TX_OK) { + tx_return(ctx, TX_FAIL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, MG_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; + + rc = mg_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[MG_OL_0008] 원장반영 실패 rc=%d", rc); + tx_abort(); + tx_return(ctx, rc, ctx->out); + return; + } + + /* 정산 영업일 = 거래일의 다음 영업일 */ + if (date_next_business(bizdate, nextbiz) != 0) { + memcpy(nextbiz, bizdate, 8); + nextbiz[8] = '\0'; + } + + /* 후속 정산집계 서비스 연계 (레지스트리 문자열 디스패치) */ + sub_in = tx_buf_alloc(); + sub_out = tx_buf_alloc(); + if (sub_in && sub_out) { + tx_buf_sets(sub_in, "MERCHID", merch); + tx_buf_sets(sub_in, "BIZDATE", nextbiz); + tx_buf_setlong(sub_in, "AMOUNT", amount); + rc = tx_call("MG_POST", sub_in, sub_out); + if (rc != TX_OK) + tx_log(TX_LOG_WARN, "[MG_OL_0008] 후속연계 경고 rc=%d", rc); + } + tx_buf_free(sub_in); + tx_buf_free(sub_out); + + /* 교차 검증: 당일 합계 재계산 */ + if (mg_rec_sum(bizdate, &daysum) != TX_OK) + daysum = 0; + + tx_commit(); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYSUM", daysum); + tx_log(TX_LOG_INFO, "[MG_OL_0008] 완료 key=%s 당일합계=%ld", key, daysum); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mg_ol_0009.c b/app/online/mg_ol_0009.c new file mode 100644 index 0000000..183e4b2 --- /dev/null +++ b/app/online/mg_ol_0009.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/mg_ol_0009.pgc" +/* @tier easy @module mg @transform msg-gateway-online */ +/* + * mg_ol_0009.pgc - 전문게이트웨이 온라인 서비스 (MG_OL_0009) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mg_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/mg_ol_0009.pgc" + + +TX_SERVICE(MG_OL_0009, ctx) +{ + mg_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[MG_OL_0009] 전문게이트웨이 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MG_OL_0009] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = mg_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[MG_OL_0009] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[MG_OL_0009] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mg_ol_0009.pgc b/app/online/mg_ol_0009.pgc new file mode 100644 index 0000000..4fc52fa --- /dev/null +++ b/app/online/mg_ol_0009.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module mg @transform msg-gateway-online */ +/* + * mg_ol_0009.pgc - 전문게이트웨이 온라인 서비스 (MG_OL_0009) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mg_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(MG_OL_0009, ctx) +{ + mg_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[MG_OL_0009] 전문게이트웨이 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MG_OL_0009] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = mg_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[MG_OL_0009] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[MG_OL_0009] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mg_ol_0010.c b/app/online/mg_ol_0010.c new file mode 100644 index 0000000..0056101 --- /dev/null +++ b/app/online/mg_ol_0010.c @@ -0,0 +1,176 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/mg_ol_0010.pgc" +/* @tier hard @module mg @transform msg-gateway-online */ +/* + * mg_ol_0010.pgc - 전문게이트웨이 온라인 서비스 (MG_OL_0010) [tier=hard] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mg_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/mg_ol_0010.pgc" + + +TX_SERVICE(MG_OL_0010, ctx) +{ + mg_rec_t rec; + char key[16], merch[16], bizdate[16], nextbiz[9]; + long amount = 0, daysum = 0; + int rc; + TXBUF *sub_in; + TXBUF *sub_out; + + tx_log(TX_LOG_INFO, "[MG_OL_0010] 전문게이트웨이 트랜잭션 오케스트레이션 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MG_OL_0010] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + if (!amount_is_valid(amount) || !date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[MG_OL_0010] 입력 검증 실패 amount=%ld date=%s", + amount, bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + /* 트랜잭션 시작 → 원장 반영 → 후속 서비스 연계 → 커밋 */ + if (tx_begin() != TX_OK) { + tx_return(ctx, TX_FAIL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, MG_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; + + rc = mg_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[MG_OL_0010] 원장반영 실패 rc=%d", rc); + tx_abort(); + tx_return(ctx, rc, ctx->out); + return; + } + + /* 정산 영업일 = 거래일의 다음 영업일 */ + if (date_next_business(bizdate, nextbiz) != 0) { + memcpy(nextbiz, bizdate, 8); + nextbiz[8] = '\0'; + } + + /* 후속 정산집계 서비스 연계 (레지스트리 문자열 디스패치) */ + sub_in = tx_buf_alloc(); + sub_out = tx_buf_alloc(); + if (sub_in && sub_out) { + tx_buf_sets(sub_in, "MERCHID", merch); + tx_buf_sets(sub_in, "BIZDATE", nextbiz); + tx_buf_setlong(sub_in, "AMOUNT", amount); + rc = tx_call("MG_POST", sub_in, sub_out); + if (rc != TX_OK) + tx_log(TX_LOG_WARN, "[MG_OL_0010] 후속연계 경고 rc=%d", rc); + } + tx_buf_free(sub_in); + tx_buf_free(sub_out); + + /* 교차 검증: 당일 합계 재계산 */ + if (mg_rec_sum(bizdate, &daysum) != TX_OK) + daysum = 0; + + tx_commit(); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYSUM", daysum); + tx_log(TX_LOG_INFO, "[MG_OL_0010] 완료 key=%s 당일합계=%ld", key, daysum); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mg_ol_0010.pgc b/app/online/mg_ol_0010.pgc new file mode 100644 index 0000000..b164422 --- /dev/null +++ b/app/online/mg_ol_0010.pgc @@ -0,0 +1,98 @@ +/* @tier hard @module mg @transform msg-gateway-online */ +/* + * mg_ol_0010.pgc - 전문게이트웨이 온라인 서비스 (MG_OL_0010) [tier=hard] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mg_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(MG_OL_0010, ctx) +{ + mg_rec_t rec; + char key[16], merch[16], bizdate[16], nextbiz[9]; + long amount = 0, daysum = 0; + int rc; + TXBUF *sub_in; + TXBUF *sub_out; + + tx_log(TX_LOG_INFO, "[MG_OL_0010] 전문게이트웨이 트랜잭션 오케스트레이션 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MG_OL_0010] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + if (!amount_is_valid(amount) || !date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[MG_OL_0010] 입력 검증 실패 amount=%ld date=%s", + amount, bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + /* 트랜잭션 시작 → 원장 반영 → 후속 서비스 연계 → 커밋 */ + if (tx_begin() != TX_OK) { + tx_return(ctx, TX_FAIL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, MG_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; + + rc = mg_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[MG_OL_0010] 원장반영 실패 rc=%d", rc); + tx_abort(); + tx_return(ctx, rc, ctx->out); + return; + } + + /* 정산 영업일 = 거래일의 다음 영업일 */ + if (date_next_business(bizdate, nextbiz) != 0) { + memcpy(nextbiz, bizdate, 8); + nextbiz[8] = '\0'; + } + + /* 후속 정산집계 서비스 연계 (레지스트리 문자열 디스패치) */ + sub_in = tx_buf_alloc(); + sub_out = tx_buf_alloc(); + if (sub_in && sub_out) { + tx_buf_sets(sub_in, "MERCHID", merch); + tx_buf_sets(sub_in, "BIZDATE", nextbiz); + tx_buf_setlong(sub_in, "AMOUNT", amount); + rc = tx_call("MG_POST", sub_in, sub_out); + if (rc != TX_OK) + tx_log(TX_LOG_WARN, "[MG_OL_0010] 후속연계 경고 rc=%d", rc); + } + tx_buf_free(sub_in); + tx_buf_free(sub_out); + + /* 교차 검증: 당일 합계 재계산 */ + if (mg_rec_sum(bizdate, &daysum) != TX_OK) + daysum = 0; + + tx_commit(); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYSUM", daysum); + tx_log(TX_LOG_INFO, "[MG_OL_0010] 완료 key=%s 당일합계=%ld", key, daysum); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mg_ol_0011.c b/app/online/mg_ol_0011.c new file mode 100644 index 0000000..e4f42d3 --- /dev/null +++ b/app/online/mg_ol_0011.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/mg_ol_0011.pgc" +/* @tier easy @module mg @transform msg-gateway-online */ +/* + * mg_ol_0011.pgc - 전문게이트웨이 온라인 서비스 (MG_OL_0011) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mg_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/mg_ol_0011.pgc" + + +TX_SERVICE(MG_OL_0011, ctx) +{ + mg_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[MG_OL_0011] 전문게이트웨이 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MG_OL_0011] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = mg_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[MG_OL_0011] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[MG_OL_0011] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mg_ol_0011.pgc b/app/online/mg_ol_0011.pgc new file mode 100644 index 0000000..cd53243 --- /dev/null +++ b/app/online/mg_ol_0011.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module mg @transform msg-gateway-online */ +/* + * mg_ol_0011.pgc - 전문게이트웨이 온라인 서비스 (MG_OL_0011) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mg_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(MG_OL_0011, ctx) +{ + mg_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[MG_OL_0011] 전문게이트웨이 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MG_OL_0011] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = mg_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[MG_OL_0011] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[MG_OL_0011] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mg_ol_0012.c b/app/online/mg_ol_0012.c new file mode 100644 index 0000000..f19a3d8 --- /dev/null +++ b/app/online/mg_ol_0012.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/mg_ol_0012.pgc" +/* @tier easy @module mg @transform msg-gateway-online */ +/* + * mg_ol_0012.pgc - 전문게이트웨이 온라인 서비스 (MG_OL_0012) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mg_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/mg_ol_0012.pgc" + + +TX_SERVICE(MG_OL_0012, ctx) +{ + mg_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[MG_OL_0012] 전문게이트웨이 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MG_OL_0012] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = mg_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[MG_OL_0012] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[MG_OL_0012] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mg_ol_0012.pgc b/app/online/mg_ol_0012.pgc new file mode 100644 index 0000000..7eef54d --- /dev/null +++ b/app/online/mg_ol_0012.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module mg @transform msg-gateway-online */ +/* + * mg_ol_0012.pgc - 전문게이트웨이 온라인 서비스 (MG_OL_0012) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mg_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(MG_OL_0012, ctx) +{ + mg_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[MG_OL_0012] 전문게이트웨이 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MG_OL_0012] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = mg_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[MG_OL_0012] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[MG_OL_0012] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mg_ol_0013.c b/app/online/mg_ol_0013.c new file mode 100644 index 0000000..03be396 --- /dev/null +++ b/app/online/mg_ol_0013.c @@ -0,0 +1,148 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/mg_ol_0013.pgc" +/* @tier medium @module mg @transform msg-gateway-online */ +/* + * mg_ol_0013.pgc - 전문게이트웨이 온라인 서비스 (MG_OL_0013) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mg_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/mg_ol_0013.pgc" + + +TX_SERVICE(MG_OL_0013, ctx) +{ + mg_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[MG_OL_0013] 전문게이트웨이 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MG_OL_0013] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[MG_OL_0013] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[MG_OL_0013] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, MG_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = mg_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[MG_OL_0013] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = mg_rec_count(bizdate, MG_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[MG_OL_0013] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mg_ol_0013.pgc b/app/online/mg_ol_0013.pgc new file mode 100644 index 0000000..bfc4933 --- /dev/null +++ b/app/online/mg_ol_0013.pgc @@ -0,0 +1,70 @@ +/* @tier medium @module mg @transform msg-gateway-online */ +/* + * mg_ol_0013.pgc - 전문게이트웨이 온라인 서비스 (MG_OL_0013) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mg_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(MG_OL_0013, ctx) +{ + mg_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[MG_OL_0013] 전문게이트웨이 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MG_OL_0013] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[MG_OL_0013] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[MG_OL_0013] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, MG_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = mg_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[MG_OL_0013] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = mg_rec_count(bizdate, MG_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[MG_OL_0013] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mg_ol_0014.c b/app/online/mg_ol_0014.c new file mode 100644 index 0000000..e088788 --- /dev/null +++ b/app/online/mg_ol_0014.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/mg_ol_0014.pgc" +/* @tier easy @module mg @transform msg-gateway-online */ +/* + * mg_ol_0014.pgc - 전문게이트웨이 온라인 서비스 (MG_OL_0014) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mg_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/mg_ol_0014.pgc" + + +TX_SERVICE(MG_OL_0014, ctx) +{ + mg_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[MG_OL_0014] 전문게이트웨이 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MG_OL_0014] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = mg_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[MG_OL_0014] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[MG_OL_0014] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mg_ol_0014.pgc b/app/online/mg_ol_0014.pgc new file mode 100644 index 0000000..8eedc13 --- /dev/null +++ b/app/online/mg_ol_0014.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module mg @transform msg-gateway-online */ +/* + * mg_ol_0014.pgc - 전문게이트웨이 온라인 서비스 (MG_OL_0014) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mg_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(MG_OL_0014, ctx) +{ + mg_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[MG_OL_0014] 전문게이트웨이 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MG_OL_0014] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = mg_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[MG_OL_0014] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[MG_OL_0014] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mg_ol_0015.c b/app/online/mg_ol_0015.c new file mode 100644 index 0000000..3110898 --- /dev/null +++ b/app/online/mg_ol_0015.c @@ -0,0 +1,148 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/mg_ol_0015.pgc" +/* @tier medium @module mg @transform msg-gateway-online */ +/* + * mg_ol_0015.pgc - 전문게이트웨이 온라인 서비스 (MG_OL_0015) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mg_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/mg_ol_0015.pgc" + + +TX_SERVICE(MG_OL_0015, ctx) +{ + mg_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[MG_OL_0015] 전문게이트웨이 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MG_OL_0015] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[MG_OL_0015] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[MG_OL_0015] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, MG_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = mg_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[MG_OL_0015] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = mg_rec_count(bizdate, MG_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[MG_OL_0015] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mg_ol_0015.pgc b/app/online/mg_ol_0015.pgc new file mode 100644 index 0000000..8fbede0 --- /dev/null +++ b/app/online/mg_ol_0015.pgc @@ -0,0 +1,70 @@ +/* @tier medium @module mg @transform msg-gateway-online */ +/* + * mg_ol_0015.pgc - 전문게이트웨이 온라인 서비스 (MG_OL_0015) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mg_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(MG_OL_0015, ctx) +{ + mg_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[MG_OL_0015] 전문게이트웨이 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MG_OL_0015] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[MG_OL_0015] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[MG_OL_0015] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, MG_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = mg_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[MG_OL_0015] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = mg_rec_count(bizdate, MG_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[MG_OL_0015] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mg_ol_0016.c b/app/online/mg_ol_0016.c new file mode 100644 index 0000000..cf6185a --- /dev/null +++ b/app/online/mg_ol_0016.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/mg_ol_0016.pgc" +/* @tier easy @module mg @transform msg-gateway-online */ +/* + * mg_ol_0016.pgc - 전문게이트웨이 온라인 서비스 (MG_OL_0016) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mg_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/mg_ol_0016.pgc" + + +TX_SERVICE(MG_OL_0016, ctx) +{ + mg_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[MG_OL_0016] 전문게이트웨이 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MG_OL_0016] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = mg_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[MG_OL_0016] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[MG_OL_0016] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mg_ol_0016.pgc b/app/online/mg_ol_0016.pgc new file mode 100644 index 0000000..efea1c4 --- /dev/null +++ b/app/online/mg_ol_0016.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module mg @transform msg-gateway-online */ +/* + * mg_ol_0016.pgc - 전문게이트웨이 온라인 서비스 (MG_OL_0016) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mg_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(MG_OL_0016, ctx) +{ + mg_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[MG_OL_0016] 전문게이트웨이 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MG_OL_0016] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = mg_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[MG_OL_0016] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[MG_OL_0016] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mg_ol_0017.c b/app/online/mg_ol_0017.c new file mode 100644 index 0000000..165f9a6 --- /dev/null +++ b/app/online/mg_ol_0017.c @@ -0,0 +1,148 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/mg_ol_0017.pgc" +/* @tier medium @module mg @transform msg-gateway-online */ +/* + * mg_ol_0017.pgc - 전문게이트웨이 온라인 서비스 (MG_OL_0017) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mg_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/mg_ol_0017.pgc" + + +TX_SERVICE(MG_OL_0017, ctx) +{ + mg_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[MG_OL_0017] 전문게이트웨이 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MG_OL_0017] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[MG_OL_0017] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[MG_OL_0017] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, MG_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = mg_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[MG_OL_0017] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = mg_rec_count(bizdate, MG_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[MG_OL_0017] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mg_ol_0017.pgc b/app/online/mg_ol_0017.pgc new file mode 100644 index 0000000..9c0a8ef --- /dev/null +++ b/app/online/mg_ol_0017.pgc @@ -0,0 +1,70 @@ +/* @tier medium @module mg @transform msg-gateway-online */ +/* + * mg_ol_0017.pgc - 전문게이트웨이 온라인 서비스 (MG_OL_0017) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mg_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(MG_OL_0017, ctx) +{ + mg_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[MG_OL_0017] 전문게이트웨이 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MG_OL_0017] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[MG_OL_0017] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[MG_OL_0017] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, MG_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = mg_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[MG_OL_0017] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = mg_rec_count(bizdate, MG_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[MG_OL_0017] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mg_ol_0018.c b/app/online/mg_ol_0018.c new file mode 100644 index 0000000..fe1c578 --- /dev/null +++ b/app/online/mg_ol_0018.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/mg_ol_0018.pgc" +/* @tier easy @module mg @transform msg-gateway-online */ +/* + * mg_ol_0018.pgc - 전문게이트웨이 온라인 서비스 (MG_OL_0018) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mg_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/mg_ol_0018.pgc" + + +TX_SERVICE(MG_OL_0018, ctx) +{ + mg_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[MG_OL_0018] 전문게이트웨이 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MG_OL_0018] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = mg_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[MG_OL_0018] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[MG_OL_0018] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mg_ol_0018.pgc b/app/online/mg_ol_0018.pgc new file mode 100644 index 0000000..34bd20c --- /dev/null +++ b/app/online/mg_ol_0018.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module mg @transform msg-gateway-online */ +/* + * mg_ol_0018.pgc - 전문게이트웨이 온라인 서비스 (MG_OL_0018) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mg_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(MG_OL_0018, ctx) +{ + mg_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[MG_OL_0018] 전문게이트웨이 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MG_OL_0018] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = mg_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[MG_OL_0018] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[MG_OL_0018] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mg_ol_0019.c b/app/online/mg_ol_0019.c new file mode 100644 index 0000000..3622a7a --- /dev/null +++ b/app/online/mg_ol_0019.c @@ -0,0 +1,176 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/mg_ol_0019.pgc" +/* @tier hard @module mg @transform msg-gateway-online */ +/* + * mg_ol_0019.pgc - 전문게이트웨이 온라인 서비스 (MG_OL_0019) [tier=hard] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mg_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/mg_ol_0019.pgc" + + +TX_SERVICE(MG_OL_0019, ctx) +{ + mg_rec_t rec; + char key[16], merch[16], bizdate[16], nextbiz[9]; + long amount = 0, daysum = 0; + int rc; + TXBUF *sub_in; + TXBUF *sub_out; + + tx_log(TX_LOG_INFO, "[MG_OL_0019] 전문게이트웨이 트랜잭션 오케스트레이션 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MG_OL_0019] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + if (!amount_is_valid(amount) || !date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[MG_OL_0019] 입력 검증 실패 amount=%ld date=%s", + amount, bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + /* 트랜잭션 시작 → 원장 반영 → 후속 서비스 연계 → 커밋 */ + if (tx_begin() != TX_OK) { + tx_return(ctx, TX_FAIL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, MG_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; + + rc = mg_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[MG_OL_0019] 원장반영 실패 rc=%d", rc); + tx_abort(); + tx_return(ctx, rc, ctx->out); + return; + } + + /* 정산 영업일 = 거래일의 다음 영업일 */ + if (date_next_business(bizdate, nextbiz) != 0) { + memcpy(nextbiz, bizdate, 8); + nextbiz[8] = '\0'; + } + + /* 후속 정산집계 서비스 연계 (레지스트리 문자열 디스패치) */ + sub_in = tx_buf_alloc(); + sub_out = tx_buf_alloc(); + if (sub_in && sub_out) { + tx_buf_sets(sub_in, "MERCHID", merch); + tx_buf_sets(sub_in, "BIZDATE", nextbiz); + tx_buf_setlong(sub_in, "AMOUNT", amount); + rc = tx_call("MG_POST", sub_in, sub_out); + if (rc != TX_OK) + tx_log(TX_LOG_WARN, "[MG_OL_0019] 후속연계 경고 rc=%d", rc); + } + tx_buf_free(sub_in); + tx_buf_free(sub_out); + + /* 교차 검증: 당일 합계 재계산 */ + if (mg_rec_sum(bizdate, &daysum) != TX_OK) + daysum = 0; + + tx_commit(); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYSUM", daysum); + tx_log(TX_LOG_INFO, "[MG_OL_0019] 완료 key=%s 당일합계=%ld", key, daysum); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mg_ol_0019.pgc b/app/online/mg_ol_0019.pgc new file mode 100644 index 0000000..b9abf8c --- /dev/null +++ b/app/online/mg_ol_0019.pgc @@ -0,0 +1,98 @@ +/* @tier hard @module mg @transform msg-gateway-online */ +/* + * mg_ol_0019.pgc - 전문게이트웨이 온라인 서비스 (MG_OL_0019) [tier=hard] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mg_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(MG_OL_0019, ctx) +{ + mg_rec_t rec; + char key[16], merch[16], bizdate[16], nextbiz[9]; + long amount = 0, daysum = 0; + int rc; + TXBUF *sub_in; + TXBUF *sub_out; + + tx_log(TX_LOG_INFO, "[MG_OL_0019] 전문게이트웨이 트랜잭션 오케스트레이션 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MG_OL_0019] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + if (!amount_is_valid(amount) || !date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[MG_OL_0019] 입력 검증 실패 amount=%ld date=%s", + amount, bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + /* 트랜잭션 시작 → 원장 반영 → 후속 서비스 연계 → 커밋 */ + if (tx_begin() != TX_OK) { + tx_return(ctx, TX_FAIL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, MG_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; + + rc = mg_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[MG_OL_0019] 원장반영 실패 rc=%d", rc); + tx_abort(); + tx_return(ctx, rc, ctx->out); + return; + } + + /* 정산 영업일 = 거래일의 다음 영업일 */ + if (date_next_business(bizdate, nextbiz) != 0) { + memcpy(nextbiz, bizdate, 8); + nextbiz[8] = '\0'; + } + + /* 후속 정산집계 서비스 연계 (레지스트리 문자열 디스패치) */ + sub_in = tx_buf_alloc(); + sub_out = tx_buf_alloc(); + if (sub_in && sub_out) { + tx_buf_sets(sub_in, "MERCHID", merch); + tx_buf_sets(sub_in, "BIZDATE", nextbiz); + tx_buf_setlong(sub_in, "AMOUNT", amount); + rc = tx_call("MG_POST", sub_in, sub_out); + if (rc != TX_OK) + tx_log(TX_LOG_WARN, "[MG_OL_0019] 후속연계 경고 rc=%d", rc); + } + tx_buf_free(sub_in); + tx_buf_free(sub_out); + + /* 교차 검증: 당일 합계 재계산 */ + if (mg_rec_sum(bizdate, &daysum) != TX_OK) + daysum = 0; + + tx_commit(); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYSUM", daysum); + tx_log(TX_LOG_INFO, "[MG_OL_0019] 완료 key=%s 당일합계=%ld", key, daysum); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mg_ol_0020.c b/app/online/mg_ol_0020.c new file mode 100644 index 0000000..4765d35 --- /dev/null +++ b/app/online/mg_ol_0020.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/mg_ol_0020.pgc" +/* @tier easy @module mg @transform msg-gateway-online */ +/* + * mg_ol_0020.pgc - 전문게이트웨이 온라인 서비스 (MG_OL_0020) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mg_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/mg_ol_0020.pgc" + + +TX_SERVICE(MG_OL_0020, ctx) +{ + mg_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[MG_OL_0020] 전문게이트웨이 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MG_OL_0020] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = mg_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[MG_OL_0020] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[MG_OL_0020] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mg_ol_0020.pgc b/app/online/mg_ol_0020.pgc new file mode 100644 index 0000000..8178b87 --- /dev/null +++ b/app/online/mg_ol_0020.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module mg @transform msg-gateway-online */ +/* + * mg_ol_0020.pgc - 전문게이트웨이 온라인 서비스 (MG_OL_0020) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mg_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(MG_OL_0020, ctx) +{ + mg_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[MG_OL_0020] 전문게이트웨이 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MG_OL_0020] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = mg_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[MG_OL_0020] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[MG_OL_0020] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mg_ol_0021.c b/app/online/mg_ol_0021.c new file mode 100644 index 0000000..d599d60 --- /dev/null +++ b/app/online/mg_ol_0021.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/mg_ol_0021.pgc" +/* @tier easy @module mg @transform msg-gateway-online */ +/* + * mg_ol_0021.pgc - 전문게이트웨이 온라인 서비스 (MG_OL_0021) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mg_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/mg_ol_0021.pgc" + + +TX_SERVICE(MG_OL_0021, ctx) +{ + mg_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[MG_OL_0021] 전문게이트웨이 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MG_OL_0021] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = mg_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[MG_OL_0021] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[MG_OL_0021] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mg_ol_0021.pgc b/app/online/mg_ol_0021.pgc new file mode 100644 index 0000000..4d6bec5 --- /dev/null +++ b/app/online/mg_ol_0021.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module mg @transform msg-gateway-online */ +/* + * mg_ol_0021.pgc - 전문게이트웨이 온라인 서비스 (MG_OL_0021) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mg_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(MG_OL_0021, ctx) +{ + mg_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[MG_OL_0021] 전문게이트웨이 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MG_OL_0021] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = mg_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[MG_OL_0021] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[MG_OL_0021] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mg_ol_0022.c b/app/online/mg_ol_0022.c new file mode 100644 index 0000000..410562e --- /dev/null +++ b/app/online/mg_ol_0022.c @@ -0,0 +1,148 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/mg_ol_0022.pgc" +/* @tier medium @module mg @transform msg-gateway-online */ +/* + * mg_ol_0022.pgc - 전문게이트웨이 온라인 서비스 (MG_OL_0022) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mg_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/mg_ol_0022.pgc" + + +TX_SERVICE(MG_OL_0022, ctx) +{ + mg_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[MG_OL_0022] 전문게이트웨이 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MG_OL_0022] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[MG_OL_0022] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[MG_OL_0022] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, MG_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = mg_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[MG_OL_0022] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = mg_rec_count(bizdate, MG_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[MG_OL_0022] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mg_ol_0022.pgc b/app/online/mg_ol_0022.pgc new file mode 100644 index 0000000..7956ff4 --- /dev/null +++ b/app/online/mg_ol_0022.pgc @@ -0,0 +1,70 @@ +/* @tier medium @module mg @transform msg-gateway-online */ +/* + * mg_ol_0022.pgc - 전문게이트웨이 온라인 서비스 (MG_OL_0022) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mg_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(MG_OL_0022, ctx) +{ + mg_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[MG_OL_0022] 전문게이트웨이 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MG_OL_0022] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[MG_OL_0022] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[MG_OL_0022] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, MG_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = mg_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[MG_OL_0022] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = mg_rec_count(bizdate, MG_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[MG_OL_0022] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mg_ol_0023.c b/app/online/mg_ol_0023.c new file mode 100644 index 0000000..b462782 --- /dev/null +++ b/app/online/mg_ol_0023.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/mg_ol_0023.pgc" +/* @tier easy @module mg @transform msg-gateway-online */ +/* + * mg_ol_0023.pgc - 전문게이트웨이 온라인 서비스 (MG_OL_0023) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mg_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/mg_ol_0023.pgc" + + +TX_SERVICE(MG_OL_0023, ctx) +{ + mg_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[MG_OL_0023] 전문게이트웨이 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MG_OL_0023] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = mg_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[MG_OL_0023] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[MG_OL_0023] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mg_ol_0023.pgc b/app/online/mg_ol_0023.pgc new file mode 100644 index 0000000..e09a096 --- /dev/null +++ b/app/online/mg_ol_0023.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module mg @transform msg-gateway-online */ +/* + * mg_ol_0023.pgc - 전문게이트웨이 온라인 서비스 (MG_OL_0023) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mg_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(MG_OL_0023, ctx) +{ + mg_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[MG_OL_0023] 전문게이트웨이 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MG_OL_0023] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = mg_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[MG_OL_0023] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[MG_OL_0023] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mg_ol_0024.c b/app/online/mg_ol_0024.c new file mode 100644 index 0000000..d492b25 --- /dev/null +++ b/app/online/mg_ol_0024.c @@ -0,0 +1,148 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/mg_ol_0024.pgc" +/* @tier medium @module mg @transform msg-gateway-online */ +/* + * mg_ol_0024.pgc - 전문게이트웨이 온라인 서비스 (MG_OL_0024) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mg_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/mg_ol_0024.pgc" + + +TX_SERVICE(MG_OL_0024, ctx) +{ + mg_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[MG_OL_0024] 전문게이트웨이 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MG_OL_0024] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[MG_OL_0024] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[MG_OL_0024] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, MG_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = mg_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[MG_OL_0024] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = mg_rec_count(bizdate, MG_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[MG_OL_0024] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mg_ol_0024.pgc b/app/online/mg_ol_0024.pgc new file mode 100644 index 0000000..b7688a5 --- /dev/null +++ b/app/online/mg_ol_0024.pgc @@ -0,0 +1,70 @@ +/* @tier medium @module mg @transform msg-gateway-online */ +/* + * mg_ol_0024.pgc - 전문게이트웨이 온라인 서비스 (MG_OL_0024) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mg_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(MG_OL_0024, ctx) +{ + mg_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[MG_OL_0024] 전문게이트웨이 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MG_OL_0024] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[MG_OL_0024] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[MG_OL_0024] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, MG_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = mg_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[MG_OL_0024] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = mg_rec_count(bizdate, MG_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[MG_OL_0024] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mg_ol_0025.c b/app/online/mg_ol_0025.c new file mode 100644 index 0000000..a107150 --- /dev/null +++ b/app/online/mg_ol_0025.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/mg_ol_0025.pgc" +/* @tier easy @module mg @transform msg-gateway-online */ +/* + * mg_ol_0025.pgc - 전문게이트웨이 온라인 서비스 (MG_OL_0025) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mg_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/mg_ol_0025.pgc" + + +TX_SERVICE(MG_OL_0025, ctx) +{ + mg_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[MG_OL_0025] 전문게이트웨이 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MG_OL_0025] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = mg_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[MG_OL_0025] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[MG_OL_0025] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mg_ol_0025.pgc b/app/online/mg_ol_0025.pgc new file mode 100644 index 0000000..7b6582b --- /dev/null +++ b/app/online/mg_ol_0025.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module mg @transform msg-gateway-online */ +/* + * mg_ol_0025.pgc - 전문게이트웨이 온라인 서비스 (MG_OL_0025) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mg_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(MG_OL_0025, ctx) +{ + mg_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[MG_OL_0025] 전문게이트웨이 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MG_OL_0025] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = mg_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[MG_OL_0025] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[MG_OL_0025] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mg_ol_0026.c b/app/online/mg_ol_0026.c new file mode 100644 index 0000000..4e07609 --- /dev/null +++ b/app/online/mg_ol_0026.c @@ -0,0 +1,148 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/mg_ol_0026.pgc" +/* @tier medium @module mg @transform msg-gateway-online */ +/* + * mg_ol_0026.pgc - 전문게이트웨이 온라인 서비스 (MG_OL_0026) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mg_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/mg_ol_0026.pgc" + + +TX_SERVICE(MG_OL_0026, ctx) +{ + mg_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[MG_OL_0026] 전문게이트웨이 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MG_OL_0026] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[MG_OL_0026] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[MG_OL_0026] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, MG_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = mg_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[MG_OL_0026] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = mg_rec_count(bizdate, MG_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[MG_OL_0026] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mg_ol_0026.pgc b/app/online/mg_ol_0026.pgc new file mode 100644 index 0000000..e911e53 --- /dev/null +++ b/app/online/mg_ol_0026.pgc @@ -0,0 +1,70 @@ +/* @tier medium @module mg @transform msg-gateway-online */ +/* + * mg_ol_0026.pgc - 전문게이트웨이 온라인 서비스 (MG_OL_0026) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mg_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(MG_OL_0026, ctx) +{ + mg_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[MG_OL_0026] 전문게이트웨이 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MG_OL_0026] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[MG_OL_0026] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[MG_OL_0026] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, MG_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = mg_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[MG_OL_0026] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = mg_rec_count(bizdate, MG_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[MG_OL_0026] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mg_ol_0027.c b/app/online/mg_ol_0027.c new file mode 100644 index 0000000..ea3d473 --- /dev/null +++ b/app/online/mg_ol_0027.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/mg_ol_0027.pgc" +/* @tier easy @module mg @transform msg-gateway-online */ +/* + * mg_ol_0027.pgc - 전문게이트웨이 온라인 서비스 (MG_OL_0027) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mg_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/mg_ol_0027.pgc" + + +TX_SERVICE(MG_OL_0027, ctx) +{ + mg_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[MG_OL_0027] 전문게이트웨이 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MG_OL_0027] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = mg_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[MG_OL_0027] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[MG_OL_0027] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mg_ol_0027.pgc b/app/online/mg_ol_0027.pgc new file mode 100644 index 0000000..59d4980 --- /dev/null +++ b/app/online/mg_ol_0027.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module mg @transform msg-gateway-online */ +/* + * mg_ol_0027.pgc - 전문게이트웨이 온라인 서비스 (MG_OL_0027) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mg_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(MG_OL_0027, ctx) +{ + mg_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[MG_OL_0027] 전문게이트웨이 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MG_OL_0027] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = mg_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[MG_OL_0027] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[MG_OL_0027] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mg_ol_0028.c b/app/online/mg_ol_0028.c new file mode 100644 index 0000000..0c39edc --- /dev/null +++ b/app/online/mg_ol_0028.c @@ -0,0 +1,176 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/mg_ol_0028.pgc" +/* @tier hard @module mg @transform msg-gateway-online */ +/* + * mg_ol_0028.pgc - 전문게이트웨이 온라인 서비스 (MG_OL_0028) [tier=hard] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mg_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/mg_ol_0028.pgc" + + +TX_SERVICE(MG_OL_0028, ctx) +{ + mg_rec_t rec; + char key[16], merch[16], bizdate[16], nextbiz[9]; + long amount = 0, daysum = 0; + int rc; + TXBUF *sub_in; + TXBUF *sub_out; + + tx_log(TX_LOG_INFO, "[MG_OL_0028] 전문게이트웨이 트랜잭션 오케스트레이션 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MG_OL_0028] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + if (!amount_is_valid(amount) || !date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[MG_OL_0028] 입력 검증 실패 amount=%ld date=%s", + amount, bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + /* 트랜잭션 시작 → 원장 반영 → 후속 서비스 연계 → 커밋 */ + if (tx_begin() != TX_OK) { + tx_return(ctx, TX_FAIL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, MG_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; + + rc = mg_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[MG_OL_0028] 원장반영 실패 rc=%d", rc); + tx_abort(); + tx_return(ctx, rc, ctx->out); + return; + } + + /* 정산 영업일 = 거래일의 다음 영업일 */ + if (date_next_business(bizdate, nextbiz) != 0) { + memcpy(nextbiz, bizdate, 8); + nextbiz[8] = '\0'; + } + + /* 후속 정산집계 서비스 연계 (레지스트리 문자열 디스패치) */ + sub_in = tx_buf_alloc(); + sub_out = tx_buf_alloc(); + if (sub_in && sub_out) { + tx_buf_sets(sub_in, "MERCHID", merch); + tx_buf_sets(sub_in, "BIZDATE", nextbiz); + tx_buf_setlong(sub_in, "AMOUNT", amount); + rc = tx_call("MG_POST", sub_in, sub_out); + if (rc != TX_OK) + tx_log(TX_LOG_WARN, "[MG_OL_0028] 후속연계 경고 rc=%d", rc); + } + tx_buf_free(sub_in); + tx_buf_free(sub_out); + + /* 교차 검증: 당일 합계 재계산 */ + if (mg_rec_sum(bizdate, &daysum) != TX_OK) + daysum = 0; + + tx_commit(); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYSUM", daysum); + tx_log(TX_LOG_INFO, "[MG_OL_0028] 완료 key=%s 당일합계=%ld", key, daysum); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mg_ol_0028.pgc b/app/online/mg_ol_0028.pgc new file mode 100644 index 0000000..37a662f --- /dev/null +++ b/app/online/mg_ol_0028.pgc @@ -0,0 +1,98 @@ +/* @tier hard @module mg @transform msg-gateway-online */ +/* + * mg_ol_0028.pgc - 전문게이트웨이 온라인 서비스 (MG_OL_0028) [tier=hard] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mg_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(MG_OL_0028, ctx) +{ + mg_rec_t rec; + char key[16], merch[16], bizdate[16], nextbiz[9]; + long amount = 0, daysum = 0; + int rc; + TXBUF *sub_in; + TXBUF *sub_out; + + tx_log(TX_LOG_INFO, "[MG_OL_0028] 전문게이트웨이 트랜잭션 오케스트레이션 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MG_OL_0028] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + if (!amount_is_valid(amount) || !date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[MG_OL_0028] 입력 검증 실패 amount=%ld date=%s", + amount, bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + /* 트랜잭션 시작 → 원장 반영 → 후속 서비스 연계 → 커밋 */ + if (tx_begin() != TX_OK) { + tx_return(ctx, TX_FAIL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, MG_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; + + rc = mg_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[MG_OL_0028] 원장반영 실패 rc=%d", rc); + tx_abort(); + tx_return(ctx, rc, ctx->out); + return; + } + + /* 정산 영업일 = 거래일의 다음 영업일 */ + if (date_next_business(bizdate, nextbiz) != 0) { + memcpy(nextbiz, bizdate, 8); + nextbiz[8] = '\0'; + } + + /* 후속 정산집계 서비스 연계 (레지스트리 문자열 디스패치) */ + sub_in = tx_buf_alloc(); + sub_out = tx_buf_alloc(); + if (sub_in && sub_out) { + tx_buf_sets(sub_in, "MERCHID", merch); + tx_buf_sets(sub_in, "BIZDATE", nextbiz); + tx_buf_setlong(sub_in, "AMOUNT", amount); + rc = tx_call("MG_POST", sub_in, sub_out); + if (rc != TX_OK) + tx_log(TX_LOG_WARN, "[MG_OL_0028] 후속연계 경고 rc=%d", rc); + } + tx_buf_free(sub_in); + tx_buf_free(sub_out); + + /* 교차 검증: 당일 합계 재계산 */ + if (mg_rec_sum(bizdate, &daysum) != TX_OK) + daysum = 0; + + tx_commit(); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYSUM", daysum); + tx_log(TX_LOG_INFO, "[MG_OL_0028] 완료 key=%s 당일합계=%ld", key, daysum); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mg_ol_0029.c b/app/online/mg_ol_0029.c new file mode 100644 index 0000000..cf5ae18 --- /dev/null +++ b/app/online/mg_ol_0029.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/mg_ol_0029.pgc" +/* @tier easy @module mg @transform msg-gateway-online */ +/* + * mg_ol_0029.pgc - 전문게이트웨이 온라인 서비스 (MG_OL_0029) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mg_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/mg_ol_0029.pgc" + + +TX_SERVICE(MG_OL_0029, ctx) +{ + mg_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[MG_OL_0029] 전문게이트웨이 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MG_OL_0029] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = mg_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[MG_OL_0029] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[MG_OL_0029] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mg_ol_0029.pgc b/app/online/mg_ol_0029.pgc new file mode 100644 index 0000000..35ad5d4 --- /dev/null +++ b/app/online/mg_ol_0029.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module mg @transform msg-gateway-online */ +/* + * mg_ol_0029.pgc - 전문게이트웨이 온라인 서비스 (MG_OL_0029) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mg_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(MG_OL_0029, ctx) +{ + mg_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[MG_OL_0029] 전문게이트웨이 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MG_OL_0029] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = mg_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[MG_OL_0029] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[MG_OL_0029] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mg_ol_0030.c b/app/online/mg_ol_0030.c new file mode 100644 index 0000000..4b9b953 --- /dev/null +++ b/app/online/mg_ol_0030.c @@ -0,0 +1,176 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/mg_ol_0030.pgc" +/* @tier hard @module mg @transform msg-gateway-online */ +/* + * mg_ol_0030.pgc - 전문게이트웨이 온라인 서비스 (MG_OL_0030) [tier=hard] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mg_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/mg_ol_0030.pgc" + + +TX_SERVICE(MG_OL_0030, ctx) +{ + mg_rec_t rec; + char key[16], merch[16], bizdate[16], nextbiz[9]; + long amount = 0, daysum = 0; + int rc; + TXBUF *sub_in; + TXBUF *sub_out; + + tx_log(TX_LOG_INFO, "[MG_OL_0030] 전문게이트웨이 트랜잭션 오케스트레이션 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MG_OL_0030] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + if (!amount_is_valid(amount) || !date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[MG_OL_0030] 입력 검증 실패 amount=%ld date=%s", + amount, bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + /* 트랜잭션 시작 → 원장 반영 → 후속 서비스 연계 → 커밋 */ + if (tx_begin() != TX_OK) { + tx_return(ctx, TX_FAIL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, MG_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; + + rc = mg_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[MG_OL_0030] 원장반영 실패 rc=%d", rc); + tx_abort(); + tx_return(ctx, rc, ctx->out); + return; + } + + /* 정산 영업일 = 거래일의 다음 영업일 */ + if (date_next_business(bizdate, nextbiz) != 0) { + memcpy(nextbiz, bizdate, 8); + nextbiz[8] = '\0'; + } + + /* 후속 정산집계 서비스 연계 (레지스트리 문자열 디스패치) */ + sub_in = tx_buf_alloc(); + sub_out = tx_buf_alloc(); + if (sub_in && sub_out) { + tx_buf_sets(sub_in, "MERCHID", merch); + tx_buf_sets(sub_in, "BIZDATE", nextbiz); + tx_buf_setlong(sub_in, "AMOUNT", amount); + rc = tx_call("MG_POST", sub_in, sub_out); + if (rc != TX_OK) + tx_log(TX_LOG_WARN, "[MG_OL_0030] 후속연계 경고 rc=%d", rc); + } + tx_buf_free(sub_in); + tx_buf_free(sub_out); + + /* 교차 검증: 당일 합계 재계산 */ + if (mg_rec_sum(bizdate, &daysum) != TX_OK) + daysum = 0; + + tx_commit(); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYSUM", daysum); + tx_log(TX_LOG_INFO, "[MG_OL_0030] 완료 key=%s 당일합계=%ld", key, daysum); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mg_ol_0030.pgc b/app/online/mg_ol_0030.pgc new file mode 100644 index 0000000..998b61e --- /dev/null +++ b/app/online/mg_ol_0030.pgc @@ -0,0 +1,98 @@ +/* @tier hard @module mg @transform msg-gateway-online */ +/* + * mg_ol_0030.pgc - 전문게이트웨이 온라인 서비스 (MG_OL_0030) [tier=hard] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mg_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(MG_OL_0030, ctx) +{ + mg_rec_t rec; + char key[16], merch[16], bizdate[16], nextbiz[9]; + long amount = 0, daysum = 0; + int rc; + TXBUF *sub_in; + TXBUF *sub_out; + + tx_log(TX_LOG_INFO, "[MG_OL_0030] 전문게이트웨이 트랜잭션 오케스트레이션 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MG_OL_0030] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + if (!amount_is_valid(amount) || !date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[MG_OL_0030] 입력 검증 실패 amount=%ld date=%s", + amount, bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + /* 트랜잭션 시작 → 원장 반영 → 후속 서비스 연계 → 커밋 */ + if (tx_begin() != TX_OK) { + tx_return(ctx, TX_FAIL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, MG_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; + + rc = mg_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[MG_OL_0030] 원장반영 실패 rc=%d", rc); + tx_abort(); + tx_return(ctx, rc, ctx->out); + return; + } + + /* 정산 영업일 = 거래일의 다음 영업일 */ + if (date_next_business(bizdate, nextbiz) != 0) { + memcpy(nextbiz, bizdate, 8); + nextbiz[8] = '\0'; + } + + /* 후속 정산집계 서비스 연계 (레지스트리 문자열 디스패치) */ + sub_in = tx_buf_alloc(); + sub_out = tx_buf_alloc(); + if (sub_in && sub_out) { + tx_buf_sets(sub_in, "MERCHID", merch); + tx_buf_sets(sub_in, "BIZDATE", nextbiz); + tx_buf_setlong(sub_in, "AMOUNT", amount); + rc = tx_call("MG_POST", sub_in, sub_out); + if (rc != TX_OK) + tx_log(TX_LOG_WARN, "[MG_OL_0030] 후속연계 경고 rc=%d", rc); + } + tx_buf_free(sub_in); + tx_buf_free(sub_out); + + /* 교차 검증: 당일 합계 재계산 */ + if (mg_rec_sum(bizdate, &daysum) != TX_OK) + daysum = 0; + + tx_commit(); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYSUM", daysum); + tx_log(TX_LOG_INFO, "[MG_OL_0030] 완료 key=%s 당일합계=%ld", key, daysum); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mg_ol_0031.c b/app/online/mg_ol_0031.c new file mode 100644 index 0000000..9b80ee9 --- /dev/null +++ b/app/online/mg_ol_0031.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/mg_ol_0031.pgc" +/* @tier easy @module mg @transform msg-gateway-online */ +/* + * mg_ol_0031.pgc - 전문게이트웨이 온라인 서비스 (MG_OL_0031) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mg_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/mg_ol_0031.pgc" + + +TX_SERVICE(MG_OL_0031, ctx) +{ + mg_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[MG_OL_0031] 전문게이트웨이 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MG_OL_0031] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = mg_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[MG_OL_0031] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[MG_OL_0031] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mg_ol_0031.pgc b/app/online/mg_ol_0031.pgc new file mode 100644 index 0000000..46f194e --- /dev/null +++ b/app/online/mg_ol_0031.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module mg @transform msg-gateway-online */ +/* + * mg_ol_0031.pgc - 전문게이트웨이 온라인 서비스 (MG_OL_0031) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mg_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(MG_OL_0031, ctx) +{ + mg_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[MG_OL_0031] 전문게이트웨이 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MG_OL_0031] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = mg_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[MG_OL_0031] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[MG_OL_0031] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mg_ol_0032.c b/app/online/mg_ol_0032.c new file mode 100644 index 0000000..c150369 --- /dev/null +++ b/app/online/mg_ol_0032.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/mg_ol_0032.pgc" +/* @tier easy @module mg @transform msg-gateway-online */ +/* + * mg_ol_0032.pgc - 전문게이트웨이 온라인 서비스 (MG_OL_0032) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mg_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/mg_ol_0032.pgc" + + +TX_SERVICE(MG_OL_0032, ctx) +{ + mg_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[MG_OL_0032] 전문게이트웨이 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MG_OL_0032] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = mg_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[MG_OL_0032] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[MG_OL_0032] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mg_ol_0032.pgc b/app/online/mg_ol_0032.pgc new file mode 100644 index 0000000..25d00fc --- /dev/null +++ b/app/online/mg_ol_0032.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module mg @transform msg-gateway-online */ +/* + * mg_ol_0032.pgc - 전문게이트웨이 온라인 서비스 (MG_OL_0032) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mg 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mg_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(MG_OL_0032, ctx) +{ + mg_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[MG_OL_0032] 전문게이트웨이 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MG_OL_0032] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = mg_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[MG_OL_0032] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[MG_OL_0032] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mm_ol_0001.c b/app/online/mm_ol_0001.c new file mode 100644 index 0000000..4ea84db --- /dev/null +++ b/app/online/mm_ol_0001.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/mm_ol_0001.pgc" +/* @tier easy @module mm @transform master-online */ +/* + * mm_ol_0001.pgc - 마스터 온라인 서비스 (MM_OL_0001) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mm_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/mm_ol_0001.pgc" + + +TX_SERVICE(MM_OL_0001, ctx) +{ + mm_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[MM_OL_0001] 마스터 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MM_OL_0001] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = mm_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[MM_OL_0001] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[MM_OL_0001] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mm_ol_0001.pgc b/app/online/mm_ol_0001.pgc new file mode 100644 index 0000000..0d86141 --- /dev/null +++ b/app/online/mm_ol_0001.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module mm @transform master-online */ +/* + * mm_ol_0001.pgc - 마스터 온라인 서비스 (MM_OL_0001) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mm_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(MM_OL_0001, ctx) +{ + mm_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[MM_OL_0001] 마스터 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MM_OL_0001] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = mm_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[MM_OL_0001] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[MM_OL_0001] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mm_ol_0002.c b/app/online/mm_ol_0002.c new file mode 100644 index 0000000..81e642e --- /dev/null +++ b/app/online/mm_ol_0002.c @@ -0,0 +1,176 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/mm_ol_0002.pgc" +/* @tier hard @module mm @transform master-online */ +/* + * mm_ol_0002.pgc - 마스터 온라인 서비스 (MM_OL_0002) [tier=hard] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mm_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/mm_ol_0002.pgc" + + +TX_SERVICE(MM_OL_0002, ctx) +{ + mm_rec_t rec; + char key[16], merch[16], bizdate[16], nextbiz[9]; + long amount = 0, daysum = 0; + int rc; + TXBUF *sub_in; + TXBUF *sub_out; + + tx_log(TX_LOG_INFO, "[MM_OL_0002] 마스터 트랜잭션 오케스트레이션 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MM_OL_0002] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + if (!amount_is_valid(amount) || !date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[MM_OL_0002] 입력 검증 실패 amount=%ld date=%s", + amount, bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + /* 트랜잭션 시작 → 원장 반영 → 후속 서비스 연계 → 커밋 */ + if (tx_begin() != TX_OK) { + tx_return(ctx, TX_FAIL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, MM_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; + + rc = mm_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[MM_OL_0002] 원장반영 실패 rc=%d", rc); + tx_abort(); + tx_return(ctx, rc, ctx->out); + return; + } + + /* 정산 영업일 = 거래일의 다음 영업일 */ + if (date_next_business(bizdate, nextbiz) != 0) { + memcpy(nextbiz, bizdate, 8); + nextbiz[8] = '\0'; + } + + /* 후속 정산집계 서비스 연계 (레지스트리 문자열 디스패치) */ + sub_in = tx_buf_alloc(); + sub_out = tx_buf_alloc(); + if (sub_in && sub_out) { + tx_buf_sets(sub_in, "MERCHID", merch); + tx_buf_sets(sub_in, "BIZDATE", nextbiz); + tx_buf_setlong(sub_in, "AMOUNT", amount); + rc = tx_call("MM_POST", sub_in, sub_out); + if (rc != TX_OK) + tx_log(TX_LOG_WARN, "[MM_OL_0002] 후속연계 경고 rc=%d", rc); + } + tx_buf_free(sub_in); + tx_buf_free(sub_out); + + /* 교차 검증: 당일 합계 재계산 */ + if (mm_rec_sum(bizdate, &daysum) != TX_OK) + daysum = 0; + + tx_commit(); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYSUM", daysum); + tx_log(TX_LOG_INFO, "[MM_OL_0002] 완료 key=%s 당일합계=%ld", key, daysum); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mm_ol_0002.pgc b/app/online/mm_ol_0002.pgc new file mode 100644 index 0000000..e09b3e3 --- /dev/null +++ b/app/online/mm_ol_0002.pgc @@ -0,0 +1,98 @@ +/* @tier hard @module mm @transform master-online */ +/* + * mm_ol_0002.pgc - 마스터 온라인 서비스 (MM_OL_0002) [tier=hard] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mm_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(MM_OL_0002, ctx) +{ + mm_rec_t rec; + char key[16], merch[16], bizdate[16], nextbiz[9]; + long amount = 0, daysum = 0; + int rc; + TXBUF *sub_in; + TXBUF *sub_out; + + tx_log(TX_LOG_INFO, "[MM_OL_0002] 마스터 트랜잭션 오케스트레이션 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MM_OL_0002] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + if (!amount_is_valid(amount) || !date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[MM_OL_0002] 입력 검증 실패 amount=%ld date=%s", + amount, bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + /* 트랜잭션 시작 → 원장 반영 → 후속 서비스 연계 → 커밋 */ + if (tx_begin() != TX_OK) { + tx_return(ctx, TX_FAIL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, MM_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; + + rc = mm_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[MM_OL_0002] 원장반영 실패 rc=%d", rc); + tx_abort(); + tx_return(ctx, rc, ctx->out); + return; + } + + /* 정산 영업일 = 거래일의 다음 영업일 */ + if (date_next_business(bizdate, nextbiz) != 0) { + memcpy(nextbiz, bizdate, 8); + nextbiz[8] = '\0'; + } + + /* 후속 정산집계 서비스 연계 (레지스트리 문자열 디스패치) */ + sub_in = tx_buf_alloc(); + sub_out = tx_buf_alloc(); + if (sub_in && sub_out) { + tx_buf_sets(sub_in, "MERCHID", merch); + tx_buf_sets(sub_in, "BIZDATE", nextbiz); + tx_buf_setlong(sub_in, "AMOUNT", amount); + rc = tx_call("MM_POST", sub_in, sub_out); + if (rc != TX_OK) + tx_log(TX_LOG_WARN, "[MM_OL_0002] 후속연계 경고 rc=%d", rc); + } + tx_buf_free(sub_in); + tx_buf_free(sub_out); + + /* 교차 검증: 당일 합계 재계산 */ + if (mm_rec_sum(bizdate, &daysum) != TX_OK) + daysum = 0; + + tx_commit(); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYSUM", daysum); + tx_log(TX_LOG_INFO, "[MM_OL_0002] 완료 key=%s 당일합계=%ld", key, daysum); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mm_ol_0003.c b/app/online/mm_ol_0003.c new file mode 100644 index 0000000..71354e2 --- /dev/null +++ b/app/online/mm_ol_0003.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/mm_ol_0003.pgc" +/* @tier easy @module mm @transform master-online */ +/* + * mm_ol_0003.pgc - 마스터 온라인 서비스 (MM_OL_0003) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mm_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/mm_ol_0003.pgc" + + +TX_SERVICE(MM_OL_0003, ctx) +{ + mm_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[MM_OL_0003] 마스터 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MM_OL_0003] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = mm_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[MM_OL_0003] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[MM_OL_0003] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mm_ol_0003.pgc b/app/online/mm_ol_0003.pgc new file mode 100644 index 0000000..0d057a6 --- /dev/null +++ b/app/online/mm_ol_0003.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module mm @transform master-online */ +/* + * mm_ol_0003.pgc - 마스터 온라인 서비스 (MM_OL_0003) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mm_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(MM_OL_0003, ctx) +{ + mm_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[MM_OL_0003] 마스터 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MM_OL_0003] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = mm_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[MM_OL_0003] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[MM_OL_0003] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mm_ol_0004.c b/app/online/mm_ol_0004.c new file mode 100644 index 0000000..c7365d9 --- /dev/null +++ b/app/online/mm_ol_0004.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/mm_ol_0004.pgc" +/* @tier easy @module mm @transform master-online */ +/* + * mm_ol_0004.pgc - 마스터 온라인 서비스 (MM_OL_0004) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mm_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/mm_ol_0004.pgc" + + +TX_SERVICE(MM_OL_0004, ctx) +{ + mm_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[MM_OL_0004] 마스터 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MM_OL_0004] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = mm_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[MM_OL_0004] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[MM_OL_0004] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mm_ol_0004.pgc b/app/online/mm_ol_0004.pgc new file mode 100644 index 0000000..5c4a6c1 --- /dev/null +++ b/app/online/mm_ol_0004.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module mm @transform master-online */ +/* + * mm_ol_0004.pgc - 마스터 온라인 서비스 (MM_OL_0004) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mm_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(MM_OL_0004, ctx) +{ + mm_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[MM_OL_0004] 마스터 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MM_OL_0004] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = mm_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[MM_OL_0004] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[MM_OL_0004] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mm_ol_0005.c b/app/online/mm_ol_0005.c new file mode 100644 index 0000000..7117d7d --- /dev/null +++ b/app/online/mm_ol_0005.c @@ -0,0 +1,148 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/mm_ol_0005.pgc" +/* @tier medium @module mm @transform master-online */ +/* + * mm_ol_0005.pgc - 마스터 온라인 서비스 (MM_OL_0005) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mm_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/mm_ol_0005.pgc" + + +TX_SERVICE(MM_OL_0005, ctx) +{ + mm_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[MM_OL_0005] 마스터 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MM_OL_0005] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[MM_OL_0005] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[MM_OL_0005] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, MM_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = mm_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[MM_OL_0005] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = mm_rec_count(bizdate, MM_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[MM_OL_0005] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mm_ol_0005.pgc b/app/online/mm_ol_0005.pgc new file mode 100644 index 0000000..1c61ffe --- /dev/null +++ b/app/online/mm_ol_0005.pgc @@ -0,0 +1,70 @@ +/* @tier medium @module mm @transform master-online */ +/* + * mm_ol_0005.pgc - 마스터 온라인 서비스 (MM_OL_0005) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mm_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(MM_OL_0005, ctx) +{ + mm_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[MM_OL_0005] 마스터 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MM_OL_0005] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[MM_OL_0005] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[MM_OL_0005] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, MM_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = mm_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[MM_OL_0005] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = mm_rec_count(bizdate, MM_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[MM_OL_0005] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mm_ol_0006.c b/app/online/mm_ol_0006.c new file mode 100644 index 0000000..21016e0 --- /dev/null +++ b/app/online/mm_ol_0006.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/mm_ol_0006.pgc" +/* @tier easy @module mm @transform master-online */ +/* + * mm_ol_0006.pgc - 마스터 온라인 서비스 (MM_OL_0006) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mm_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/mm_ol_0006.pgc" + + +TX_SERVICE(MM_OL_0006, ctx) +{ + mm_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[MM_OL_0006] 마스터 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MM_OL_0006] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = mm_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[MM_OL_0006] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[MM_OL_0006] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mm_ol_0006.pgc b/app/online/mm_ol_0006.pgc new file mode 100644 index 0000000..9c482ad --- /dev/null +++ b/app/online/mm_ol_0006.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module mm @transform master-online */ +/* + * mm_ol_0006.pgc - 마스터 온라인 서비스 (MM_OL_0006) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mm_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(MM_OL_0006, ctx) +{ + mm_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[MM_OL_0006] 마스터 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MM_OL_0006] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = mm_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[MM_OL_0006] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[MM_OL_0006] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mm_ol_0007.c b/app/online/mm_ol_0007.c new file mode 100644 index 0000000..4d228fa --- /dev/null +++ b/app/online/mm_ol_0007.c @@ -0,0 +1,148 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/mm_ol_0007.pgc" +/* @tier medium @module mm @transform master-online */ +/* + * mm_ol_0007.pgc - 마스터 온라인 서비스 (MM_OL_0007) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mm_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/mm_ol_0007.pgc" + + +TX_SERVICE(MM_OL_0007, ctx) +{ + mm_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[MM_OL_0007] 마스터 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MM_OL_0007] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[MM_OL_0007] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[MM_OL_0007] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, MM_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = mm_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[MM_OL_0007] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = mm_rec_count(bizdate, MM_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[MM_OL_0007] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mm_ol_0007.pgc b/app/online/mm_ol_0007.pgc new file mode 100644 index 0000000..1b88b46 --- /dev/null +++ b/app/online/mm_ol_0007.pgc @@ -0,0 +1,70 @@ +/* @tier medium @module mm @transform master-online */ +/* + * mm_ol_0007.pgc - 마스터 온라인 서비스 (MM_OL_0007) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mm_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(MM_OL_0007, ctx) +{ + mm_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[MM_OL_0007] 마스터 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MM_OL_0007] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[MM_OL_0007] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[MM_OL_0007] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, MM_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = mm_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[MM_OL_0007] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = mm_rec_count(bizdate, MM_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[MM_OL_0007] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mm_ol_0008.c b/app/online/mm_ol_0008.c new file mode 100644 index 0000000..6cacd22 --- /dev/null +++ b/app/online/mm_ol_0008.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/mm_ol_0008.pgc" +/* @tier easy @module mm @transform master-online */ +/* + * mm_ol_0008.pgc - 마스터 온라인 서비스 (MM_OL_0008) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mm_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/mm_ol_0008.pgc" + + +TX_SERVICE(MM_OL_0008, ctx) +{ + mm_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[MM_OL_0008] 마스터 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MM_OL_0008] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = mm_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[MM_OL_0008] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[MM_OL_0008] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mm_ol_0008.pgc b/app/online/mm_ol_0008.pgc new file mode 100644 index 0000000..d9a41cf --- /dev/null +++ b/app/online/mm_ol_0008.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module mm @transform master-online */ +/* + * mm_ol_0008.pgc - 마스터 온라인 서비스 (MM_OL_0008) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mm_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(MM_OL_0008, ctx) +{ + mm_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[MM_OL_0008] 마스터 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MM_OL_0008] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = mm_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[MM_OL_0008] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[MM_OL_0008] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mm_ol_0009.c b/app/online/mm_ol_0009.c new file mode 100644 index 0000000..139fef9 --- /dev/null +++ b/app/online/mm_ol_0009.c @@ -0,0 +1,148 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/mm_ol_0009.pgc" +/* @tier medium @module mm @transform master-online */ +/* + * mm_ol_0009.pgc - 마스터 온라인 서비스 (MM_OL_0009) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mm_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/mm_ol_0009.pgc" + + +TX_SERVICE(MM_OL_0009, ctx) +{ + mm_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[MM_OL_0009] 마스터 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MM_OL_0009] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[MM_OL_0009] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[MM_OL_0009] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, MM_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = mm_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[MM_OL_0009] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = mm_rec_count(bizdate, MM_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[MM_OL_0009] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mm_ol_0009.pgc b/app/online/mm_ol_0009.pgc new file mode 100644 index 0000000..4f37bdd --- /dev/null +++ b/app/online/mm_ol_0009.pgc @@ -0,0 +1,70 @@ +/* @tier medium @module mm @transform master-online */ +/* + * mm_ol_0009.pgc - 마스터 온라인 서비스 (MM_OL_0009) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mm_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(MM_OL_0009, ctx) +{ + mm_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[MM_OL_0009] 마스터 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MM_OL_0009] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[MM_OL_0009] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[MM_OL_0009] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, MM_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = mm_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[MM_OL_0009] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = mm_rec_count(bizdate, MM_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[MM_OL_0009] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mm_ol_0010.c b/app/online/mm_ol_0010.c new file mode 100644 index 0000000..90333ec --- /dev/null +++ b/app/online/mm_ol_0010.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/mm_ol_0010.pgc" +/* @tier easy @module mm @transform master-online */ +/* + * mm_ol_0010.pgc - 마스터 온라인 서비스 (MM_OL_0010) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mm_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/mm_ol_0010.pgc" + + +TX_SERVICE(MM_OL_0010, ctx) +{ + mm_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[MM_OL_0010] 마스터 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MM_OL_0010] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = mm_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[MM_OL_0010] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[MM_OL_0010] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mm_ol_0010.pgc b/app/online/mm_ol_0010.pgc new file mode 100644 index 0000000..9e992c5 --- /dev/null +++ b/app/online/mm_ol_0010.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module mm @transform master-online */ +/* + * mm_ol_0010.pgc - 마스터 온라인 서비스 (MM_OL_0010) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mm_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(MM_OL_0010, ctx) +{ + mm_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[MM_OL_0010] 마스터 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MM_OL_0010] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = mm_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[MM_OL_0010] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[MM_OL_0010] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mm_ol_0011.c b/app/online/mm_ol_0011.c new file mode 100644 index 0000000..f97426a --- /dev/null +++ b/app/online/mm_ol_0011.c @@ -0,0 +1,176 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/mm_ol_0011.pgc" +/* @tier hard @module mm @transform master-online */ +/* + * mm_ol_0011.pgc - 마스터 온라인 서비스 (MM_OL_0011) [tier=hard] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mm_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/mm_ol_0011.pgc" + + +TX_SERVICE(MM_OL_0011, ctx) +{ + mm_rec_t rec; + char key[16], merch[16], bizdate[16], nextbiz[9]; + long amount = 0, daysum = 0; + int rc; + TXBUF *sub_in; + TXBUF *sub_out; + + tx_log(TX_LOG_INFO, "[MM_OL_0011] 마스터 트랜잭션 오케스트레이션 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MM_OL_0011] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + if (!amount_is_valid(amount) || !date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[MM_OL_0011] 입력 검증 실패 amount=%ld date=%s", + amount, bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + /* 트랜잭션 시작 → 원장 반영 → 후속 서비스 연계 → 커밋 */ + if (tx_begin() != TX_OK) { + tx_return(ctx, TX_FAIL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, MM_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; + + rc = mm_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[MM_OL_0011] 원장반영 실패 rc=%d", rc); + tx_abort(); + tx_return(ctx, rc, ctx->out); + return; + } + + /* 정산 영업일 = 거래일의 다음 영업일 */ + if (date_next_business(bizdate, nextbiz) != 0) { + memcpy(nextbiz, bizdate, 8); + nextbiz[8] = '\0'; + } + + /* 후속 정산집계 서비스 연계 (레지스트리 문자열 디스패치) */ + sub_in = tx_buf_alloc(); + sub_out = tx_buf_alloc(); + if (sub_in && sub_out) { + tx_buf_sets(sub_in, "MERCHID", merch); + tx_buf_sets(sub_in, "BIZDATE", nextbiz); + tx_buf_setlong(sub_in, "AMOUNT", amount); + rc = tx_call("MM_POST", sub_in, sub_out); + if (rc != TX_OK) + tx_log(TX_LOG_WARN, "[MM_OL_0011] 후속연계 경고 rc=%d", rc); + } + tx_buf_free(sub_in); + tx_buf_free(sub_out); + + /* 교차 검증: 당일 합계 재계산 */ + if (mm_rec_sum(bizdate, &daysum) != TX_OK) + daysum = 0; + + tx_commit(); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYSUM", daysum); + tx_log(TX_LOG_INFO, "[MM_OL_0011] 완료 key=%s 당일합계=%ld", key, daysum); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mm_ol_0011.pgc b/app/online/mm_ol_0011.pgc new file mode 100644 index 0000000..a48e36d --- /dev/null +++ b/app/online/mm_ol_0011.pgc @@ -0,0 +1,98 @@ +/* @tier hard @module mm @transform master-online */ +/* + * mm_ol_0011.pgc - 마스터 온라인 서비스 (MM_OL_0011) [tier=hard] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mm_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(MM_OL_0011, ctx) +{ + mm_rec_t rec; + char key[16], merch[16], bizdate[16], nextbiz[9]; + long amount = 0, daysum = 0; + int rc; + TXBUF *sub_in; + TXBUF *sub_out; + + tx_log(TX_LOG_INFO, "[MM_OL_0011] 마스터 트랜잭션 오케스트레이션 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MM_OL_0011] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + if (!amount_is_valid(amount) || !date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[MM_OL_0011] 입력 검증 실패 amount=%ld date=%s", + amount, bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + /* 트랜잭션 시작 → 원장 반영 → 후속 서비스 연계 → 커밋 */ + if (tx_begin() != TX_OK) { + tx_return(ctx, TX_FAIL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, MM_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; + + rc = mm_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[MM_OL_0011] 원장반영 실패 rc=%d", rc); + tx_abort(); + tx_return(ctx, rc, ctx->out); + return; + } + + /* 정산 영업일 = 거래일의 다음 영업일 */ + if (date_next_business(bizdate, nextbiz) != 0) { + memcpy(nextbiz, bizdate, 8); + nextbiz[8] = '\0'; + } + + /* 후속 정산집계 서비스 연계 (레지스트리 문자열 디스패치) */ + sub_in = tx_buf_alloc(); + sub_out = tx_buf_alloc(); + if (sub_in && sub_out) { + tx_buf_sets(sub_in, "MERCHID", merch); + tx_buf_sets(sub_in, "BIZDATE", nextbiz); + tx_buf_setlong(sub_in, "AMOUNT", amount); + rc = tx_call("MM_POST", sub_in, sub_out); + if (rc != TX_OK) + tx_log(TX_LOG_WARN, "[MM_OL_0011] 후속연계 경고 rc=%d", rc); + } + tx_buf_free(sub_in); + tx_buf_free(sub_out); + + /* 교차 검증: 당일 합계 재계산 */ + if (mm_rec_sum(bizdate, &daysum) != TX_OK) + daysum = 0; + + tx_commit(); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYSUM", daysum); + tx_log(TX_LOG_INFO, "[MM_OL_0011] 완료 key=%s 당일합계=%ld", key, daysum); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mm_ol_0012.c b/app/online/mm_ol_0012.c new file mode 100644 index 0000000..2b4bf46 --- /dev/null +++ b/app/online/mm_ol_0012.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/mm_ol_0012.pgc" +/* @tier easy @module mm @transform master-online */ +/* + * mm_ol_0012.pgc - 마스터 온라인 서비스 (MM_OL_0012) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mm_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/mm_ol_0012.pgc" + + +TX_SERVICE(MM_OL_0012, ctx) +{ + mm_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[MM_OL_0012] 마스터 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MM_OL_0012] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = mm_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[MM_OL_0012] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[MM_OL_0012] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mm_ol_0012.pgc b/app/online/mm_ol_0012.pgc new file mode 100644 index 0000000..464c98e --- /dev/null +++ b/app/online/mm_ol_0012.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module mm @transform master-online */ +/* + * mm_ol_0012.pgc - 마스터 온라인 서비스 (MM_OL_0012) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mm_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(MM_OL_0012, ctx) +{ + mm_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[MM_OL_0012] 마스터 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MM_OL_0012] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = mm_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[MM_OL_0012] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[MM_OL_0012] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mm_ol_0013.c b/app/online/mm_ol_0013.c new file mode 100644 index 0000000..00c69f6 --- /dev/null +++ b/app/online/mm_ol_0013.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/mm_ol_0013.pgc" +/* @tier easy @module mm @transform master-online */ +/* + * mm_ol_0013.pgc - 마스터 온라인 서비스 (MM_OL_0013) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mm_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/mm_ol_0013.pgc" + + +TX_SERVICE(MM_OL_0013, ctx) +{ + mm_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[MM_OL_0013] 마스터 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MM_OL_0013] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = mm_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[MM_OL_0013] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[MM_OL_0013] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mm_ol_0013.pgc b/app/online/mm_ol_0013.pgc new file mode 100644 index 0000000..4837745 --- /dev/null +++ b/app/online/mm_ol_0013.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module mm @transform master-online */ +/* + * mm_ol_0013.pgc - 마스터 온라인 서비스 (MM_OL_0013) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mm_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(MM_OL_0013, ctx) +{ + mm_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[MM_OL_0013] 마스터 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MM_OL_0013] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = mm_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[MM_OL_0013] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[MM_OL_0013] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mm_ol_0014.c b/app/online/mm_ol_0014.c new file mode 100644 index 0000000..f0385a0 --- /dev/null +++ b/app/online/mm_ol_0014.c @@ -0,0 +1,148 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/mm_ol_0014.pgc" +/* @tier medium @module mm @transform master-online */ +/* + * mm_ol_0014.pgc - 마스터 온라인 서비스 (MM_OL_0014) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mm_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/mm_ol_0014.pgc" + + +TX_SERVICE(MM_OL_0014, ctx) +{ + mm_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[MM_OL_0014] 마스터 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MM_OL_0014] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[MM_OL_0014] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[MM_OL_0014] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, MM_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = mm_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[MM_OL_0014] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = mm_rec_count(bizdate, MM_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[MM_OL_0014] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mm_ol_0014.pgc b/app/online/mm_ol_0014.pgc new file mode 100644 index 0000000..3197435 --- /dev/null +++ b/app/online/mm_ol_0014.pgc @@ -0,0 +1,70 @@ +/* @tier medium @module mm @transform master-online */ +/* + * mm_ol_0014.pgc - 마스터 온라인 서비스 (MM_OL_0014) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mm_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(MM_OL_0014, ctx) +{ + mm_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[MM_OL_0014] 마스터 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MM_OL_0014] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[MM_OL_0014] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[MM_OL_0014] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, MM_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = mm_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[MM_OL_0014] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = mm_rec_count(bizdate, MM_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[MM_OL_0014] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mm_ol_0015.c b/app/online/mm_ol_0015.c new file mode 100644 index 0000000..729bd41 --- /dev/null +++ b/app/online/mm_ol_0015.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/mm_ol_0015.pgc" +/* @tier easy @module mm @transform master-online */ +/* + * mm_ol_0015.pgc - 마스터 온라인 서비스 (MM_OL_0015) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mm_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/mm_ol_0015.pgc" + + +TX_SERVICE(MM_OL_0015, ctx) +{ + mm_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[MM_OL_0015] 마스터 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MM_OL_0015] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = mm_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[MM_OL_0015] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[MM_OL_0015] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mm_ol_0015.pgc b/app/online/mm_ol_0015.pgc new file mode 100644 index 0000000..d7a1de2 --- /dev/null +++ b/app/online/mm_ol_0015.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module mm @transform master-online */ +/* + * mm_ol_0015.pgc - 마스터 온라인 서비스 (MM_OL_0015) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mm_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(MM_OL_0015, ctx) +{ + mm_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[MM_OL_0015] 마스터 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MM_OL_0015] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = mm_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[MM_OL_0015] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[MM_OL_0015] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mm_ol_0016.c b/app/online/mm_ol_0016.c new file mode 100644 index 0000000..46154d6 --- /dev/null +++ b/app/online/mm_ol_0016.c @@ -0,0 +1,148 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/mm_ol_0016.pgc" +/* @tier medium @module mm @transform master-online */ +/* + * mm_ol_0016.pgc - 마스터 온라인 서비스 (MM_OL_0016) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mm_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/mm_ol_0016.pgc" + + +TX_SERVICE(MM_OL_0016, ctx) +{ + mm_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[MM_OL_0016] 마스터 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MM_OL_0016] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[MM_OL_0016] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[MM_OL_0016] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, MM_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = mm_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[MM_OL_0016] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = mm_rec_count(bizdate, MM_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[MM_OL_0016] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mm_ol_0016.pgc b/app/online/mm_ol_0016.pgc new file mode 100644 index 0000000..ff028b7 --- /dev/null +++ b/app/online/mm_ol_0016.pgc @@ -0,0 +1,70 @@ +/* @tier medium @module mm @transform master-online */ +/* + * mm_ol_0016.pgc - 마스터 온라인 서비스 (MM_OL_0016) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mm_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(MM_OL_0016, ctx) +{ + mm_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[MM_OL_0016] 마스터 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MM_OL_0016] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[MM_OL_0016] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[MM_OL_0016] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, MM_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = mm_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[MM_OL_0016] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = mm_rec_count(bizdate, MM_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[MM_OL_0016] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mm_ol_0017.c b/app/online/mm_ol_0017.c new file mode 100644 index 0000000..2c7f618 --- /dev/null +++ b/app/online/mm_ol_0017.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/mm_ol_0017.pgc" +/* @tier easy @module mm @transform master-online */ +/* + * mm_ol_0017.pgc - 마스터 온라인 서비스 (MM_OL_0017) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mm_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/mm_ol_0017.pgc" + + +TX_SERVICE(MM_OL_0017, ctx) +{ + mm_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[MM_OL_0017] 마스터 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MM_OL_0017] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = mm_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[MM_OL_0017] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[MM_OL_0017] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mm_ol_0017.pgc b/app/online/mm_ol_0017.pgc new file mode 100644 index 0000000..f02f42c --- /dev/null +++ b/app/online/mm_ol_0017.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module mm @transform master-online */ +/* + * mm_ol_0017.pgc - 마스터 온라인 서비스 (MM_OL_0017) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mm_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(MM_OL_0017, ctx) +{ + mm_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[MM_OL_0017] 마스터 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MM_OL_0017] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = mm_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[MM_OL_0017] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[MM_OL_0017] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mm_ol_0018.c b/app/online/mm_ol_0018.c new file mode 100644 index 0000000..f5457c3 --- /dev/null +++ b/app/online/mm_ol_0018.c @@ -0,0 +1,148 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/mm_ol_0018.pgc" +/* @tier medium @module mm @transform master-online */ +/* + * mm_ol_0018.pgc - 마스터 온라인 서비스 (MM_OL_0018) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mm_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/mm_ol_0018.pgc" + + +TX_SERVICE(MM_OL_0018, ctx) +{ + mm_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[MM_OL_0018] 마스터 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MM_OL_0018] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[MM_OL_0018] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[MM_OL_0018] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, MM_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = mm_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[MM_OL_0018] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = mm_rec_count(bizdate, MM_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[MM_OL_0018] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mm_ol_0018.pgc b/app/online/mm_ol_0018.pgc new file mode 100644 index 0000000..101a1b2 --- /dev/null +++ b/app/online/mm_ol_0018.pgc @@ -0,0 +1,70 @@ +/* @tier medium @module mm @transform master-online */ +/* + * mm_ol_0018.pgc - 마스터 온라인 서비스 (MM_OL_0018) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mm_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(MM_OL_0018, ctx) +{ + mm_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[MM_OL_0018] 마스터 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MM_OL_0018] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[MM_OL_0018] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[MM_OL_0018] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, MM_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = mm_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[MM_OL_0018] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = mm_rec_count(bizdate, MM_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[MM_OL_0018] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mm_ol_0019.c b/app/online/mm_ol_0019.c new file mode 100644 index 0000000..c9ed9aa --- /dev/null +++ b/app/online/mm_ol_0019.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/mm_ol_0019.pgc" +/* @tier easy @module mm @transform master-online */ +/* + * mm_ol_0019.pgc - 마스터 온라인 서비스 (MM_OL_0019) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mm_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/mm_ol_0019.pgc" + + +TX_SERVICE(MM_OL_0019, ctx) +{ + mm_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[MM_OL_0019] 마스터 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MM_OL_0019] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = mm_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[MM_OL_0019] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[MM_OL_0019] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mm_ol_0019.pgc b/app/online/mm_ol_0019.pgc new file mode 100644 index 0000000..03c94e6 --- /dev/null +++ b/app/online/mm_ol_0019.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module mm @transform master-online */ +/* + * mm_ol_0019.pgc - 마스터 온라인 서비스 (MM_OL_0019) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mm_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(MM_OL_0019, ctx) +{ + mm_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[MM_OL_0019] 마스터 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MM_OL_0019] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = mm_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[MM_OL_0019] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[MM_OL_0019] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mm_ol_0020.c b/app/online/mm_ol_0020.c new file mode 100644 index 0000000..ca6c3a8 --- /dev/null +++ b/app/online/mm_ol_0020.c @@ -0,0 +1,176 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/mm_ol_0020.pgc" +/* @tier hard @module mm @transform master-online */ +/* + * mm_ol_0020.pgc - 마스터 온라인 서비스 (MM_OL_0020) [tier=hard] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mm_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/mm_ol_0020.pgc" + + +TX_SERVICE(MM_OL_0020, ctx) +{ + mm_rec_t rec; + char key[16], merch[16], bizdate[16], nextbiz[9]; + long amount = 0, daysum = 0; + int rc; + TXBUF *sub_in; + TXBUF *sub_out; + + tx_log(TX_LOG_INFO, "[MM_OL_0020] 마스터 트랜잭션 오케스트레이션 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MM_OL_0020] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + if (!amount_is_valid(amount) || !date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[MM_OL_0020] 입력 검증 실패 amount=%ld date=%s", + amount, bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + /* 트랜잭션 시작 → 원장 반영 → 후속 서비스 연계 → 커밋 */ + if (tx_begin() != TX_OK) { + tx_return(ctx, TX_FAIL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, MM_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; + + rc = mm_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[MM_OL_0020] 원장반영 실패 rc=%d", rc); + tx_abort(); + tx_return(ctx, rc, ctx->out); + return; + } + + /* 정산 영업일 = 거래일의 다음 영업일 */ + if (date_next_business(bizdate, nextbiz) != 0) { + memcpy(nextbiz, bizdate, 8); + nextbiz[8] = '\0'; + } + + /* 후속 정산집계 서비스 연계 (레지스트리 문자열 디스패치) */ + sub_in = tx_buf_alloc(); + sub_out = tx_buf_alloc(); + if (sub_in && sub_out) { + tx_buf_sets(sub_in, "MERCHID", merch); + tx_buf_sets(sub_in, "BIZDATE", nextbiz); + tx_buf_setlong(sub_in, "AMOUNT", amount); + rc = tx_call("MM_POST", sub_in, sub_out); + if (rc != TX_OK) + tx_log(TX_LOG_WARN, "[MM_OL_0020] 후속연계 경고 rc=%d", rc); + } + tx_buf_free(sub_in); + tx_buf_free(sub_out); + + /* 교차 검증: 당일 합계 재계산 */ + if (mm_rec_sum(bizdate, &daysum) != TX_OK) + daysum = 0; + + tx_commit(); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYSUM", daysum); + tx_log(TX_LOG_INFO, "[MM_OL_0020] 완료 key=%s 당일합계=%ld", key, daysum); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mm_ol_0020.pgc b/app/online/mm_ol_0020.pgc new file mode 100644 index 0000000..fbc8fcd --- /dev/null +++ b/app/online/mm_ol_0020.pgc @@ -0,0 +1,98 @@ +/* @tier hard @module mm @transform master-online */ +/* + * mm_ol_0020.pgc - 마스터 온라인 서비스 (MM_OL_0020) [tier=hard] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mm_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(MM_OL_0020, ctx) +{ + mm_rec_t rec; + char key[16], merch[16], bizdate[16], nextbiz[9]; + long amount = 0, daysum = 0; + int rc; + TXBUF *sub_in; + TXBUF *sub_out; + + tx_log(TX_LOG_INFO, "[MM_OL_0020] 마스터 트랜잭션 오케스트레이션 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MM_OL_0020] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + if (!amount_is_valid(amount) || !date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[MM_OL_0020] 입력 검증 실패 amount=%ld date=%s", + amount, bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + /* 트랜잭션 시작 → 원장 반영 → 후속 서비스 연계 → 커밋 */ + if (tx_begin() != TX_OK) { + tx_return(ctx, TX_FAIL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, MM_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; + + rc = mm_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[MM_OL_0020] 원장반영 실패 rc=%d", rc); + tx_abort(); + tx_return(ctx, rc, ctx->out); + return; + } + + /* 정산 영업일 = 거래일의 다음 영업일 */ + if (date_next_business(bizdate, nextbiz) != 0) { + memcpy(nextbiz, bizdate, 8); + nextbiz[8] = '\0'; + } + + /* 후속 정산집계 서비스 연계 (레지스트리 문자열 디스패치) */ + sub_in = tx_buf_alloc(); + sub_out = tx_buf_alloc(); + if (sub_in && sub_out) { + tx_buf_sets(sub_in, "MERCHID", merch); + tx_buf_sets(sub_in, "BIZDATE", nextbiz); + tx_buf_setlong(sub_in, "AMOUNT", amount); + rc = tx_call("MM_POST", sub_in, sub_out); + if (rc != TX_OK) + tx_log(TX_LOG_WARN, "[MM_OL_0020] 후속연계 경고 rc=%d", rc); + } + tx_buf_free(sub_in); + tx_buf_free(sub_out); + + /* 교차 검증: 당일 합계 재계산 */ + if (mm_rec_sum(bizdate, &daysum) != TX_OK) + daysum = 0; + + tx_commit(); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYSUM", daysum); + tx_log(TX_LOG_INFO, "[MM_OL_0020] 완료 key=%s 당일합계=%ld", key, daysum); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mm_ol_0021.c b/app/online/mm_ol_0021.c new file mode 100644 index 0000000..67a83e7 --- /dev/null +++ b/app/online/mm_ol_0021.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/mm_ol_0021.pgc" +/* @tier easy @module mm @transform master-online */ +/* + * mm_ol_0021.pgc - 마스터 온라인 서비스 (MM_OL_0021) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mm_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/mm_ol_0021.pgc" + + +TX_SERVICE(MM_OL_0021, ctx) +{ + mm_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[MM_OL_0021] 마스터 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MM_OL_0021] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = mm_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[MM_OL_0021] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[MM_OL_0021] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mm_ol_0021.pgc b/app/online/mm_ol_0021.pgc new file mode 100644 index 0000000..6c6c294 --- /dev/null +++ b/app/online/mm_ol_0021.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module mm @transform master-online */ +/* + * mm_ol_0021.pgc - 마스터 온라인 서비스 (MM_OL_0021) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mm_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(MM_OL_0021, ctx) +{ + mm_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[MM_OL_0021] 마스터 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MM_OL_0021] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = mm_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[MM_OL_0021] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[MM_OL_0021] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mm_ol_0022.c b/app/online/mm_ol_0022.c new file mode 100644 index 0000000..40df1cc --- /dev/null +++ b/app/online/mm_ol_0022.c @@ -0,0 +1,176 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/mm_ol_0022.pgc" +/* @tier hard @module mm @transform master-online */ +/* + * mm_ol_0022.pgc - 마스터 온라인 서비스 (MM_OL_0022) [tier=hard] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mm_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/mm_ol_0022.pgc" + + +TX_SERVICE(MM_OL_0022, ctx) +{ + mm_rec_t rec; + char key[16], merch[16], bizdate[16], nextbiz[9]; + long amount = 0, daysum = 0; + int rc; + TXBUF *sub_in; + TXBUF *sub_out; + + tx_log(TX_LOG_INFO, "[MM_OL_0022] 마스터 트랜잭션 오케스트레이션 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MM_OL_0022] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + if (!amount_is_valid(amount) || !date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[MM_OL_0022] 입력 검증 실패 amount=%ld date=%s", + amount, bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + /* 트랜잭션 시작 → 원장 반영 → 후속 서비스 연계 → 커밋 */ + if (tx_begin() != TX_OK) { + tx_return(ctx, TX_FAIL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, MM_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; + + rc = mm_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[MM_OL_0022] 원장반영 실패 rc=%d", rc); + tx_abort(); + tx_return(ctx, rc, ctx->out); + return; + } + + /* 정산 영업일 = 거래일의 다음 영업일 */ + if (date_next_business(bizdate, nextbiz) != 0) { + memcpy(nextbiz, bizdate, 8); + nextbiz[8] = '\0'; + } + + /* 후속 정산집계 서비스 연계 (레지스트리 문자열 디스패치) */ + sub_in = tx_buf_alloc(); + sub_out = tx_buf_alloc(); + if (sub_in && sub_out) { + tx_buf_sets(sub_in, "MERCHID", merch); + tx_buf_sets(sub_in, "BIZDATE", nextbiz); + tx_buf_setlong(sub_in, "AMOUNT", amount); + rc = tx_call("MM_POST", sub_in, sub_out); + if (rc != TX_OK) + tx_log(TX_LOG_WARN, "[MM_OL_0022] 후속연계 경고 rc=%d", rc); + } + tx_buf_free(sub_in); + tx_buf_free(sub_out); + + /* 교차 검증: 당일 합계 재계산 */ + if (mm_rec_sum(bizdate, &daysum) != TX_OK) + daysum = 0; + + tx_commit(); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYSUM", daysum); + tx_log(TX_LOG_INFO, "[MM_OL_0022] 완료 key=%s 당일합계=%ld", key, daysum); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mm_ol_0022.pgc b/app/online/mm_ol_0022.pgc new file mode 100644 index 0000000..01e9c1f --- /dev/null +++ b/app/online/mm_ol_0022.pgc @@ -0,0 +1,98 @@ +/* @tier hard @module mm @transform master-online */ +/* + * mm_ol_0022.pgc - 마스터 온라인 서비스 (MM_OL_0022) [tier=hard] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mm_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(MM_OL_0022, ctx) +{ + mm_rec_t rec; + char key[16], merch[16], bizdate[16], nextbiz[9]; + long amount = 0, daysum = 0; + int rc; + TXBUF *sub_in; + TXBUF *sub_out; + + tx_log(TX_LOG_INFO, "[MM_OL_0022] 마스터 트랜잭션 오케스트레이션 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MM_OL_0022] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + if (!amount_is_valid(amount) || !date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[MM_OL_0022] 입력 검증 실패 amount=%ld date=%s", + amount, bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + /* 트랜잭션 시작 → 원장 반영 → 후속 서비스 연계 → 커밋 */ + if (tx_begin() != TX_OK) { + tx_return(ctx, TX_FAIL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, MM_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; + + rc = mm_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[MM_OL_0022] 원장반영 실패 rc=%d", rc); + tx_abort(); + tx_return(ctx, rc, ctx->out); + return; + } + + /* 정산 영업일 = 거래일의 다음 영업일 */ + if (date_next_business(bizdate, nextbiz) != 0) { + memcpy(nextbiz, bizdate, 8); + nextbiz[8] = '\0'; + } + + /* 후속 정산집계 서비스 연계 (레지스트리 문자열 디스패치) */ + sub_in = tx_buf_alloc(); + sub_out = tx_buf_alloc(); + if (sub_in && sub_out) { + tx_buf_sets(sub_in, "MERCHID", merch); + tx_buf_sets(sub_in, "BIZDATE", nextbiz); + tx_buf_setlong(sub_in, "AMOUNT", amount); + rc = tx_call("MM_POST", sub_in, sub_out); + if (rc != TX_OK) + tx_log(TX_LOG_WARN, "[MM_OL_0022] 후속연계 경고 rc=%d", rc); + } + tx_buf_free(sub_in); + tx_buf_free(sub_out); + + /* 교차 검증: 당일 합계 재계산 */ + if (mm_rec_sum(bizdate, &daysum) != TX_OK) + daysum = 0; + + tx_commit(); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYSUM", daysum); + tx_log(TX_LOG_INFO, "[MM_OL_0022] 완료 key=%s 당일합계=%ld", key, daysum); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mm_ol_0023.c b/app/online/mm_ol_0023.c new file mode 100644 index 0000000..825ddd0 --- /dev/null +++ b/app/online/mm_ol_0023.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/mm_ol_0023.pgc" +/* @tier easy @module mm @transform master-online */ +/* + * mm_ol_0023.pgc - 마스터 온라인 서비스 (MM_OL_0023) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mm_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/mm_ol_0023.pgc" + + +TX_SERVICE(MM_OL_0023, ctx) +{ + mm_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[MM_OL_0023] 마스터 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MM_OL_0023] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = mm_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[MM_OL_0023] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[MM_OL_0023] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mm_ol_0023.pgc b/app/online/mm_ol_0023.pgc new file mode 100644 index 0000000..be94038 --- /dev/null +++ b/app/online/mm_ol_0023.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module mm @transform master-online */ +/* + * mm_ol_0023.pgc - 마스터 온라인 서비스 (MM_OL_0023) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mm_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(MM_OL_0023, ctx) +{ + mm_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[MM_OL_0023] 마스터 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MM_OL_0023] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = mm_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[MM_OL_0023] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[MM_OL_0023] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mm_ol_0024.c b/app/online/mm_ol_0024.c new file mode 100644 index 0000000..a996fe5 --- /dev/null +++ b/app/online/mm_ol_0024.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/mm_ol_0024.pgc" +/* @tier easy @module mm @transform master-online */ +/* + * mm_ol_0024.pgc - 마스터 온라인 서비스 (MM_OL_0024) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mm_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/mm_ol_0024.pgc" + + +TX_SERVICE(MM_OL_0024, ctx) +{ + mm_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[MM_OL_0024] 마스터 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MM_OL_0024] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = mm_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[MM_OL_0024] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[MM_OL_0024] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mm_ol_0024.pgc b/app/online/mm_ol_0024.pgc new file mode 100644 index 0000000..a014f13 --- /dev/null +++ b/app/online/mm_ol_0024.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module mm @transform master-online */ +/* + * mm_ol_0024.pgc - 마스터 온라인 서비스 (MM_OL_0024) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mm_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(MM_OL_0024, ctx) +{ + mm_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[MM_OL_0024] 마스터 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MM_OL_0024] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = mm_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[MM_OL_0024] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[MM_OL_0024] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mm_ol_0025.c b/app/online/mm_ol_0025.c new file mode 100644 index 0000000..fe7131a --- /dev/null +++ b/app/online/mm_ol_0025.c @@ -0,0 +1,148 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/mm_ol_0025.pgc" +/* @tier medium @module mm @transform master-online */ +/* + * mm_ol_0025.pgc - 마스터 온라인 서비스 (MM_OL_0025) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mm_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/mm_ol_0025.pgc" + + +TX_SERVICE(MM_OL_0025, ctx) +{ + mm_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[MM_OL_0025] 마스터 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MM_OL_0025] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[MM_OL_0025] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[MM_OL_0025] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, MM_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = mm_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[MM_OL_0025] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = mm_rec_count(bizdate, MM_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[MM_OL_0025] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mm_ol_0025.pgc b/app/online/mm_ol_0025.pgc new file mode 100644 index 0000000..723b425 --- /dev/null +++ b/app/online/mm_ol_0025.pgc @@ -0,0 +1,70 @@ +/* @tier medium @module mm @transform master-online */ +/* + * mm_ol_0025.pgc - 마스터 온라인 서비스 (MM_OL_0025) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mm_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(MM_OL_0025, ctx) +{ + mm_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[MM_OL_0025] 마스터 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MM_OL_0025] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[MM_OL_0025] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[MM_OL_0025] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, MM_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = mm_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[MM_OL_0025] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = mm_rec_count(bizdate, MM_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[MM_OL_0025] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mm_ol_0026.c b/app/online/mm_ol_0026.c new file mode 100644 index 0000000..1d71232 --- /dev/null +++ b/app/online/mm_ol_0026.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/mm_ol_0026.pgc" +/* @tier easy @module mm @transform master-online */ +/* + * mm_ol_0026.pgc - 마스터 온라인 서비스 (MM_OL_0026) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mm_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/mm_ol_0026.pgc" + + +TX_SERVICE(MM_OL_0026, ctx) +{ + mm_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[MM_OL_0026] 마스터 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MM_OL_0026] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = mm_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[MM_OL_0026] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[MM_OL_0026] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mm_ol_0026.pgc b/app/online/mm_ol_0026.pgc new file mode 100644 index 0000000..e347d10 --- /dev/null +++ b/app/online/mm_ol_0026.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module mm @transform master-online */ +/* + * mm_ol_0026.pgc - 마스터 온라인 서비스 (MM_OL_0026) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mm_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(MM_OL_0026, ctx) +{ + mm_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[MM_OL_0026] 마스터 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MM_OL_0026] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = mm_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[MM_OL_0026] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[MM_OL_0026] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mm_ol_0027.c b/app/online/mm_ol_0027.c new file mode 100644 index 0000000..e35d7d3 --- /dev/null +++ b/app/online/mm_ol_0027.c @@ -0,0 +1,148 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/mm_ol_0027.pgc" +/* @tier medium @module mm @transform master-online */ +/* + * mm_ol_0027.pgc - 마스터 온라인 서비스 (MM_OL_0027) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mm_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/mm_ol_0027.pgc" + + +TX_SERVICE(MM_OL_0027, ctx) +{ + mm_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[MM_OL_0027] 마스터 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MM_OL_0027] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[MM_OL_0027] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[MM_OL_0027] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, MM_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = mm_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[MM_OL_0027] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = mm_rec_count(bizdate, MM_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[MM_OL_0027] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mm_ol_0027.pgc b/app/online/mm_ol_0027.pgc new file mode 100644 index 0000000..3183168 --- /dev/null +++ b/app/online/mm_ol_0027.pgc @@ -0,0 +1,70 @@ +/* @tier medium @module mm @transform master-online */ +/* + * mm_ol_0027.pgc - 마스터 온라인 서비스 (MM_OL_0027) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mm_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(MM_OL_0027, ctx) +{ + mm_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[MM_OL_0027] 마스터 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MM_OL_0027] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[MM_OL_0027] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[MM_OL_0027] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, MM_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = mm_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[MM_OL_0027] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = mm_rec_count(bizdate, MM_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[MM_OL_0027] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mm_ol_0028.c b/app/online/mm_ol_0028.c new file mode 100644 index 0000000..e4f62ed --- /dev/null +++ b/app/online/mm_ol_0028.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/mm_ol_0028.pgc" +/* @tier easy @module mm @transform master-online */ +/* + * mm_ol_0028.pgc - 마스터 온라인 서비스 (MM_OL_0028) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mm_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/mm_ol_0028.pgc" + + +TX_SERVICE(MM_OL_0028, ctx) +{ + mm_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[MM_OL_0028] 마스터 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MM_OL_0028] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = mm_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[MM_OL_0028] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[MM_OL_0028] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mm_ol_0028.pgc b/app/online/mm_ol_0028.pgc new file mode 100644 index 0000000..abf7897 --- /dev/null +++ b/app/online/mm_ol_0028.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module mm @transform master-online */ +/* + * mm_ol_0028.pgc - 마스터 온라인 서비스 (MM_OL_0028) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mm_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(MM_OL_0028, ctx) +{ + mm_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[MM_OL_0028] 마스터 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MM_OL_0028] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = mm_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[MM_OL_0028] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[MM_OL_0028] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mm_ol_0029.c b/app/online/mm_ol_0029.c new file mode 100644 index 0000000..61d871f --- /dev/null +++ b/app/online/mm_ol_0029.c @@ -0,0 +1,148 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/mm_ol_0029.pgc" +/* @tier medium @module mm @transform master-online */ +/* + * mm_ol_0029.pgc - 마스터 온라인 서비스 (MM_OL_0029) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mm_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/mm_ol_0029.pgc" + + +TX_SERVICE(MM_OL_0029, ctx) +{ + mm_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[MM_OL_0029] 마스터 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MM_OL_0029] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[MM_OL_0029] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[MM_OL_0029] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, MM_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = mm_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[MM_OL_0029] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = mm_rec_count(bizdate, MM_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[MM_OL_0029] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mm_ol_0029.pgc b/app/online/mm_ol_0029.pgc new file mode 100644 index 0000000..ef5b815 --- /dev/null +++ b/app/online/mm_ol_0029.pgc @@ -0,0 +1,70 @@ +/* @tier medium @module mm @transform master-online */ +/* + * mm_ol_0029.pgc - 마스터 온라인 서비스 (MM_OL_0029) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mm_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(MM_OL_0029, ctx) +{ + mm_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[MM_OL_0029] 마스터 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MM_OL_0029] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[MM_OL_0029] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[MM_OL_0029] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, MM_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = mm_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[MM_OL_0029] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = mm_rec_count(bizdate, MM_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[MM_OL_0029] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mm_ol_0030.c b/app/online/mm_ol_0030.c new file mode 100644 index 0000000..4470904 --- /dev/null +++ b/app/online/mm_ol_0030.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/mm_ol_0030.pgc" +/* @tier easy @module mm @transform master-online */ +/* + * mm_ol_0030.pgc - 마스터 온라인 서비스 (MM_OL_0030) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mm_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/mm_ol_0030.pgc" + + +TX_SERVICE(MM_OL_0030, ctx) +{ + mm_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[MM_OL_0030] 마스터 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MM_OL_0030] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = mm_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[MM_OL_0030] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[MM_OL_0030] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mm_ol_0030.pgc b/app/online/mm_ol_0030.pgc new file mode 100644 index 0000000..931cc7c --- /dev/null +++ b/app/online/mm_ol_0030.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module mm @transform master-online */ +/* + * mm_ol_0030.pgc - 마스터 온라인 서비스 (MM_OL_0030) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mm_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(MM_OL_0030, ctx) +{ + mm_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[MM_OL_0030] 마스터 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MM_OL_0030] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = mm_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[MM_OL_0030] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[MM_OL_0030] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mm_ol_0031.c b/app/online/mm_ol_0031.c new file mode 100644 index 0000000..0b01045 --- /dev/null +++ b/app/online/mm_ol_0031.c @@ -0,0 +1,176 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/mm_ol_0031.pgc" +/* @tier hard @module mm @transform master-online */ +/* + * mm_ol_0031.pgc - 마스터 온라인 서비스 (MM_OL_0031) [tier=hard] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mm_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/mm_ol_0031.pgc" + + +TX_SERVICE(MM_OL_0031, ctx) +{ + mm_rec_t rec; + char key[16], merch[16], bizdate[16], nextbiz[9]; + long amount = 0, daysum = 0; + int rc; + TXBUF *sub_in; + TXBUF *sub_out; + + tx_log(TX_LOG_INFO, "[MM_OL_0031] 마스터 트랜잭션 오케스트레이션 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MM_OL_0031] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + if (!amount_is_valid(amount) || !date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[MM_OL_0031] 입력 검증 실패 amount=%ld date=%s", + amount, bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + /* 트랜잭션 시작 → 원장 반영 → 후속 서비스 연계 → 커밋 */ + if (tx_begin() != TX_OK) { + tx_return(ctx, TX_FAIL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, MM_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; + + rc = mm_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[MM_OL_0031] 원장반영 실패 rc=%d", rc); + tx_abort(); + tx_return(ctx, rc, ctx->out); + return; + } + + /* 정산 영업일 = 거래일의 다음 영업일 */ + if (date_next_business(bizdate, nextbiz) != 0) { + memcpy(nextbiz, bizdate, 8); + nextbiz[8] = '\0'; + } + + /* 후속 정산집계 서비스 연계 (레지스트리 문자열 디스패치) */ + sub_in = tx_buf_alloc(); + sub_out = tx_buf_alloc(); + if (sub_in && sub_out) { + tx_buf_sets(sub_in, "MERCHID", merch); + tx_buf_sets(sub_in, "BIZDATE", nextbiz); + tx_buf_setlong(sub_in, "AMOUNT", amount); + rc = tx_call("MM_POST", sub_in, sub_out); + if (rc != TX_OK) + tx_log(TX_LOG_WARN, "[MM_OL_0031] 후속연계 경고 rc=%d", rc); + } + tx_buf_free(sub_in); + tx_buf_free(sub_out); + + /* 교차 검증: 당일 합계 재계산 */ + if (mm_rec_sum(bizdate, &daysum) != TX_OK) + daysum = 0; + + tx_commit(); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYSUM", daysum); + tx_log(TX_LOG_INFO, "[MM_OL_0031] 완료 key=%s 당일합계=%ld", key, daysum); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mm_ol_0031.pgc b/app/online/mm_ol_0031.pgc new file mode 100644 index 0000000..fd4c57e --- /dev/null +++ b/app/online/mm_ol_0031.pgc @@ -0,0 +1,98 @@ +/* @tier hard @module mm @transform master-online */ +/* + * mm_ol_0031.pgc - 마스터 온라인 서비스 (MM_OL_0031) [tier=hard] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mm_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(MM_OL_0031, ctx) +{ + mm_rec_t rec; + char key[16], merch[16], bizdate[16], nextbiz[9]; + long amount = 0, daysum = 0; + int rc; + TXBUF *sub_in; + TXBUF *sub_out; + + tx_log(TX_LOG_INFO, "[MM_OL_0031] 마스터 트랜잭션 오케스트레이션 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MM_OL_0031] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + if (!amount_is_valid(amount) || !date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[MM_OL_0031] 입력 검증 실패 amount=%ld date=%s", + amount, bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + /* 트랜잭션 시작 → 원장 반영 → 후속 서비스 연계 → 커밋 */ + if (tx_begin() != TX_OK) { + tx_return(ctx, TX_FAIL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, MM_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; + + rc = mm_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[MM_OL_0031] 원장반영 실패 rc=%d", rc); + tx_abort(); + tx_return(ctx, rc, ctx->out); + return; + } + + /* 정산 영업일 = 거래일의 다음 영업일 */ + if (date_next_business(bizdate, nextbiz) != 0) { + memcpy(nextbiz, bizdate, 8); + nextbiz[8] = '\0'; + } + + /* 후속 정산집계 서비스 연계 (레지스트리 문자열 디스패치) */ + sub_in = tx_buf_alloc(); + sub_out = tx_buf_alloc(); + if (sub_in && sub_out) { + tx_buf_sets(sub_in, "MERCHID", merch); + tx_buf_sets(sub_in, "BIZDATE", nextbiz); + tx_buf_setlong(sub_in, "AMOUNT", amount); + rc = tx_call("MM_POST", sub_in, sub_out); + if (rc != TX_OK) + tx_log(TX_LOG_WARN, "[MM_OL_0031] 후속연계 경고 rc=%d", rc); + } + tx_buf_free(sub_in); + tx_buf_free(sub_out); + + /* 교차 검증: 당일 합계 재계산 */ + if (mm_rec_sum(bizdate, &daysum) != TX_OK) + daysum = 0; + + tx_commit(); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYSUM", daysum); + tx_log(TX_LOG_INFO, "[MM_OL_0031] 완료 key=%s 당일합계=%ld", key, daysum); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mm_ol_0032.c b/app/online/mm_ol_0032.c new file mode 100644 index 0000000..a2220c2 --- /dev/null +++ b/app/online/mm_ol_0032.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/mm_ol_0032.pgc" +/* @tier easy @module mm @transform master-online */ +/* + * mm_ol_0032.pgc - 마스터 온라인 서비스 (MM_OL_0032) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mm_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/mm_ol_0032.pgc" + + +TX_SERVICE(MM_OL_0032, ctx) +{ + mm_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[MM_OL_0032] 마스터 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MM_OL_0032] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = mm_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[MM_OL_0032] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[MM_OL_0032] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/mm_ol_0032.pgc b/app/online/mm_ol_0032.pgc new file mode 100644 index 0000000..ec93aa9 --- /dev/null +++ b/app/online/mm_ol_0032.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module mm @transform master-online */ +/* + * mm_ol_0032.pgc - 마스터 온라인 서비스 (MM_OL_0032) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mm 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "mm_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(MM_OL_0032, ctx) +{ + mm_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[MM_OL_0032] 마스터 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[MM_OL_0032] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = mm_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[MM_OL_0032] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[MM_OL_0032] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/py_ol_0001.c b/app/online/py_ol_0001.c new file mode 100644 index 0000000..2ed137c --- /dev/null +++ b/app/online/py_ol_0001.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/py_ol_0001.pgc" +/* @tier easy @module py @transform payment-online */ +/* + * py_ol_0001.pgc - 지급 온라인 서비스 (PY_OL_0001) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 py 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "py_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/py_ol_0001.pgc" + + +TX_SERVICE(PY_OL_0001, ctx) +{ + py_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[PY_OL_0001] 지급 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[PY_OL_0001] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = py_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[PY_OL_0001] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[PY_OL_0001] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/py_ol_0001.pgc b/app/online/py_ol_0001.pgc new file mode 100644 index 0000000..fb112f9 --- /dev/null +++ b/app/online/py_ol_0001.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module py @transform payment-online */ +/* + * py_ol_0001.pgc - 지급 온라인 서비스 (PY_OL_0001) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 py 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "py_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(PY_OL_0001, ctx) +{ + py_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[PY_OL_0001] 지급 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[PY_OL_0001] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = py_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[PY_OL_0001] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[PY_OL_0001] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/py_ol_0002.c b/app/online/py_ol_0002.c new file mode 100644 index 0000000..09ff797 --- /dev/null +++ b/app/online/py_ol_0002.c @@ -0,0 +1,176 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/py_ol_0002.pgc" +/* @tier hard @module py @transform payment-online */ +/* + * py_ol_0002.pgc - 지급 온라인 서비스 (PY_OL_0002) [tier=hard] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 py 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "py_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/py_ol_0002.pgc" + + +TX_SERVICE(PY_OL_0002, ctx) +{ + py_rec_t rec; + char key[16], merch[16], bizdate[16], nextbiz[9]; + long amount = 0, daysum = 0; + int rc; + TXBUF *sub_in; + TXBUF *sub_out; + + tx_log(TX_LOG_INFO, "[PY_OL_0002] 지급 트랜잭션 오케스트레이션 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[PY_OL_0002] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + if (!amount_is_valid(amount) || !date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[PY_OL_0002] 입력 검증 실패 amount=%ld date=%s", + amount, bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + /* 트랜잭션 시작 → 원장 반영 → 후속 서비스 연계 → 커밋 */ + if (tx_begin() != TX_OK) { + tx_return(ctx, TX_FAIL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, PY_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; + + rc = py_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[PY_OL_0002] 원장반영 실패 rc=%d", rc); + tx_abort(); + tx_return(ctx, rc, ctx->out); + return; + } + + /* 정산 영업일 = 거래일의 다음 영업일 */ + if (date_next_business(bizdate, nextbiz) != 0) { + memcpy(nextbiz, bizdate, 8); + nextbiz[8] = '\0'; + } + + /* 후속 정산집계 서비스 연계 (레지스트리 문자열 디스패치) */ + sub_in = tx_buf_alloc(); + sub_out = tx_buf_alloc(); + if (sub_in && sub_out) { + tx_buf_sets(sub_in, "MERCHID", merch); + tx_buf_sets(sub_in, "BIZDATE", nextbiz); + tx_buf_setlong(sub_in, "AMOUNT", amount); + rc = tx_call("PY_POST", sub_in, sub_out); + if (rc != TX_OK) + tx_log(TX_LOG_WARN, "[PY_OL_0002] 후속연계 경고 rc=%d", rc); + } + tx_buf_free(sub_in); + tx_buf_free(sub_out); + + /* 교차 검증: 당일 합계 재계산 */ + if (py_rec_sum(bizdate, &daysum) != TX_OK) + daysum = 0; + + tx_commit(); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYSUM", daysum); + tx_log(TX_LOG_INFO, "[PY_OL_0002] 완료 key=%s 당일합계=%ld", key, daysum); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/py_ol_0002.pgc b/app/online/py_ol_0002.pgc new file mode 100644 index 0000000..5628235 --- /dev/null +++ b/app/online/py_ol_0002.pgc @@ -0,0 +1,98 @@ +/* @tier hard @module py @transform payment-online */ +/* + * py_ol_0002.pgc - 지급 온라인 서비스 (PY_OL_0002) [tier=hard] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 py 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "py_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(PY_OL_0002, ctx) +{ + py_rec_t rec; + char key[16], merch[16], bizdate[16], nextbiz[9]; + long amount = 0, daysum = 0; + int rc; + TXBUF *sub_in; + TXBUF *sub_out; + + tx_log(TX_LOG_INFO, "[PY_OL_0002] 지급 트랜잭션 오케스트레이션 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[PY_OL_0002] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + if (!amount_is_valid(amount) || !date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[PY_OL_0002] 입력 검증 실패 amount=%ld date=%s", + amount, bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + /* 트랜잭션 시작 → 원장 반영 → 후속 서비스 연계 → 커밋 */ + if (tx_begin() != TX_OK) { + tx_return(ctx, TX_FAIL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, PY_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; + + rc = py_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[PY_OL_0002] 원장반영 실패 rc=%d", rc); + tx_abort(); + tx_return(ctx, rc, ctx->out); + return; + } + + /* 정산 영업일 = 거래일의 다음 영업일 */ + if (date_next_business(bizdate, nextbiz) != 0) { + memcpy(nextbiz, bizdate, 8); + nextbiz[8] = '\0'; + } + + /* 후속 정산집계 서비스 연계 (레지스트리 문자열 디스패치) */ + sub_in = tx_buf_alloc(); + sub_out = tx_buf_alloc(); + if (sub_in && sub_out) { + tx_buf_sets(sub_in, "MERCHID", merch); + tx_buf_sets(sub_in, "BIZDATE", nextbiz); + tx_buf_setlong(sub_in, "AMOUNT", amount); + rc = tx_call("PY_POST", sub_in, sub_out); + if (rc != TX_OK) + tx_log(TX_LOG_WARN, "[PY_OL_0002] 후속연계 경고 rc=%d", rc); + } + tx_buf_free(sub_in); + tx_buf_free(sub_out); + + /* 교차 검증: 당일 합계 재계산 */ + if (py_rec_sum(bizdate, &daysum) != TX_OK) + daysum = 0; + + tx_commit(); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYSUM", daysum); + tx_log(TX_LOG_INFO, "[PY_OL_0002] 완료 key=%s 당일합계=%ld", key, daysum); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/py_ol_0003.c b/app/online/py_ol_0003.c new file mode 100644 index 0000000..e9f36dd --- /dev/null +++ b/app/online/py_ol_0003.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/py_ol_0003.pgc" +/* @tier easy @module py @transform payment-online */ +/* + * py_ol_0003.pgc - 지급 온라인 서비스 (PY_OL_0003) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 py 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "py_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/py_ol_0003.pgc" + + +TX_SERVICE(PY_OL_0003, ctx) +{ + py_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[PY_OL_0003] 지급 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[PY_OL_0003] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = py_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[PY_OL_0003] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[PY_OL_0003] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/py_ol_0003.pgc b/app/online/py_ol_0003.pgc new file mode 100644 index 0000000..8561263 --- /dev/null +++ b/app/online/py_ol_0003.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module py @transform payment-online */ +/* + * py_ol_0003.pgc - 지급 온라인 서비스 (PY_OL_0003) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 py 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "py_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(PY_OL_0003, ctx) +{ + py_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[PY_OL_0003] 지급 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[PY_OL_0003] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = py_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[PY_OL_0003] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[PY_OL_0003] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/py_ol_0004.c b/app/online/py_ol_0004.c new file mode 100644 index 0000000..8efb560 --- /dev/null +++ b/app/online/py_ol_0004.c @@ -0,0 +1,176 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/py_ol_0004.pgc" +/* @tier hard @module py @transform payment-online */ +/* + * py_ol_0004.pgc - 지급 온라인 서비스 (PY_OL_0004) [tier=hard] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 py 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "py_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/py_ol_0004.pgc" + + +TX_SERVICE(PY_OL_0004, ctx) +{ + py_rec_t rec; + char key[16], merch[16], bizdate[16], nextbiz[9]; + long amount = 0, daysum = 0; + int rc; + TXBUF *sub_in; + TXBUF *sub_out; + + tx_log(TX_LOG_INFO, "[PY_OL_0004] 지급 트랜잭션 오케스트레이션 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[PY_OL_0004] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + if (!amount_is_valid(amount) || !date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[PY_OL_0004] 입력 검증 실패 amount=%ld date=%s", + amount, bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + /* 트랜잭션 시작 → 원장 반영 → 후속 서비스 연계 → 커밋 */ + if (tx_begin() != TX_OK) { + tx_return(ctx, TX_FAIL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, PY_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; + + rc = py_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[PY_OL_0004] 원장반영 실패 rc=%d", rc); + tx_abort(); + tx_return(ctx, rc, ctx->out); + return; + } + + /* 정산 영업일 = 거래일의 다음 영업일 */ + if (date_next_business(bizdate, nextbiz) != 0) { + memcpy(nextbiz, bizdate, 8); + nextbiz[8] = '\0'; + } + + /* 후속 정산집계 서비스 연계 (레지스트리 문자열 디스패치) */ + sub_in = tx_buf_alloc(); + sub_out = tx_buf_alloc(); + if (sub_in && sub_out) { + tx_buf_sets(sub_in, "MERCHID", merch); + tx_buf_sets(sub_in, "BIZDATE", nextbiz); + tx_buf_setlong(sub_in, "AMOUNT", amount); + rc = tx_call("PY_POST", sub_in, sub_out); + if (rc != TX_OK) + tx_log(TX_LOG_WARN, "[PY_OL_0004] 후속연계 경고 rc=%d", rc); + } + tx_buf_free(sub_in); + tx_buf_free(sub_out); + + /* 교차 검증: 당일 합계 재계산 */ + if (py_rec_sum(bizdate, &daysum) != TX_OK) + daysum = 0; + + tx_commit(); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYSUM", daysum); + tx_log(TX_LOG_INFO, "[PY_OL_0004] 완료 key=%s 당일합계=%ld", key, daysum); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/py_ol_0004.pgc b/app/online/py_ol_0004.pgc new file mode 100644 index 0000000..077b97e --- /dev/null +++ b/app/online/py_ol_0004.pgc @@ -0,0 +1,98 @@ +/* @tier hard @module py @transform payment-online */ +/* + * py_ol_0004.pgc - 지급 온라인 서비스 (PY_OL_0004) [tier=hard] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 py 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "py_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(PY_OL_0004, ctx) +{ + py_rec_t rec; + char key[16], merch[16], bizdate[16], nextbiz[9]; + long amount = 0, daysum = 0; + int rc; + TXBUF *sub_in; + TXBUF *sub_out; + + tx_log(TX_LOG_INFO, "[PY_OL_0004] 지급 트랜잭션 오케스트레이션 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[PY_OL_0004] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + if (!amount_is_valid(amount) || !date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[PY_OL_0004] 입력 검증 실패 amount=%ld date=%s", + amount, bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + /* 트랜잭션 시작 → 원장 반영 → 후속 서비스 연계 → 커밋 */ + if (tx_begin() != TX_OK) { + tx_return(ctx, TX_FAIL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, PY_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; + + rc = py_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[PY_OL_0004] 원장반영 실패 rc=%d", rc); + tx_abort(); + tx_return(ctx, rc, ctx->out); + return; + } + + /* 정산 영업일 = 거래일의 다음 영업일 */ + if (date_next_business(bizdate, nextbiz) != 0) { + memcpy(nextbiz, bizdate, 8); + nextbiz[8] = '\0'; + } + + /* 후속 정산집계 서비스 연계 (레지스트리 문자열 디스패치) */ + sub_in = tx_buf_alloc(); + sub_out = tx_buf_alloc(); + if (sub_in && sub_out) { + tx_buf_sets(sub_in, "MERCHID", merch); + tx_buf_sets(sub_in, "BIZDATE", nextbiz); + tx_buf_setlong(sub_in, "AMOUNT", amount); + rc = tx_call("PY_POST", sub_in, sub_out); + if (rc != TX_OK) + tx_log(TX_LOG_WARN, "[PY_OL_0004] 후속연계 경고 rc=%d", rc); + } + tx_buf_free(sub_in); + tx_buf_free(sub_out); + + /* 교차 검증: 당일 합계 재계산 */ + if (py_rec_sum(bizdate, &daysum) != TX_OK) + daysum = 0; + + tx_commit(); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYSUM", daysum); + tx_log(TX_LOG_INFO, "[PY_OL_0004] 완료 key=%s 당일합계=%ld", key, daysum); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/py_ol_0005.c b/app/online/py_ol_0005.c new file mode 100644 index 0000000..e4befff --- /dev/null +++ b/app/online/py_ol_0005.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/py_ol_0005.pgc" +/* @tier easy @module py @transform payment-online */ +/* + * py_ol_0005.pgc - 지급 온라인 서비스 (PY_OL_0005) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 py 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "py_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/py_ol_0005.pgc" + + +TX_SERVICE(PY_OL_0005, ctx) +{ + py_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[PY_OL_0005] 지급 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[PY_OL_0005] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = py_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[PY_OL_0005] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[PY_OL_0005] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/py_ol_0005.pgc b/app/online/py_ol_0005.pgc new file mode 100644 index 0000000..9707b6c --- /dev/null +++ b/app/online/py_ol_0005.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module py @transform payment-online */ +/* + * py_ol_0005.pgc - 지급 온라인 서비스 (PY_OL_0005) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 py 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "py_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(PY_OL_0005, ctx) +{ + py_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[PY_OL_0005] 지급 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[PY_OL_0005] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = py_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[PY_OL_0005] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[PY_OL_0005] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/py_ol_0006.c b/app/online/py_ol_0006.c new file mode 100644 index 0000000..a17302a --- /dev/null +++ b/app/online/py_ol_0006.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/py_ol_0006.pgc" +/* @tier easy @module py @transform payment-online */ +/* + * py_ol_0006.pgc - 지급 온라인 서비스 (PY_OL_0006) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 py 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "py_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/py_ol_0006.pgc" + + +TX_SERVICE(PY_OL_0006, ctx) +{ + py_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[PY_OL_0006] 지급 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[PY_OL_0006] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = py_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[PY_OL_0006] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[PY_OL_0006] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/py_ol_0006.pgc b/app/online/py_ol_0006.pgc new file mode 100644 index 0000000..e258149 --- /dev/null +++ b/app/online/py_ol_0006.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module py @transform payment-online */ +/* + * py_ol_0006.pgc - 지급 온라인 서비스 (PY_OL_0006) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 py 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "py_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(PY_OL_0006, ctx) +{ + py_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[PY_OL_0006] 지급 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[PY_OL_0006] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = py_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[PY_OL_0006] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[PY_OL_0006] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/py_ol_0007.c b/app/online/py_ol_0007.c new file mode 100644 index 0000000..279372a --- /dev/null +++ b/app/online/py_ol_0007.c @@ -0,0 +1,148 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/py_ol_0007.pgc" +/* @tier medium @module py @transform payment-online */ +/* + * py_ol_0007.pgc - 지급 온라인 서비스 (PY_OL_0007) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 py 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "py_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/py_ol_0007.pgc" + + +TX_SERVICE(PY_OL_0007, ctx) +{ + py_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[PY_OL_0007] 지급 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[PY_OL_0007] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[PY_OL_0007] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[PY_OL_0007] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, PY_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = py_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[PY_OL_0007] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = py_rec_count(bizdate, PY_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[PY_OL_0007] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/py_ol_0007.pgc b/app/online/py_ol_0007.pgc new file mode 100644 index 0000000..2617457 --- /dev/null +++ b/app/online/py_ol_0007.pgc @@ -0,0 +1,70 @@ +/* @tier medium @module py @transform payment-online */ +/* + * py_ol_0007.pgc - 지급 온라인 서비스 (PY_OL_0007) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 py 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "py_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(PY_OL_0007, ctx) +{ + py_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[PY_OL_0007] 지급 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[PY_OL_0007] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[PY_OL_0007] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[PY_OL_0007] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, PY_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = py_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[PY_OL_0007] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = py_rec_count(bizdate, PY_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[PY_OL_0007] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/py_ol_0008.c b/app/online/py_ol_0008.c new file mode 100644 index 0000000..2b307de --- /dev/null +++ b/app/online/py_ol_0008.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/py_ol_0008.pgc" +/* @tier easy @module py @transform payment-online */ +/* + * py_ol_0008.pgc - 지급 온라인 서비스 (PY_OL_0008) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 py 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "py_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/py_ol_0008.pgc" + + +TX_SERVICE(PY_OL_0008, ctx) +{ + py_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[PY_OL_0008] 지급 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[PY_OL_0008] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = py_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[PY_OL_0008] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[PY_OL_0008] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/py_ol_0008.pgc b/app/online/py_ol_0008.pgc new file mode 100644 index 0000000..78dfd15 --- /dev/null +++ b/app/online/py_ol_0008.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module py @transform payment-online */ +/* + * py_ol_0008.pgc - 지급 온라인 서비스 (PY_OL_0008) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 py 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "py_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(PY_OL_0008, ctx) +{ + py_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[PY_OL_0008] 지급 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[PY_OL_0008] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = py_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[PY_OL_0008] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[PY_OL_0008] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/py_ol_0009.c b/app/online/py_ol_0009.c new file mode 100644 index 0000000..e9a7d45 --- /dev/null +++ b/app/online/py_ol_0009.c @@ -0,0 +1,148 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/py_ol_0009.pgc" +/* @tier medium @module py @transform payment-online */ +/* + * py_ol_0009.pgc - 지급 온라인 서비스 (PY_OL_0009) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 py 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "py_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/py_ol_0009.pgc" + + +TX_SERVICE(PY_OL_0009, ctx) +{ + py_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[PY_OL_0009] 지급 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[PY_OL_0009] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[PY_OL_0009] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[PY_OL_0009] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, PY_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = py_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[PY_OL_0009] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = py_rec_count(bizdate, PY_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[PY_OL_0009] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/py_ol_0009.pgc b/app/online/py_ol_0009.pgc new file mode 100644 index 0000000..9903001 --- /dev/null +++ b/app/online/py_ol_0009.pgc @@ -0,0 +1,70 @@ +/* @tier medium @module py @transform payment-online */ +/* + * py_ol_0009.pgc - 지급 온라인 서비스 (PY_OL_0009) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 py 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "py_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(PY_OL_0009, ctx) +{ + py_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[PY_OL_0009] 지급 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[PY_OL_0009] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[PY_OL_0009] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[PY_OL_0009] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, PY_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = py_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[PY_OL_0009] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = py_rec_count(bizdate, PY_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[PY_OL_0009] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/py_ol_0010.c b/app/online/py_ol_0010.c new file mode 100644 index 0000000..38bd7f1 --- /dev/null +++ b/app/online/py_ol_0010.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/py_ol_0010.pgc" +/* @tier easy @module py @transform payment-online */ +/* + * py_ol_0010.pgc - 지급 온라인 서비스 (PY_OL_0010) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 py 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "py_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/py_ol_0010.pgc" + + +TX_SERVICE(PY_OL_0010, ctx) +{ + py_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[PY_OL_0010] 지급 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[PY_OL_0010] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = py_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[PY_OL_0010] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[PY_OL_0010] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/py_ol_0010.pgc b/app/online/py_ol_0010.pgc new file mode 100644 index 0000000..618b10d --- /dev/null +++ b/app/online/py_ol_0010.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module py @transform payment-online */ +/* + * py_ol_0010.pgc - 지급 온라인 서비스 (PY_OL_0010) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 py 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "py_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(PY_OL_0010, ctx) +{ + py_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[PY_OL_0010] 지급 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[PY_OL_0010] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = py_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[PY_OL_0010] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[PY_OL_0010] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/py_ol_0011.c b/app/online/py_ol_0011.c new file mode 100644 index 0000000..0c6e84a --- /dev/null +++ b/app/online/py_ol_0011.c @@ -0,0 +1,148 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/py_ol_0011.pgc" +/* @tier medium @module py @transform payment-online */ +/* + * py_ol_0011.pgc - 지급 온라인 서비스 (PY_OL_0011) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 py 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "py_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/py_ol_0011.pgc" + + +TX_SERVICE(PY_OL_0011, ctx) +{ + py_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[PY_OL_0011] 지급 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[PY_OL_0011] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[PY_OL_0011] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[PY_OL_0011] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, PY_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = py_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[PY_OL_0011] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = py_rec_count(bizdate, PY_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[PY_OL_0011] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/py_ol_0011.pgc b/app/online/py_ol_0011.pgc new file mode 100644 index 0000000..abfcfdf --- /dev/null +++ b/app/online/py_ol_0011.pgc @@ -0,0 +1,70 @@ +/* @tier medium @module py @transform payment-online */ +/* + * py_ol_0011.pgc - 지급 온라인 서비스 (PY_OL_0011) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 py 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "py_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(PY_OL_0011, ctx) +{ + py_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[PY_OL_0011] 지급 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[PY_OL_0011] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[PY_OL_0011] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[PY_OL_0011] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, PY_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = py_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[PY_OL_0011] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = py_rec_count(bizdate, PY_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[PY_OL_0011] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/py_ol_0012.c b/app/online/py_ol_0012.c new file mode 100644 index 0000000..887bf83 --- /dev/null +++ b/app/online/py_ol_0012.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/py_ol_0012.pgc" +/* @tier easy @module py @transform payment-online */ +/* + * py_ol_0012.pgc - 지급 온라인 서비스 (PY_OL_0012) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 py 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "py_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/py_ol_0012.pgc" + + +TX_SERVICE(PY_OL_0012, ctx) +{ + py_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[PY_OL_0012] 지급 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[PY_OL_0012] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = py_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[PY_OL_0012] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[PY_OL_0012] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/py_ol_0012.pgc b/app/online/py_ol_0012.pgc new file mode 100644 index 0000000..f3ed38b --- /dev/null +++ b/app/online/py_ol_0012.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module py @transform payment-online */ +/* + * py_ol_0012.pgc - 지급 온라인 서비스 (PY_OL_0012) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 py 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "py_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(PY_OL_0012, ctx) +{ + py_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[PY_OL_0012] 지급 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[PY_OL_0012] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = py_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[PY_OL_0012] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[PY_OL_0012] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/py_ol_0013.c b/app/online/py_ol_0013.c new file mode 100644 index 0000000..375ac60 --- /dev/null +++ b/app/online/py_ol_0013.c @@ -0,0 +1,176 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/py_ol_0013.pgc" +/* @tier hard @module py @transform payment-online */ +/* + * py_ol_0013.pgc - 지급 온라인 서비스 (PY_OL_0013) [tier=hard] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 py 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "py_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/py_ol_0013.pgc" + + +TX_SERVICE(PY_OL_0013, ctx) +{ + py_rec_t rec; + char key[16], merch[16], bizdate[16], nextbiz[9]; + long amount = 0, daysum = 0; + int rc; + TXBUF *sub_in; + TXBUF *sub_out; + + tx_log(TX_LOG_INFO, "[PY_OL_0013] 지급 트랜잭션 오케스트레이션 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[PY_OL_0013] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + if (!amount_is_valid(amount) || !date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[PY_OL_0013] 입력 검증 실패 amount=%ld date=%s", + amount, bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + /* 트랜잭션 시작 → 원장 반영 → 후속 서비스 연계 → 커밋 */ + if (tx_begin() != TX_OK) { + tx_return(ctx, TX_FAIL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, PY_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; + + rc = py_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[PY_OL_0013] 원장반영 실패 rc=%d", rc); + tx_abort(); + tx_return(ctx, rc, ctx->out); + return; + } + + /* 정산 영업일 = 거래일의 다음 영업일 */ + if (date_next_business(bizdate, nextbiz) != 0) { + memcpy(nextbiz, bizdate, 8); + nextbiz[8] = '\0'; + } + + /* 후속 정산집계 서비스 연계 (레지스트리 문자열 디스패치) */ + sub_in = tx_buf_alloc(); + sub_out = tx_buf_alloc(); + if (sub_in && sub_out) { + tx_buf_sets(sub_in, "MERCHID", merch); + tx_buf_sets(sub_in, "BIZDATE", nextbiz); + tx_buf_setlong(sub_in, "AMOUNT", amount); + rc = tx_call("PY_POST", sub_in, sub_out); + if (rc != TX_OK) + tx_log(TX_LOG_WARN, "[PY_OL_0013] 후속연계 경고 rc=%d", rc); + } + tx_buf_free(sub_in); + tx_buf_free(sub_out); + + /* 교차 검증: 당일 합계 재계산 */ + if (py_rec_sum(bizdate, &daysum) != TX_OK) + daysum = 0; + + tx_commit(); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYSUM", daysum); + tx_log(TX_LOG_INFO, "[PY_OL_0013] 완료 key=%s 당일합계=%ld", key, daysum); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/py_ol_0013.pgc b/app/online/py_ol_0013.pgc new file mode 100644 index 0000000..af48e4a --- /dev/null +++ b/app/online/py_ol_0013.pgc @@ -0,0 +1,98 @@ +/* @tier hard @module py @transform payment-online */ +/* + * py_ol_0013.pgc - 지급 온라인 서비스 (PY_OL_0013) [tier=hard] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 py 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "py_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(PY_OL_0013, ctx) +{ + py_rec_t rec; + char key[16], merch[16], bizdate[16], nextbiz[9]; + long amount = 0, daysum = 0; + int rc; + TXBUF *sub_in; + TXBUF *sub_out; + + tx_log(TX_LOG_INFO, "[PY_OL_0013] 지급 트랜잭션 오케스트레이션 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[PY_OL_0013] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + if (!amount_is_valid(amount) || !date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[PY_OL_0013] 입력 검증 실패 amount=%ld date=%s", + amount, bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + /* 트랜잭션 시작 → 원장 반영 → 후속 서비스 연계 → 커밋 */ + if (tx_begin() != TX_OK) { + tx_return(ctx, TX_FAIL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, PY_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; + + rc = py_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[PY_OL_0013] 원장반영 실패 rc=%d", rc); + tx_abort(); + tx_return(ctx, rc, ctx->out); + return; + } + + /* 정산 영업일 = 거래일의 다음 영업일 */ + if (date_next_business(bizdate, nextbiz) != 0) { + memcpy(nextbiz, bizdate, 8); + nextbiz[8] = '\0'; + } + + /* 후속 정산집계 서비스 연계 (레지스트리 문자열 디스패치) */ + sub_in = tx_buf_alloc(); + sub_out = tx_buf_alloc(); + if (sub_in && sub_out) { + tx_buf_sets(sub_in, "MERCHID", merch); + tx_buf_sets(sub_in, "BIZDATE", nextbiz); + tx_buf_setlong(sub_in, "AMOUNT", amount); + rc = tx_call("PY_POST", sub_in, sub_out); + if (rc != TX_OK) + tx_log(TX_LOG_WARN, "[PY_OL_0013] 후속연계 경고 rc=%d", rc); + } + tx_buf_free(sub_in); + tx_buf_free(sub_out); + + /* 교차 검증: 당일 합계 재계산 */ + if (py_rec_sum(bizdate, &daysum) != TX_OK) + daysum = 0; + + tx_commit(); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYSUM", daysum); + tx_log(TX_LOG_INFO, "[PY_OL_0013] 완료 key=%s 당일합계=%ld", key, daysum); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/py_ol_0014.c b/app/online/py_ol_0014.c new file mode 100644 index 0000000..a0e09d8 --- /dev/null +++ b/app/online/py_ol_0014.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/py_ol_0014.pgc" +/* @tier easy @module py @transform payment-online */ +/* + * py_ol_0014.pgc - 지급 온라인 서비스 (PY_OL_0014) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 py 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "py_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/py_ol_0014.pgc" + + +TX_SERVICE(PY_OL_0014, ctx) +{ + py_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[PY_OL_0014] 지급 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[PY_OL_0014] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = py_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[PY_OL_0014] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[PY_OL_0014] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/py_ol_0014.pgc b/app/online/py_ol_0014.pgc new file mode 100644 index 0000000..497c22d --- /dev/null +++ b/app/online/py_ol_0014.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module py @transform payment-online */ +/* + * py_ol_0014.pgc - 지급 온라인 서비스 (PY_OL_0014) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 py 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "py_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(PY_OL_0014, ctx) +{ + py_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[PY_OL_0014] 지급 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[PY_OL_0014] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = py_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[PY_OL_0014] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[PY_OL_0014] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/py_ol_0015.c b/app/online/py_ol_0015.c new file mode 100644 index 0000000..e40fa88 --- /dev/null +++ b/app/online/py_ol_0015.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/py_ol_0015.pgc" +/* @tier easy @module py @transform payment-online */ +/* + * py_ol_0015.pgc - 지급 온라인 서비스 (PY_OL_0015) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 py 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "py_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/py_ol_0015.pgc" + + +TX_SERVICE(PY_OL_0015, ctx) +{ + py_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[PY_OL_0015] 지급 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[PY_OL_0015] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = py_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[PY_OL_0015] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[PY_OL_0015] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/py_ol_0015.pgc b/app/online/py_ol_0015.pgc new file mode 100644 index 0000000..6b8bd86 --- /dev/null +++ b/app/online/py_ol_0015.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module py @transform payment-online */ +/* + * py_ol_0015.pgc - 지급 온라인 서비스 (PY_OL_0015) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 py 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "py_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(PY_OL_0015, ctx) +{ + py_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[PY_OL_0015] 지급 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[PY_OL_0015] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = py_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[PY_OL_0015] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[PY_OL_0015] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/py_ol_0016.c b/app/online/py_ol_0016.c new file mode 100644 index 0000000..ac5d91d --- /dev/null +++ b/app/online/py_ol_0016.c @@ -0,0 +1,148 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/py_ol_0016.pgc" +/* @tier medium @module py @transform payment-online */ +/* + * py_ol_0016.pgc - 지급 온라인 서비스 (PY_OL_0016) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 py 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "py_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/py_ol_0016.pgc" + + +TX_SERVICE(PY_OL_0016, ctx) +{ + py_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[PY_OL_0016] 지급 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[PY_OL_0016] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[PY_OL_0016] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[PY_OL_0016] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, PY_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = py_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[PY_OL_0016] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = py_rec_count(bizdate, PY_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[PY_OL_0016] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/py_ol_0016.pgc b/app/online/py_ol_0016.pgc new file mode 100644 index 0000000..c624482 --- /dev/null +++ b/app/online/py_ol_0016.pgc @@ -0,0 +1,70 @@ +/* @tier medium @module py @transform payment-online */ +/* + * py_ol_0016.pgc - 지급 온라인 서비스 (PY_OL_0016) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 py 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "py_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(PY_OL_0016, ctx) +{ + py_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[PY_OL_0016] 지급 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[PY_OL_0016] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[PY_OL_0016] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[PY_OL_0016] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, PY_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = py_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[PY_OL_0016] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = py_rec_count(bizdate, PY_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[PY_OL_0016] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/py_ol_0017.c b/app/online/py_ol_0017.c new file mode 100644 index 0000000..721b9c2 --- /dev/null +++ b/app/online/py_ol_0017.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/py_ol_0017.pgc" +/* @tier easy @module py @transform payment-online */ +/* + * py_ol_0017.pgc - 지급 온라인 서비스 (PY_OL_0017) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 py 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "py_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/py_ol_0017.pgc" + + +TX_SERVICE(PY_OL_0017, ctx) +{ + py_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[PY_OL_0017] 지급 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[PY_OL_0017] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = py_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[PY_OL_0017] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[PY_OL_0017] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/py_ol_0017.pgc b/app/online/py_ol_0017.pgc new file mode 100644 index 0000000..0bedae4 --- /dev/null +++ b/app/online/py_ol_0017.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module py @transform payment-online */ +/* + * py_ol_0017.pgc - 지급 온라인 서비스 (PY_OL_0017) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 py 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "py_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(PY_OL_0017, ctx) +{ + py_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[PY_OL_0017] 지급 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[PY_OL_0017] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = py_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[PY_OL_0017] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[PY_OL_0017] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/py_ol_0018.c b/app/online/py_ol_0018.c new file mode 100644 index 0000000..da06df7 --- /dev/null +++ b/app/online/py_ol_0018.c @@ -0,0 +1,148 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/py_ol_0018.pgc" +/* @tier medium @module py @transform payment-online */ +/* + * py_ol_0018.pgc - 지급 온라인 서비스 (PY_OL_0018) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 py 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "py_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/py_ol_0018.pgc" + + +TX_SERVICE(PY_OL_0018, ctx) +{ + py_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[PY_OL_0018] 지급 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[PY_OL_0018] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[PY_OL_0018] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[PY_OL_0018] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, PY_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = py_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[PY_OL_0018] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = py_rec_count(bizdate, PY_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[PY_OL_0018] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/py_ol_0018.pgc b/app/online/py_ol_0018.pgc new file mode 100644 index 0000000..d36e1b4 --- /dev/null +++ b/app/online/py_ol_0018.pgc @@ -0,0 +1,70 @@ +/* @tier medium @module py @transform payment-online */ +/* + * py_ol_0018.pgc - 지급 온라인 서비스 (PY_OL_0018) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 py 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "py_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(PY_OL_0018, ctx) +{ + py_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[PY_OL_0018] 지급 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[PY_OL_0018] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[PY_OL_0018] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[PY_OL_0018] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, PY_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = py_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[PY_OL_0018] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = py_rec_count(bizdate, PY_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[PY_OL_0018] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/py_ol_0019.c b/app/online/py_ol_0019.c new file mode 100644 index 0000000..e56d78a --- /dev/null +++ b/app/online/py_ol_0019.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/py_ol_0019.pgc" +/* @tier easy @module py @transform payment-online */ +/* + * py_ol_0019.pgc - 지급 온라인 서비스 (PY_OL_0019) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 py 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "py_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/py_ol_0019.pgc" + + +TX_SERVICE(PY_OL_0019, ctx) +{ + py_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[PY_OL_0019] 지급 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[PY_OL_0019] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = py_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[PY_OL_0019] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[PY_OL_0019] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/py_ol_0019.pgc b/app/online/py_ol_0019.pgc new file mode 100644 index 0000000..02adb69 --- /dev/null +++ b/app/online/py_ol_0019.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module py @transform payment-online */ +/* + * py_ol_0019.pgc - 지급 온라인 서비스 (PY_OL_0019) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 py 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "py_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(PY_OL_0019, ctx) +{ + py_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[PY_OL_0019] 지급 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[PY_OL_0019] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = py_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[PY_OL_0019] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[PY_OL_0019] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/py_ol_0020.c b/app/online/py_ol_0020.c new file mode 100644 index 0000000..5825ecf --- /dev/null +++ b/app/online/py_ol_0020.c @@ -0,0 +1,148 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/py_ol_0020.pgc" +/* @tier medium @module py @transform payment-online */ +/* + * py_ol_0020.pgc - 지급 온라인 서비스 (PY_OL_0020) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 py 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "py_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/py_ol_0020.pgc" + + +TX_SERVICE(PY_OL_0020, ctx) +{ + py_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[PY_OL_0020] 지급 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[PY_OL_0020] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[PY_OL_0020] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[PY_OL_0020] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, PY_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = py_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[PY_OL_0020] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = py_rec_count(bizdate, PY_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[PY_OL_0020] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/py_ol_0020.pgc b/app/online/py_ol_0020.pgc new file mode 100644 index 0000000..f93f0a2 --- /dev/null +++ b/app/online/py_ol_0020.pgc @@ -0,0 +1,70 @@ +/* @tier medium @module py @transform payment-online */ +/* + * py_ol_0020.pgc - 지급 온라인 서비스 (PY_OL_0020) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 py 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "py_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(PY_OL_0020, ctx) +{ + py_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[PY_OL_0020] 지급 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[PY_OL_0020] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[PY_OL_0020] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[PY_OL_0020] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, PY_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = py_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[PY_OL_0020] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = py_rec_count(bizdate, PY_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[PY_OL_0020] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/py_ol_0021.c b/app/online/py_ol_0021.c new file mode 100644 index 0000000..0599f7f --- /dev/null +++ b/app/online/py_ol_0021.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/py_ol_0021.pgc" +/* @tier easy @module py @transform payment-online */ +/* + * py_ol_0021.pgc - 지급 온라인 서비스 (PY_OL_0021) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 py 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "py_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/py_ol_0021.pgc" + + +TX_SERVICE(PY_OL_0021, ctx) +{ + py_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[PY_OL_0021] 지급 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[PY_OL_0021] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = py_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[PY_OL_0021] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[PY_OL_0021] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/py_ol_0021.pgc b/app/online/py_ol_0021.pgc new file mode 100644 index 0000000..31f6289 --- /dev/null +++ b/app/online/py_ol_0021.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module py @transform payment-online */ +/* + * py_ol_0021.pgc - 지급 온라인 서비스 (PY_OL_0021) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 py 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "py_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(PY_OL_0021, ctx) +{ + py_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[PY_OL_0021] 지급 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[PY_OL_0021] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = py_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[PY_OL_0021] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[PY_OL_0021] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/py_ol_0022.c b/app/online/py_ol_0022.c new file mode 100644 index 0000000..abeb334 --- /dev/null +++ b/app/online/py_ol_0022.c @@ -0,0 +1,176 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/py_ol_0022.pgc" +/* @tier hard @module py @transform payment-online */ +/* + * py_ol_0022.pgc - 지급 온라인 서비스 (PY_OL_0022) [tier=hard] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 py 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "py_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/py_ol_0022.pgc" + + +TX_SERVICE(PY_OL_0022, ctx) +{ + py_rec_t rec; + char key[16], merch[16], bizdate[16], nextbiz[9]; + long amount = 0, daysum = 0; + int rc; + TXBUF *sub_in; + TXBUF *sub_out; + + tx_log(TX_LOG_INFO, "[PY_OL_0022] 지급 트랜잭션 오케스트레이션 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[PY_OL_0022] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + if (!amount_is_valid(amount) || !date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[PY_OL_0022] 입력 검증 실패 amount=%ld date=%s", + amount, bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + /* 트랜잭션 시작 → 원장 반영 → 후속 서비스 연계 → 커밋 */ + if (tx_begin() != TX_OK) { + tx_return(ctx, TX_FAIL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, PY_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; + + rc = py_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[PY_OL_0022] 원장반영 실패 rc=%d", rc); + tx_abort(); + tx_return(ctx, rc, ctx->out); + return; + } + + /* 정산 영업일 = 거래일의 다음 영업일 */ + if (date_next_business(bizdate, nextbiz) != 0) { + memcpy(nextbiz, bizdate, 8); + nextbiz[8] = '\0'; + } + + /* 후속 정산집계 서비스 연계 (레지스트리 문자열 디스패치) */ + sub_in = tx_buf_alloc(); + sub_out = tx_buf_alloc(); + if (sub_in && sub_out) { + tx_buf_sets(sub_in, "MERCHID", merch); + tx_buf_sets(sub_in, "BIZDATE", nextbiz); + tx_buf_setlong(sub_in, "AMOUNT", amount); + rc = tx_call("PY_POST", sub_in, sub_out); + if (rc != TX_OK) + tx_log(TX_LOG_WARN, "[PY_OL_0022] 후속연계 경고 rc=%d", rc); + } + tx_buf_free(sub_in); + tx_buf_free(sub_out); + + /* 교차 검증: 당일 합계 재계산 */ + if (py_rec_sum(bizdate, &daysum) != TX_OK) + daysum = 0; + + tx_commit(); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYSUM", daysum); + tx_log(TX_LOG_INFO, "[PY_OL_0022] 완료 key=%s 당일합계=%ld", key, daysum); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/py_ol_0022.pgc b/app/online/py_ol_0022.pgc new file mode 100644 index 0000000..f9969de --- /dev/null +++ b/app/online/py_ol_0022.pgc @@ -0,0 +1,98 @@ +/* @tier hard @module py @transform payment-online */ +/* + * py_ol_0022.pgc - 지급 온라인 서비스 (PY_OL_0022) [tier=hard] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 py 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "py_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(PY_OL_0022, ctx) +{ + py_rec_t rec; + char key[16], merch[16], bizdate[16], nextbiz[9]; + long amount = 0, daysum = 0; + int rc; + TXBUF *sub_in; + TXBUF *sub_out; + + tx_log(TX_LOG_INFO, "[PY_OL_0022] 지급 트랜잭션 오케스트레이션 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[PY_OL_0022] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + if (!amount_is_valid(amount) || !date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[PY_OL_0022] 입력 검증 실패 amount=%ld date=%s", + amount, bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + /* 트랜잭션 시작 → 원장 반영 → 후속 서비스 연계 → 커밋 */ + if (tx_begin() != TX_OK) { + tx_return(ctx, TX_FAIL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, PY_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; + + rc = py_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[PY_OL_0022] 원장반영 실패 rc=%d", rc); + tx_abort(); + tx_return(ctx, rc, ctx->out); + return; + } + + /* 정산 영업일 = 거래일의 다음 영업일 */ + if (date_next_business(bizdate, nextbiz) != 0) { + memcpy(nextbiz, bizdate, 8); + nextbiz[8] = '\0'; + } + + /* 후속 정산집계 서비스 연계 (레지스트리 문자열 디스패치) */ + sub_in = tx_buf_alloc(); + sub_out = tx_buf_alloc(); + if (sub_in && sub_out) { + tx_buf_sets(sub_in, "MERCHID", merch); + tx_buf_sets(sub_in, "BIZDATE", nextbiz); + tx_buf_setlong(sub_in, "AMOUNT", amount); + rc = tx_call("PY_POST", sub_in, sub_out); + if (rc != TX_OK) + tx_log(TX_LOG_WARN, "[PY_OL_0022] 후속연계 경고 rc=%d", rc); + } + tx_buf_free(sub_in); + tx_buf_free(sub_out); + + /* 교차 검증: 당일 합계 재계산 */ + if (py_rec_sum(bizdate, &daysum) != TX_OK) + daysum = 0; + + tx_commit(); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYSUM", daysum); + tx_log(TX_LOG_INFO, "[PY_OL_0022] 완료 key=%s 당일합계=%ld", key, daysum); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/py_ol_0023.c b/app/online/py_ol_0023.c new file mode 100644 index 0000000..fca9bb5 --- /dev/null +++ b/app/online/py_ol_0023.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/py_ol_0023.pgc" +/* @tier easy @module py @transform payment-online */ +/* + * py_ol_0023.pgc - 지급 온라인 서비스 (PY_OL_0023) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 py 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "py_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/py_ol_0023.pgc" + + +TX_SERVICE(PY_OL_0023, ctx) +{ + py_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[PY_OL_0023] 지급 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[PY_OL_0023] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = py_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[PY_OL_0023] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[PY_OL_0023] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/py_ol_0023.pgc b/app/online/py_ol_0023.pgc new file mode 100644 index 0000000..0304330 --- /dev/null +++ b/app/online/py_ol_0023.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module py @transform payment-online */ +/* + * py_ol_0023.pgc - 지급 온라인 서비스 (PY_OL_0023) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 py 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "py_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(PY_OL_0023, ctx) +{ + py_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[PY_OL_0023] 지급 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[PY_OL_0023] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = py_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[PY_OL_0023] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[PY_OL_0023] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/py_ol_0024.c b/app/online/py_ol_0024.c new file mode 100644 index 0000000..8a95c2a --- /dev/null +++ b/app/online/py_ol_0024.c @@ -0,0 +1,176 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/py_ol_0024.pgc" +/* @tier hard @module py @transform payment-online */ +/* + * py_ol_0024.pgc - 지급 온라인 서비스 (PY_OL_0024) [tier=hard] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 py 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "py_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/py_ol_0024.pgc" + + +TX_SERVICE(PY_OL_0024, ctx) +{ + py_rec_t rec; + char key[16], merch[16], bizdate[16], nextbiz[9]; + long amount = 0, daysum = 0; + int rc; + TXBUF *sub_in; + TXBUF *sub_out; + + tx_log(TX_LOG_INFO, "[PY_OL_0024] 지급 트랜잭션 오케스트레이션 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[PY_OL_0024] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + if (!amount_is_valid(amount) || !date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[PY_OL_0024] 입력 검증 실패 amount=%ld date=%s", + amount, bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + /* 트랜잭션 시작 → 원장 반영 → 후속 서비스 연계 → 커밋 */ + if (tx_begin() != TX_OK) { + tx_return(ctx, TX_FAIL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, PY_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; + + rc = py_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[PY_OL_0024] 원장반영 실패 rc=%d", rc); + tx_abort(); + tx_return(ctx, rc, ctx->out); + return; + } + + /* 정산 영업일 = 거래일의 다음 영업일 */ + if (date_next_business(bizdate, nextbiz) != 0) { + memcpy(nextbiz, bizdate, 8); + nextbiz[8] = '\0'; + } + + /* 후속 정산집계 서비스 연계 (레지스트리 문자열 디스패치) */ + sub_in = tx_buf_alloc(); + sub_out = tx_buf_alloc(); + if (sub_in && sub_out) { + tx_buf_sets(sub_in, "MERCHID", merch); + tx_buf_sets(sub_in, "BIZDATE", nextbiz); + tx_buf_setlong(sub_in, "AMOUNT", amount); + rc = tx_call("PY_POST", sub_in, sub_out); + if (rc != TX_OK) + tx_log(TX_LOG_WARN, "[PY_OL_0024] 후속연계 경고 rc=%d", rc); + } + tx_buf_free(sub_in); + tx_buf_free(sub_out); + + /* 교차 검증: 당일 합계 재계산 */ + if (py_rec_sum(bizdate, &daysum) != TX_OK) + daysum = 0; + + tx_commit(); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYSUM", daysum); + tx_log(TX_LOG_INFO, "[PY_OL_0024] 완료 key=%s 당일합계=%ld", key, daysum); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/py_ol_0024.pgc b/app/online/py_ol_0024.pgc new file mode 100644 index 0000000..cf3bc7c --- /dev/null +++ b/app/online/py_ol_0024.pgc @@ -0,0 +1,98 @@ +/* @tier hard @module py @transform payment-online */ +/* + * py_ol_0024.pgc - 지급 온라인 서비스 (PY_OL_0024) [tier=hard] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 py 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "py_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(PY_OL_0024, ctx) +{ + py_rec_t rec; + char key[16], merch[16], bizdate[16], nextbiz[9]; + long amount = 0, daysum = 0; + int rc; + TXBUF *sub_in; + TXBUF *sub_out; + + tx_log(TX_LOG_INFO, "[PY_OL_0024] 지급 트랜잭션 오케스트레이션 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[PY_OL_0024] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + if (!amount_is_valid(amount) || !date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[PY_OL_0024] 입력 검증 실패 amount=%ld date=%s", + amount, bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + /* 트랜잭션 시작 → 원장 반영 → 후속 서비스 연계 → 커밋 */ + if (tx_begin() != TX_OK) { + tx_return(ctx, TX_FAIL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, PY_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; + + rc = py_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[PY_OL_0024] 원장반영 실패 rc=%d", rc); + tx_abort(); + tx_return(ctx, rc, ctx->out); + return; + } + + /* 정산 영업일 = 거래일의 다음 영업일 */ + if (date_next_business(bizdate, nextbiz) != 0) { + memcpy(nextbiz, bizdate, 8); + nextbiz[8] = '\0'; + } + + /* 후속 정산집계 서비스 연계 (레지스트리 문자열 디스패치) */ + sub_in = tx_buf_alloc(); + sub_out = tx_buf_alloc(); + if (sub_in && sub_out) { + tx_buf_sets(sub_in, "MERCHID", merch); + tx_buf_sets(sub_in, "BIZDATE", nextbiz); + tx_buf_setlong(sub_in, "AMOUNT", amount); + rc = tx_call("PY_POST", sub_in, sub_out); + if (rc != TX_OK) + tx_log(TX_LOG_WARN, "[PY_OL_0024] 후속연계 경고 rc=%d", rc); + } + tx_buf_free(sub_in); + tx_buf_free(sub_out); + + /* 교차 검증: 당일 합계 재계산 */ + if (py_rec_sum(bizdate, &daysum) != TX_OK) + daysum = 0; + + tx_commit(); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYSUM", daysum); + tx_log(TX_LOG_INFO, "[PY_OL_0024] 완료 key=%s 당일합계=%ld", key, daysum); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/py_ol_0025.c b/app/online/py_ol_0025.c new file mode 100644 index 0000000..da5b29a --- /dev/null +++ b/app/online/py_ol_0025.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/py_ol_0025.pgc" +/* @tier easy @module py @transform payment-online */ +/* + * py_ol_0025.pgc - 지급 온라인 서비스 (PY_OL_0025) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 py 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "py_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/py_ol_0025.pgc" + + +TX_SERVICE(PY_OL_0025, ctx) +{ + py_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[PY_OL_0025] 지급 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[PY_OL_0025] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = py_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[PY_OL_0025] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[PY_OL_0025] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/py_ol_0025.pgc b/app/online/py_ol_0025.pgc new file mode 100644 index 0000000..e3ac632 --- /dev/null +++ b/app/online/py_ol_0025.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module py @transform payment-online */ +/* + * py_ol_0025.pgc - 지급 온라인 서비스 (PY_OL_0025) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 py 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "py_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(PY_OL_0025, ctx) +{ + py_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[PY_OL_0025] 지급 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[PY_OL_0025] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = py_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[PY_OL_0025] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[PY_OL_0025] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/py_ol_0026.c b/app/online/py_ol_0026.c new file mode 100644 index 0000000..3aa3d2b --- /dev/null +++ b/app/online/py_ol_0026.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/py_ol_0026.pgc" +/* @tier easy @module py @transform payment-online */ +/* + * py_ol_0026.pgc - 지급 온라인 서비스 (PY_OL_0026) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 py 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "py_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/py_ol_0026.pgc" + + +TX_SERVICE(PY_OL_0026, ctx) +{ + py_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[PY_OL_0026] 지급 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[PY_OL_0026] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = py_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[PY_OL_0026] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[PY_OL_0026] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/py_ol_0026.pgc b/app/online/py_ol_0026.pgc new file mode 100644 index 0000000..5a7756e --- /dev/null +++ b/app/online/py_ol_0026.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module py @transform payment-online */ +/* + * py_ol_0026.pgc - 지급 온라인 서비스 (PY_OL_0026) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 py 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "py_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(PY_OL_0026, ctx) +{ + py_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[PY_OL_0026] 지급 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[PY_OL_0026] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = py_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[PY_OL_0026] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[PY_OL_0026] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/py_ol_0027.c b/app/online/py_ol_0027.c new file mode 100644 index 0000000..ae19165 --- /dev/null +++ b/app/online/py_ol_0027.c @@ -0,0 +1,148 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/py_ol_0027.pgc" +/* @tier medium @module py @transform payment-online */ +/* + * py_ol_0027.pgc - 지급 온라인 서비스 (PY_OL_0027) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 py 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "py_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/py_ol_0027.pgc" + + +TX_SERVICE(PY_OL_0027, ctx) +{ + py_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[PY_OL_0027] 지급 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[PY_OL_0027] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[PY_OL_0027] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[PY_OL_0027] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, PY_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = py_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[PY_OL_0027] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = py_rec_count(bizdate, PY_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[PY_OL_0027] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/py_ol_0027.pgc b/app/online/py_ol_0027.pgc new file mode 100644 index 0000000..a811a6f --- /dev/null +++ b/app/online/py_ol_0027.pgc @@ -0,0 +1,70 @@ +/* @tier medium @module py @transform payment-online */ +/* + * py_ol_0027.pgc - 지급 온라인 서비스 (PY_OL_0027) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 py 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "py_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(PY_OL_0027, ctx) +{ + py_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[PY_OL_0027] 지급 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[PY_OL_0027] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[PY_OL_0027] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[PY_OL_0027] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, PY_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = py_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[PY_OL_0027] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = py_rec_count(bizdate, PY_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[PY_OL_0027] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/py_ol_0028.c b/app/online/py_ol_0028.c new file mode 100644 index 0000000..d32879b --- /dev/null +++ b/app/online/py_ol_0028.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/py_ol_0028.pgc" +/* @tier easy @module py @transform payment-online */ +/* + * py_ol_0028.pgc - 지급 온라인 서비스 (PY_OL_0028) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 py 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "py_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/py_ol_0028.pgc" + + +TX_SERVICE(PY_OL_0028, ctx) +{ + py_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[PY_OL_0028] 지급 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[PY_OL_0028] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = py_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[PY_OL_0028] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[PY_OL_0028] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/py_ol_0028.pgc b/app/online/py_ol_0028.pgc new file mode 100644 index 0000000..e9514db --- /dev/null +++ b/app/online/py_ol_0028.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module py @transform payment-online */ +/* + * py_ol_0028.pgc - 지급 온라인 서비스 (PY_OL_0028) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 py 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "py_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(PY_OL_0028, ctx) +{ + py_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[PY_OL_0028] 지급 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[PY_OL_0028] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = py_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[PY_OL_0028] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[PY_OL_0028] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/py_ol_0029.c b/app/online/py_ol_0029.c new file mode 100644 index 0000000..6416f27 --- /dev/null +++ b/app/online/py_ol_0029.c @@ -0,0 +1,148 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/py_ol_0029.pgc" +/* @tier medium @module py @transform payment-online */ +/* + * py_ol_0029.pgc - 지급 온라인 서비스 (PY_OL_0029) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 py 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "py_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/py_ol_0029.pgc" + + +TX_SERVICE(PY_OL_0029, ctx) +{ + py_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[PY_OL_0029] 지급 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[PY_OL_0029] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[PY_OL_0029] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[PY_OL_0029] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, PY_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = py_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[PY_OL_0029] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = py_rec_count(bizdate, PY_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[PY_OL_0029] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/py_ol_0029.pgc b/app/online/py_ol_0029.pgc new file mode 100644 index 0000000..81bb3f6 --- /dev/null +++ b/app/online/py_ol_0029.pgc @@ -0,0 +1,70 @@ +/* @tier medium @module py @transform payment-online */ +/* + * py_ol_0029.pgc - 지급 온라인 서비스 (PY_OL_0029) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 py 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "py_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(PY_OL_0029, ctx) +{ + py_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[PY_OL_0029] 지급 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[PY_OL_0029] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[PY_OL_0029] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[PY_OL_0029] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, PY_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = py_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[PY_OL_0029] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = py_rec_count(bizdate, PY_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[PY_OL_0029] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/py_ol_0030.c b/app/online/py_ol_0030.c new file mode 100644 index 0000000..a6e5f09 --- /dev/null +++ b/app/online/py_ol_0030.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/py_ol_0030.pgc" +/* @tier easy @module py @transform payment-online */ +/* + * py_ol_0030.pgc - 지급 온라인 서비스 (PY_OL_0030) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 py 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "py_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/py_ol_0030.pgc" + + +TX_SERVICE(PY_OL_0030, ctx) +{ + py_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[PY_OL_0030] 지급 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[PY_OL_0030] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = py_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[PY_OL_0030] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[PY_OL_0030] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/py_ol_0030.pgc b/app/online/py_ol_0030.pgc new file mode 100644 index 0000000..0785cca --- /dev/null +++ b/app/online/py_ol_0030.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module py @transform payment-online */ +/* + * py_ol_0030.pgc - 지급 온라인 서비스 (PY_OL_0030) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 py 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "py_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(PY_OL_0030, ctx) +{ + py_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[PY_OL_0030] 지급 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[PY_OL_0030] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = py_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[PY_OL_0030] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[PY_OL_0030] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/py_ol_0031.c b/app/online/py_ol_0031.c new file mode 100644 index 0000000..794e1d6 --- /dev/null +++ b/app/online/py_ol_0031.c @@ -0,0 +1,148 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/py_ol_0031.pgc" +/* @tier medium @module py @transform payment-online */ +/* + * py_ol_0031.pgc - 지급 온라인 서비스 (PY_OL_0031) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 py 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "py_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/py_ol_0031.pgc" + + +TX_SERVICE(PY_OL_0031, ctx) +{ + py_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[PY_OL_0031] 지급 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[PY_OL_0031] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[PY_OL_0031] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[PY_OL_0031] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, PY_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = py_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[PY_OL_0031] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = py_rec_count(bizdate, PY_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[PY_OL_0031] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/py_ol_0031.pgc b/app/online/py_ol_0031.pgc new file mode 100644 index 0000000..2b47bc8 --- /dev/null +++ b/app/online/py_ol_0031.pgc @@ -0,0 +1,70 @@ +/* @tier medium @module py @transform payment-online */ +/* + * py_ol_0031.pgc - 지급 온라인 서비스 (PY_OL_0031) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 py 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "py_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(PY_OL_0031, ctx) +{ + py_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[PY_OL_0031] 지급 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[PY_OL_0031] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[PY_OL_0031] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[PY_OL_0031] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, PY_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = py_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[PY_OL_0031] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = py_rec_count(bizdate, PY_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[PY_OL_0031] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/py_ol_0032.c b/app/online/py_ol_0032.c new file mode 100644 index 0000000..2a3af6e --- /dev/null +++ b/app/online/py_ol_0032.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/py_ol_0032.pgc" +/* @tier easy @module py @transform payment-online */ +/* + * py_ol_0032.pgc - 지급 온라인 서비스 (PY_OL_0032) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 py 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "py_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/py_ol_0032.pgc" + + +TX_SERVICE(PY_OL_0032, ctx) +{ + py_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[PY_OL_0032] 지급 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[PY_OL_0032] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = py_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[PY_OL_0032] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[PY_OL_0032] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/py_ol_0032.pgc b/app/online/py_ol_0032.pgc new file mode 100644 index 0000000..fcc742b --- /dev/null +++ b/app/online/py_ol_0032.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module py @transform payment-online */ +/* + * py_ol_0032.pgc - 지급 온라인 서비스 (PY_OL_0032) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 py 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "py_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(PY_OL_0032, ctx) +{ + py_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[PY_OL_0032] 지급 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[PY_OL_0032] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = py_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[PY_OL_0032] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[PY_OL_0032] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/rc_ol_0001.c b/app/online/rc_ol_0001.c new file mode 100644 index 0000000..3f7644a --- /dev/null +++ b/app/online/rc_ol_0001.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/rc_ol_0001.pgc" +/* @tier easy @module rc @transform reconciliation-online */ +/* + * rc_ol_0001.pgc - 대사 온라인 서비스 (RC_OL_0001) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 rc 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "rc_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/rc_ol_0001.pgc" + + +TX_SERVICE(RC_OL_0001, ctx) +{ + rc_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[RC_OL_0001] 대사 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[RC_OL_0001] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = rc_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[RC_OL_0001] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[RC_OL_0001] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/rc_ol_0001.pgc b/app/online/rc_ol_0001.pgc new file mode 100644 index 0000000..86e311e --- /dev/null +++ b/app/online/rc_ol_0001.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module rc @transform reconciliation-online */ +/* + * rc_ol_0001.pgc - 대사 온라인 서비스 (RC_OL_0001) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 rc 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "rc_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(RC_OL_0001, ctx) +{ + rc_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[RC_OL_0001] 대사 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[RC_OL_0001] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = rc_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[RC_OL_0001] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[RC_OL_0001] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/rc_ol_0002.c b/app/online/rc_ol_0002.c new file mode 100644 index 0000000..32db76d --- /dev/null +++ b/app/online/rc_ol_0002.c @@ -0,0 +1,148 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/rc_ol_0002.pgc" +/* @tier medium @module rc @transform reconciliation-online */ +/* + * rc_ol_0002.pgc - 대사 온라인 서비스 (RC_OL_0002) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 rc 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "rc_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/rc_ol_0002.pgc" + + +TX_SERVICE(RC_OL_0002, ctx) +{ + rc_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[RC_OL_0002] 대사 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[RC_OL_0002] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[RC_OL_0002] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[RC_OL_0002] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, RC_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = rc_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[RC_OL_0002] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = rc_rec_count(bizdate, RC_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[RC_OL_0002] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/rc_ol_0002.pgc b/app/online/rc_ol_0002.pgc new file mode 100644 index 0000000..8b1c1cb --- /dev/null +++ b/app/online/rc_ol_0002.pgc @@ -0,0 +1,70 @@ +/* @tier medium @module rc @transform reconciliation-online */ +/* + * rc_ol_0002.pgc - 대사 온라인 서비스 (RC_OL_0002) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 rc 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "rc_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(RC_OL_0002, ctx) +{ + rc_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[RC_OL_0002] 대사 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[RC_OL_0002] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[RC_OL_0002] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[RC_OL_0002] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, RC_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = rc_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[RC_OL_0002] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = rc_rec_count(bizdate, RC_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[RC_OL_0002] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/rc_ol_0003.c b/app/online/rc_ol_0003.c new file mode 100644 index 0000000..58ce604 --- /dev/null +++ b/app/online/rc_ol_0003.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/rc_ol_0003.pgc" +/* @tier easy @module rc @transform reconciliation-online */ +/* + * rc_ol_0003.pgc - 대사 온라인 서비스 (RC_OL_0003) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 rc 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "rc_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/rc_ol_0003.pgc" + + +TX_SERVICE(RC_OL_0003, ctx) +{ + rc_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[RC_OL_0003] 대사 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[RC_OL_0003] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = rc_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[RC_OL_0003] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[RC_OL_0003] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/rc_ol_0003.pgc b/app/online/rc_ol_0003.pgc new file mode 100644 index 0000000..ee99842 --- /dev/null +++ b/app/online/rc_ol_0003.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module rc @transform reconciliation-online */ +/* + * rc_ol_0003.pgc - 대사 온라인 서비스 (RC_OL_0003) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 rc 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "rc_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(RC_OL_0003, ctx) +{ + rc_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[RC_OL_0003] 대사 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[RC_OL_0003] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = rc_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[RC_OL_0003] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[RC_OL_0003] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/rc_ol_0004.c b/app/online/rc_ol_0004.c new file mode 100644 index 0000000..54a3bb8 --- /dev/null +++ b/app/online/rc_ol_0004.c @@ -0,0 +1,148 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/rc_ol_0004.pgc" +/* @tier medium @module rc @transform reconciliation-online */ +/* + * rc_ol_0004.pgc - 대사 온라인 서비스 (RC_OL_0004) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 rc 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "rc_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/rc_ol_0004.pgc" + + +TX_SERVICE(RC_OL_0004, ctx) +{ + rc_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[RC_OL_0004] 대사 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[RC_OL_0004] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[RC_OL_0004] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[RC_OL_0004] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, RC_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = rc_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[RC_OL_0004] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = rc_rec_count(bizdate, RC_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[RC_OL_0004] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/rc_ol_0004.pgc b/app/online/rc_ol_0004.pgc new file mode 100644 index 0000000..0baea69 --- /dev/null +++ b/app/online/rc_ol_0004.pgc @@ -0,0 +1,70 @@ +/* @tier medium @module rc @transform reconciliation-online */ +/* + * rc_ol_0004.pgc - 대사 온라인 서비스 (RC_OL_0004) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 rc 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "rc_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(RC_OL_0004, ctx) +{ + rc_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[RC_OL_0004] 대사 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[RC_OL_0004] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[RC_OL_0004] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[RC_OL_0004] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, RC_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = rc_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[RC_OL_0004] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = rc_rec_count(bizdate, RC_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[RC_OL_0004] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/rc_ol_0005.c b/app/online/rc_ol_0005.c new file mode 100644 index 0000000..d9dc868 --- /dev/null +++ b/app/online/rc_ol_0005.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/rc_ol_0005.pgc" +/* @tier easy @module rc @transform reconciliation-online */ +/* + * rc_ol_0005.pgc - 대사 온라인 서비스 (RC_OL_0005) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 rc 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "rc_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/rc_ol_0005.pgc" + + +TX_SERVICE(RC_OL_0005, ctx) +{ + rc_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[RC_OL_0005] 대사 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[RC_OL_0005] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = rc_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[RC_OL_0005] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[RC_OL_0005] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/rc_ol_0005.pgc b/app/online/rc_ol_0005.pgc new file mode 100644 index 0000000..8e592f2 --- /dev/null +++ b/app/online/rc_ol_0005.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module rc @transform reconciliation-online */ +/* + * rc_ol_0005.pgc - 대사 온라인 서비스 (RC_OL_0005) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 rc 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "rc_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(RC_OL_0005, ctx) +{ + rc_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[RC_OL_0005] 대사 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[RC_OL_0005] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = rc_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[RC_OL_0005] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[RC_OL_0005] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/rc_ol_0006.c b/app/online/rc_ol_0006.c new file mode 100644 index 0000000..9e4b5c5 --- /dev/null +++ b/app/online/rc_ol_0006.c @@ -0,0 +1,176 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/rc_ol_0006.pgc" +/* @tier hard @module rc @transform reconciliation-online */ +/* + * rc_ol_0006.pgc - 대사 온라인 서비스 (RC_OL_0006) [tier=hard] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 rc 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "rc_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/rc_ol_0006.pgc" + + +TX_SERVICE(RC_OL_0006, ctx) +{ + rc_rec_t rec; + char key[16], merch[16], bizdate[16], nextbiz[9]; + long amount = 0, daysum = 0; + int rc; + TXBUF *sub_in; + TXBUF *sub_out; + + tx_log(TX_LOG_INFO, "[RC_OL_0006] 대사 트랜잭션 오케스트레이션 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[RC_OL_0006] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + if (!amount_is_valid(amount) || !date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[RC_OL_0006] 입력 검증 실패 amount=%ld date=%s", + amount, bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + /* 트랜잭션 시작 → 원장 반영 → 후속 서비스 연계 → 커밋 */ + if (tx_begin() != TX_OK) { + tx_return(ctx, TX_FAIL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, RC_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; + + rc = rc_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[RC_OL_0006] 원장반영 실패 rc=%d", rc); + tx_abort(); + tx_return(ctx, rc, ctx->out); + return; + } + + /* 정산 영업일 = 거래일의 다음 영업일 */ + if (date_next_business(bizdate, nextbiz) != 0) { + memcpy(nextbiz, bizdate, 8); + nextbiz[8] = '\0'; + } + + /* 후속 정산집계 서비스 연계 (레지스트리 문자열 디스패치) */ + sub_in = tx_buf_alloc(); + sub_out = tx_buf_alloc(); + if (sub_in && sub_out) { + tx_buf_sets(sub_in, "MERCHID", merch); + tx_buf_sets(sub_in, "BIZDATE", nextbiz); + tx_buf_setlong(sub_in, "AMOUNT", amount); + rc = tx_call("RC_POST", sub_in, sub_out); + if (rc != TX_OK) + tx_log(TX_LOG_WARN, "[RC_OL_0006] 후속연계 경고 rc=%d", rc); + } + tx_buf_free(sub_in); + tx_buf_free(sub_out); + + /* 교차 검증: 당일 합계 재계산 */ + if (rc_rec_sum(bizdate, &daysum) != TX_OK) + daysum = 0; + + tx_commit(); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYSUM", daysum); + tx_log(TX_LOG_INFO, "[RC_OL_0006] 완료 key=%s 당일합계=%ld", key, daysum); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/rc_ol_0006.pgc b/app/online/rc_ol_0006.pgc new file mode 100644 index 0000000..ce20689 --- /dev/null +++ b/app/online/rc_ol_0006.pgc @@ -0,0 +1,98 @@ +/* @tier hard @module rc @transform reconciliation-online */ +/* + * rc_ol_0006.pgc - 대사 온라인 서비스 (RC_OL_0006) [tier=hard] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 rc 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "rc_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(RC_OL_0006, ctx) +{ + rc_rec_t rec; + char key[16], merch[16], bizdate[16], nextbiz[9]; + long amount = 0, daysum = 0; + int rc; + TXBUF *sub_in; + TXBUF *sub_out; + + tx_log(TX_LOG_INFO, "[RC_OL_0006] 대사 트랜잭션 오케스트레이션 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[RC_OL_0006] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + if (!amount_is_valid(amount) || !date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[RC_OL_0006] 입력 검증 실패 amount=%ld date=%s", + amount, bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + /* 트랜잭션 시작 → 원장 반영 → 후속 서비스 연계 → 커밋 */ + if (tx_begin() != TX_OK) { + tx_return(ctx, TX_FAIL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, RC_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; + + rc = rc_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[RC_OL_0006] 원장반영 실패 rc=%d", rc); + tx_abort(); + tx_return(ctx, rc, ctx->out); + return; + } + + /* 정산 영업일 = 거래일의 다음 영업일 */ + if (date_next_business(bizdate, nextbiz) != 0) { + memcpy(nextbiz, bizdate, 8); + nextbiz[8] = '\0'; + } + + /* 후속 정산집계 서비스 연계 (레지스트리 문자열 디스패치) */ + sub_in = tx_buf_alloc(); + sub_out = tx_buf_alloc(); + if (sub_in && sub_out) { + tx_buf_sets(sub_in, "MERCHID", merch); + tx_buf_sets(sub_in, "BIZDATE", nextbiz); + tx_buf_setlong(sub_in, "AMOUNT", amount); + rc = tx_call("RC_POST", sub_in, sub_out); + if (rc != TX_OK) + tx_log(TX_LOG_WARN, "[RC_OL_0006] 후속연계 경고 rc=%d", rc); + } + tx_buf_free(sub_in); + tx_buf_free(sub_out); + + /* 교차 검증: 당일 합계 재계산 */ + if (rc_rec_sum(bizdate, &daysum) != TX_OK) + daysum = 0; + + tx_commit(); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYSUM", daysum); + tx_log(TX_LOG_INFO, "[RC_OL_0006] 완료 key=%s 당일합계=%ld", key, daysum); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/rc_ol_0007.c b/app/online/rc_ol_0007.c new file mode 100644 index 0000000..b3ecb34 --- /dev/null +++ b/app/online/rc_ol_0007.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/rc_ol_0007.pgc" +/* @tier easy @module rc @transform reconciliation-online */ +/* + * rc_ol_0007.pgc - 대사 온라인 서비스 (RC_OL_0007) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 rc 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "rc_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/rc_ol_0007.pgc" + + +TX_SERVICE(RC_OL_0007, ctx) +{ + rc_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[RC_OL_0007] 대사 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[RC_OL_0007] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = rc_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[RC_OL_0007] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[RC_OL_0007] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/rc_ol_0007.pgc b/app/online/rc_ol_0007.pgc new file mode 100644 index 0000000..0272b8e --- /dev/null +++ b/app/online/rc_ol_0007.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module rc @transform reconciliation-online */ +/* + * rc_ol_0007.pgc - 대사 온라인 서비스 (RC_OL_0007) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 rc 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "rc_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(RC_OL_0007, ctx) +{ + rc_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[RC_OL_0007] 대사 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[RC_OL_0007] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = rc_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[RC_OL_0007] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[RC_OL_0007] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/rc_ol_0008.c b/app/online/rc_ol_0008.c new file mode 100644 index 0000000..9666a68 --- /dev/null +++ b/app/online/rc_ol_0008.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/rc_ol_0008.pgc" +/* @tier easy @module rc @transform reconciliation-online */ +/* + * rc_ol_0008.pgc - 대사 온라인 서비스 (RC_OL_0008) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 rc 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "rc_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/rc_ol_0008.pgc" + + +TX_SERVICE(RC_OL_0008, ctx) +{ + rc_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[RC_OL_0008] 대사 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[RC_OL_0008] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = rc_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[RC_OL_0008] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[RC_OL_0008] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/rc_ol_0008.pgc b/app/online/rc_ol_0008.pgc new file mode 100644 index 0000000..1533fc5 --- /dev/null +++ b/app/online/rc_ol_0008.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module rc @transform reconciliation-online */ +/* + * rc_ol_0008.pgc - 대사 온라인 서비스 (RC_OL_0008) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 rc 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "rc_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(RC_OL_0008, ctx) +{ + rc_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[RC_OL_0008] 대사 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[RC_OL_0008] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = rc_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[RC_OL_0008] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[RC_OL_0008] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/rc_ol_0009.c b/app/online/rc_ol_0009.c new file mode 100644 index 0000000..8a458a2 --- /dev/null +++ b/app/online/rc_ol_0009.c @@ -0,0 +1,148 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/rc_ol_0009.pgc" +/* @tier medium @module rc @transform reconciliation-online */ +/* + * rc_ol_0009.pgc - 대사 온라인 서비스 (RC_OL_0009) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 rc 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "rc_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/rc_ol_0009.pgc" + + +TX_SERVICE(RC_OL_0009, ctx) +{ + rc_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[RC_OL_0009] 대사 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[RC_OL_0009] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[RC_OL_0009] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[RC_OL_0009] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, RC_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = rc_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[RC_OL_0009] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = rc_rec_count(bizdate, RC_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[RC_OL_0009] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/rc_ol_0009.pgc b/app/online/rc_ol_0009.pgc new file mode 100644 index 0000000..2247550 --- /dev/null +++ b/app/online/rc_ol_0009.pgc @@ -0,0 +1,70 @@ +/* @tier medium @module rc @transform reconciliation-online */ +/* + * rc_ol_0009.pgc - 대사 온라인 서비스 (RC_OL_0009) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 rc 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "rc_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(RC_OL_0009, ctx) +{ + rc_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[RC_OL_0009] 대사 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[RC_OL_0009] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[RC_OL_0009] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[RC_OL_0009] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, RC_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = rc_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[RC_OL_0009] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = rc_rec_count(bizdate, RC_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[RC_OL_0009] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/rc_ol_0010.c b/app/online/rc_ol_0010.c new file mode 100644 index 0000000..1870451 --- /dev/null +++ b/app/online/rc_ol_0010.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/rc_ol_0010.pgc" +/* @tier easy @module rc @transform reconciliation-online */ +/* + * rc_ol_0010.pgc - 대사 온라인 서비스 (RC_OL_0010) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 rc 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "rc_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/rc_ol_0010.pgc" + + +TX_SERVICE(RC_OL_0010, ctx) +{ + rc_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[RC_OL_0010] 대사 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[RC_OL_0010] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = rc_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[RC_OL_0010] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[RC_OL_0010] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/rc_ol_0010.pgc b/app/online/rc_ol_0010.pgc new file mode 100644 index 0000000..5da4c7a --- /dev/null +++ b/app/online/rc_ol_0010.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module rc @transform reconciliation-online */ +/* + * rc_ol_0010.pgc - 대사 온라인 서비스 (RC_OL_0010) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 rc 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "rc_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(RC_OL_0010, ctx) +{ + rc_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[RC_OL_0010] 대사 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[RC_OL_0010] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = rc_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[RC_OL_0010] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[RC_OL_0010] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/rc_ol_0011.c b/app/online/rc_ol_0011.c new file mode 100644 index 0000000..b9454d9 --- /dev/null +++ b/app/online/rc_ol_0011.c @@ -0,0 +1,148 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/rc_ol_0011.pgc" +/* @tier medium @module rc @transform reconciliation-online */ +/* + * rc_ol_0011.pgc - 대사 온라인 서비스 (RC_OL_0011) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 rc 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "rc_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/rc_ol_0011.pgc" + + +TX_SERVICE(RC_OL_0011, ctx) +{ + rc_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[RC_OL_0011] 대사 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[RC_OL_0011] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[RC_OL_0011] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[RC_OL_0011] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, RC_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = rc_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[RC_OL_0011] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = rc_rec_count(bizdate, RC_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[RC_OL_0011] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/rc_ol_0011.pgc b/app/online/rc_ol_0011.pgc new file mode 100644 index 0000000..e446736 --- /dev/null +++ b/app/online/rc_ol_0011.pgc @@ -0,0 +1,70 @@ +/* @tier medium @module rc @transform reconciliation-online */ +/* + * rc_ol_0011.pgc - 대사 온라인 서비스 (RC_OL_0011) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 rc 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "rc_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(RC_OL_0011, ctx) +{ + rc_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[RC_OL_0011] 대사 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[RC_OL_0011] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[RC_OL_0011] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[RC_OL_0011] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, RC_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = rc_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[RC_OL_0011] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = rc_rec_count(bizdate, RC_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[RC_OL_0011] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/rc_ol_0012.c b/app/online/rc_ol_0012.c new file mode 100644 index 0000000..e166c41 --- /dev/null +++ b/app/online/rc_ol_0012.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/rc_ol_0012.pgc" +/* @tier easy @module rc @transform reconciliation-online */ +/* + * rc_ol_0012.pgc - 대사 온라인 서비스 (RC_OL_0012) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 rc 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "rc_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/rc_ol_0012.pgc" + + +TX_SERVICE(RC_OL_0012, ctx) +{ + rc_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[RC_OL_0012] 대사 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[RC_OL_0012] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = rc_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[RC_OL_0012] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[RC_OL_0012] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/rc_ol_0012.pgc b/app/online/rc_ol_0012.pgc new file mode 100644 index 0000000..18971eb --- /dev/null +++ b/app/online/rc_ol_0012.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module rc @transform reconciliation-online */ +/* + * rc_ol_0012.pgc - 대사 온라인 서비스 (RC_OL_0012) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 rc 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "rc_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(RC_OL_0012, ctx) +{ + rc_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[RC_OL_0012] 대사 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[RC_OL_0012] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = rc_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[RC_OL_0012] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[RC_OL_0012] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/rc_ol_0013.c b/app/online/rc_ol_0013.c new file mode 100644 index 0000000..1fa94e9 --- /dev/null +++ b/app/online/rc_ol_0013.c @@ -0,0 +1,148 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/rc_ol_0013.pgc" +/* @tier medium @module rc @transform reconciliation-online */ +/* + * rc_ol_0013.pgc - 대사 온라인 서비스 (RC_OL_0013) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 rc 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "rc_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/rc_ol_0013.pgc" + + +TX_SERVICE(RC_OL_0013, ctx) +{ + rc_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[RC_OL_0013] 대사 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[RC_OL_0013] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[RC_OL_0013] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[RC_OL_0013] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, RC_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = rc_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[RC_OL_0013] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = rc_rec_count(bizdate, RC_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[RC_OL_0013] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/rc_ol_0013.pgc b/app/online/rc_ol_0013.pgc new file mode 100644 index 0000000..861cdde --- /dev/null +++ b/app/online/rc_ol_0013.pgc @@ -0,0 +1,70 @@ +/* @tier medium @module rc @transform reconciliation-online */ +/* + * rc_ol_0013.pgc - 대사 온라인 서비스 (RC_OL_0013) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 rc 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "rc_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(RC_OL_0013, ctx) +{ + rc_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[RC_OL_0013] 대사 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[RC_OL_0013] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[RC_OL_0013] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[RC_OL_0013] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, RC_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = rc_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[RC_OL_0013] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = rc_rec_count(bizdate, RC_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[RC_OL_0013] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/rc_ol_0014.c b/app/online/rc_ol_0014.c new file mode 100644 index 0000000..8a5a9d3 --- /dev/null +++ b/app/online/rc_ol_0014.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/rc_ol_0014.pgc" +/* @tier easy @module rc @transform reconciliation-online */ +/* + * rc_ol_0014.pgc - 대사 온라인 서비스 (RC_OL_0014) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 rc 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "rc_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/rc_ol_0014.pgc" + + +TX_SERVICE(RC_OL_0014, ctx) +{ + rc_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[RC_OL_0014] 대사 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[RC_OL_0014] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = rc_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[RC_OL_0014] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[RC_OL_0014] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/rc_ol_0014.pgc b/app/online/rc_ol_0014.pgc new file mode 100644 index 0000000..3943cca --- /dev/null +++ b/app/online/rc_ol_0014.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module rc @transform reconciliation-online */ +/* + * rc_ol_0014.pgc - 대사 온라인 서비스 (RC_OL_0014) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 rc 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "rc_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(RC_OL_0014, ctx) +{ + rc_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[RC_OL_0014] 대사 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[RC_OL_0014] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = rc_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[RC_OL_0014] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[RC_OL_0014] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/rc_ol_0015.c b/app/online/rc_ol_0015.c new file mode 100644 index 0000000..2e86e11 --- /dev/null +++ b/app/online/rc_ol_0015.c @@ -0,0 +1,176 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/rc_ol_0015.pgc" +/* @tier hard @module rc @transform reconciliation-online */ +/* + * rc_ol_0015.pgc - 대사 온라인 서비스 (RC_OL_0015) [tier=hard] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 rc 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "rc_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/rc_ol_0015.pgc" + + +TX_SERVICE(RC_OL_0015, ctx) +{ + rc_rec_t rec; + char key[16], merch[16], bizdate[16], nextbiz[9]; + long amount = 0, daysum = 0; + int rc; + TXBUF *sub_in; + TXBUF *sub_out; + + tx_log(TX_LOG_INFO, "[RC_OL_0015] 대사 트랜잭션 오케스트레이션 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[RC_OL_0015] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + if (!amount_is_valid(amount) || !date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[RC_OL_0015] 입력 검증 실패 amount=%ld date=%s", + amount, bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + /* 트랜잭션 시작 → 원장 반영 → 후속 서비스 연계 → 커밋 */ + if (tx_begin() != TX_OK) { + tx_return(ctx, TX_FAIL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, RC_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; + + rc = rc_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[RC_OL_0015] 원장반영 실패 rc=%d", rc); + tx_abort(); + tx_return(ctx, rc, ctx->out); + return; + } + + /* 정산 영업일 = 거래일의 다음 영업일 */ + if (date_next_business(bizdate, nextbiz) != 0) { + memcpy(nextbiz, bizdate, 8); + nextbiz[8] = '\0'; + } + + /* 후속 정산집계 서비스 연계 (레지스트리 문자열 디스패치) */ + sub_in = tx_buf_alloc(); + sub_out = tx_buf_alloc(); + if (sub_in && sub_out) { + tx_buf_sets(sub_in, "MERCHID", merch); + tx_buf_sets(sub_in, "BIZDATE", nextbiz); + tx_buf_setlong(sub_in, "AMOUNT", amount); + rc = tx_call("RC_POST", sub_in, sub_out); + if (rc != TX_OK) + tx_log(TX_LOG_WARN, "[RC_OL_0015] 후속연계 경고 rc=%d", rc); + } + tx_buf_free(sub_in); + tx_buf_free(sub_out); + + /* 교차 검증: 당일 합계 재계산 */ + if (rc_rec_sum(bizdate, &daysum) != TX_OK) + daysum = 0; + + tx_commit(); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYSUM", daysum); + tx_log(TX_LOG_INFO, "[RC_OL_0015] 완료 key=%s 당일합계=%ld", key, daysum); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/rc_ol_0015.pgc b/app/online/rc_ol_0015.pgc new file mode 100644 index 0000000..09916b9 --- /dev/null +++ b/app/online/rc_ol_0015.pgc @@ -0,0 +1,98 @@ +/* @tier hard @module rc @transform reconciliation-online */ +/* + * rc_ol_0015.pgc - 대사 온라인 서비스 (RC_OL_0015) [tier=hard] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 rc 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "rc_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(RC_OL_0015, ctx) +{ + rc_rec_t rec; + char key[16], merch[16], bizdate[16], nextbiz[9]; + long amount = 0, daysum = 0; + int rc; + TXBUF *sub_in; + TXBUF *sub_out; + + tx_log(TX_LOG_INFO, "[RC_OL_0015] 대사 트랜잭션 오케스트레이션 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[RC_OL_0015] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + if (!amount_is_valid(amount) || !date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[RC_OL_0015] 입력 검증 실패 amount=%ld date=%s", + amount, bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + /* 트랜잭션 시작 → 원장 반영 → 후속 서비스 연계 → 커밋 */ + if (tx_begin() != TX_OK) { + tx_return(ctx, TX_FAIL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, RC_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; + + rc = rc_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[RC_OL_0015] 원장반영 실패 rc=%d", rc); + tx_abort(); + tx_return(ctx, rc, ctx->out); + return; + } + + /* 정산 영업일 = 거래일의 다음 영업일 */ + if (date_next_business(bizdate, nextbiz) != 0) { + memcpy(nextbiz, bizdate, 8); + nextbiz[8] = '\0'; + } + + /* 후속 정산집계 서비스 연계 (레지스트리 문자열 디스패치) */ + sub_in = tx_buf_alloc(); + sub_out = tx_buf_alloc(); + if (sub_in && sub_out) { + tx_buf_sets(sub_in, "MERCHID", merch); + tx_buf_sets(sub_in, "BIZDATE", nextbiz); + tx_buf_setlong(sub_in, "AMOUNT", amount); + rc = tx_call("RC_POST", sub_in, sub_out); + if (rc != TX_OK) + tx_log(TX_LOG_WARN, "[RC_OL_0015] 후속연계 경고 rc=%d", rc); + } + tx_buf_free(sub_in); + tx_buf_free(sub_out); + + /* 교차 검증: 당일 합계 재계산 */ + if (rc_rec_sum(bizdate, &daysum) != TX_OK) + daysum = 0; + + tx_commit(); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYSUM", daysum); + tx_log(TX_LOG_INFO, "[RC_OL_0015] 완료 key=%s 당일합계=%ld", key, daysum); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/rc_ol_0016.c b/app/online/rc_ol_0016.c new file mode 100644 index 0000000..2872b51 --- /dev/null +++ b/app/online/rc_ol_0016.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/rc_ol_0016.pgc" +/* @tier easy @module rc @transform reconciliation-online */ +/* + * rc_ol_0016.pgc - 대사 온라인 서비스 (RC_OL_0016) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 rc 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "rc_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/rc_ol_0016.pgc" + + +TX_SERVICE(RC_OL_0016, ctx) +{ + rc_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[RC_OL_0016] 대사 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[RC_OL_0016] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = rc_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[RC_OL_0016] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[RC_OL_0016] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/rc_ol_0016.pgc b/app/online/rc_ol_0016.pgc new file mode 100644 index 0000000..6557590 --- /dev/null +++ b/app/online/rc_ol_0016.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module rc @transform reconciliation-online */ +/* + * rc_ol_0016.pgc - 대사 온라인 서비스 (RC_OL_0016) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 rc 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "rc_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(RC_OL_0016, ctx) +{ + rc_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[RC_OL_0016] 대사 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[RC_OL_0016] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = rc_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[RC_OL_0016] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[RC_OL_0016] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/rc_ol_0017.c b/app/online/rc_ol_0017.c new file mode 100644 index 0000000..401dcef --- /dev/null +++ b/app/online/rc_ol_0017.c @@ -0,0 +1,176 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/rc_ol_0017.pgc" +/* @tier hard @module rc @transform reconciliation-online */ +/* + * rc_ol_0017.pgc - 대사 온라인 서비스 (RC_OL_0017) [tier=hard] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 rc 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "rc_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/rc_ol_0017.pgc" + + +TX_SERVICE(RC_OL_0017, ctx) +{ + rc_rec_t rec; + char key[16], merch[16], bizdate[16], nextbiz[9]; + long amount = 0, daysum = 0; + int rc; + TXBUF *sub_in; + TXBUF *sub_out; + + tx_log(TX_LOG_INFO, "[RC_OL_0017] 대사 트랜잭션 오케스트레이션 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[RC_OL_0017] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + if (!amount_is_valid(amount) || !date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[RC_OL_0017] 입력 검증 실패 amount=%ld date=%s", + amount, bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + /* 트랜잭션 시작 → 원장 반영 → 후속 서비스 연계 → 커밋 */ + if (tx_begin() != TX_OK) { + tx_return(ctx, TX_FAIL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, RC_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; + + rc = rc_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[RC_OL_0017] 원장반영 실패 rc=%d", rc); + tx_abort(); + tx_return(ctx, rc, ctx->out); + return; + } + + /* 정산 영업일 = 거래일의 다음 영업일 */ + if (date_next_business(bizdate, nextbiz) != 0) { + memcpy(nextbiz, bizdate, 8); + nextbiz[8] = '\0'; + } + + /* 후속 정산집계 서비스 연계 (레지스트리 문자열 디스패치) */ + sub_in = tx_buf_alloc(); + sub_out = tx_buf_alloc(); + if (sub_in && sub_out) { + tx_buf_sets(sub_in, "MERCHID", merch); + tx_buf_sets(sub_in, "BIZDATE", nextbiz); + tx_buf_setlong(sub_in, "AMOUNT", amount); + rc = tx_call("RC_POST", sub_in, sub_out); + if (rc != TX_OK) + tx_log(TX_LOG_WARN, "[RC_OL_0017] 후속연계 경고 rc=%d", rc); + } + tx_buf_free(sub_in); + tx_buf_free(sub_out); + + /* 교차 검증: 당일 합계 재계산 */ + if (rc_rec_sum(bizdate, &daysum) != TX_OK) + daysum = 0; + + tx_commit(); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYSUM", daysum); + tx_log(TX_LOG_INFO, "[RC_OL_0017] 완료 key=%s 당일합계=%ld", key, daysum); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/rc_ol_0017.pgc b/app/online/rc_ol_0017.pgc new file mode 100644 index 0000000..30daa4b --- /dev/null +++ b/app/online/rc_ol_0017.pgc @@ -0,0 +1,98 @@ +/* @tier hard @module rc @transform reconciliation-online */ +/* + * rc_ol_0017.pgc - 대사 온라인 서비스 (RC_OL_0017) [tier=hard] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 rc 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "rc_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(RC_OL_0017, ctx) +{ + rc_rec_t rec; + char key[16], merch[16], bizdate[16], nextbiz[9]; + long amount = 0, daysum = 0; + int rc; + TXBUF *sub_in; + TXBUF *sub_out; + + tx_log(TX_LOG_INFO, "[RC_OL_0017] 대사 트랜잭션 오케스트레이션 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[RC_OL_0017] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + if (!amount_is_valid(amount) || !date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[RC_OL_0017] 입력 검증 실패 amount=%ld date=%s", + amount, bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + /* 트랜잭션 시작 → 원장 반영 → 후속 서비스 연계 → 커밋 */ + if (tx_begin() != TX_OK) { + tx_return(ctx, TX_FAIL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, RC_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; + + rc = rc_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[RC_OL_0017] 원장반영 실패 rc=%d", rc); + tx_abort(); + tx_return(ctx, rc, ctx->out); + return; + } + + /* 정산 영업일 = 거래일의 다음 영업일 */ + if (date_next_business(bizdate, nextbiz) != 0) { + memcpy(nextbiz, bizdate, 8); + nextbiz[8] = '\0'; + } + + /* 후속 정산집계 서비스 연계 (레지스트리 문자열 디스패치) */ + sub_in = tx_buf_alloc(); + sub_out = tx_buf_alloc(); + if (sub_in && sub_out) { + tx_buf_sets(sub_in, "MERCHID", merch); + tx_buf_sets(sub_in, "BIZDATE", nextbiz); + tx_buf_setlong(sub_in, "AMOUNT", amount); + rc = tx_call("RC_POST", sub_in, sub_out); + if (rc != TX_OK) + tx_log(TX_LOG_WARN, "[RC_OL_0017] 후속연계 경고 rc=%d", rc); + } + tx_buf_free(sub_in); + tx_buf_free(sub_out); + + /* 교차 검증: 당일 합계 재계산 */ + if (rc_rec_sum(bizdate, &daysum) != TX_OK) + daysum = 0; + + tx_commit(); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYSUM", daysum); + tx_log(TX_LOG_INFO, "[RC_OL_0017] 완료 key=%s 당일합계=%ld", key, daysum); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/rc_ol_0018.c b/app/online/rc_ol_0018.c new file mode 100644 index 0000000..d0f5a27 --- /dev/null +++ b/app/online/rc_ol_0018.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/rc_ol_0018.pgc" +/* @tier easy @module rc @transform reconciliation-online */ +/* + * rc_ol_0018.pgc - 대사 온라인 서비스 (RC_OL_0018) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 rc 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "rc_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/rc_ol_0018.pgc" + + +TX_SERVICE(RC_OL_0018, ctx) +{ + rc_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[RC_OL_0018] 대사 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[RC_OL_0018] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = rc_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[RC_OL_0018] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[RC_OL_0018] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/rc_ol_0018.pgc b/app/online/rc_ol_0018.pgc new file mode 100644 index 0000000..f6cff1a --- /dev/null +++ b/app/online/rc_ol_0018.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module rc @transform reconciliation-online */ +/* + * rc_ol_0018.pgc - 대사 온라인 서비스 (RC_OL_0018) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 rc 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "rc_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(RC_OL_0018, ctx) +{ + rc_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[RC_OL_0018] 대사 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[RC_OL_0018] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = rc_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[RC_OL_0018] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[RC_OL_0018] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/rc_ol_0019.c b/app/online/rc_ol_0019.c new file mode 100644 index 0000000..d17ea53 --- /dev/null +++ b/app/online/rc_ol_0019.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/rc_ol_0019.pgc" +/* @tier easy @module rc @transform reconciliation-online */ +/* + * rc_ol_0019.pgc - 대사 온라인 서비스 (RC_OL_0019) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 rc 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "rc_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/rc_ol_0019.pgc" + + +TX_SERVICE(RC_OL_0019, ctx) +{ + rc_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[RC_OL_0019] 대사 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[RC_OL_0019] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = rc_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[RC_OL_0019] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[RC_OL_0019] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/rc_ol_0019.pgc b/app/online/rc_ol_0019.pgc new file mode 100644 index 0000000..b0e37ea --- /dev/null +++ b/app/online/rc_ol_0019.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module rc @transform reconciliation-online */ +/* + * rc_ol_0019.pgc - 대사 온라인 서비스 (RC_OL_0019) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 rc 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "rc_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(RC_OL_0019, ctx) +{ + rc_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[RC_OL_0019] 대사 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[RC_OL_0019] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = rc_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[RC_OL_0019] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[RC_OL_0019] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/rc_ol_0020.c b/app/online/rc_ol_0020.c new file mode 100644 index 0000000..3f58455 --- /dev/null +++ b/app/online/rc_ol_0020.c @@ -0,0 +1,148 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/rc_ol_0020.pgc" +/* @tier medium @module rc @transform reconciliation-online */ +/* + * rc_ol_0020.pgc - 대사 온라인 서비스 (RC_OL_0020) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 rc 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "rc_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/rc_ol_0020.pgc" + + +TX_SERVICE(RC_OL_0020, ctx) +{ + rc_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[RC_OL_0020] 대사 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[RC_OL_0020] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[RC_OL_0020] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[RC_OL_0020] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, RC_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = rc_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[RC_OL_0020] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = rc_rec_count(bizdate, RC_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[RC_OL_0020] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/rc_ol_0020.pgc b/app/online/rc_ol_0020.pgc new file mode 100644 index 0000000..4bc93e2 --- /dev/null +++ b/app/online/rc_ol_0020.pgc @@ -0,0 +1,70 @@ +/* @tier medium @module rc @transform reconciliation-online */ +/* + * rc_ol_0020.pgc - 대사 온라인 서비스 (RC_OL_0020) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 rc 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "rc_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(RC_OL_0020, ctx) +{ + rc_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[RC_OL_0020] 대사 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[RC_OL_0020] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[RC_OL_0020] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[RC_OL_0020] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, RC_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = rc_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[RC_OL_0020] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = rc_rec_count(bizdate, RC_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[RC_OL_0020] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/rc_ol_0021.c b/app/online/rc_ol_0021.c new file mode 100644 index 0000000..159a942 --- /dev/null +++ b/app/online/rc_ol_0021.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/rc_ol_0021.pgc" +/* @tier easy @module rc @transform reconciliation-online */ +/* + * rc_ol_0021.pgc - 대사 온라인 서비스 (RC_OL_0021) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 rc 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "rc_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/rc_ol_0021.pgc" + + +TX_SERVICE(RC_OL_0021, ctx) +{ + rc_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[RC_OL_0021] 대사 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[RC_OL_0021] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = rc_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[RC_OL_0021] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[RC_OL_0021] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/rc_ol_0021.pgc b/app/online/rc_ol_0021.pgc new file mode 100644 index 0000000..680c013 --- /dev/null +++ b/app/online/rc_ol_0021.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module rc @transform reconciliation-online */ +/* + * rc_ol_0021.pgc - 대사 온라인 서비스 (RC_OL_0021) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 rc 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "rc_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(RC_OL_0021, ctx) +{ + rc_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[RC_OL_0021] 대사 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[RC_OL_0021] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = rc_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[RC_OL_0021] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[RC_OL_0021] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/rc_ol_0022.c b/app/online/rc_ol_0022.c new file mode 100644 index 0000000..6f896e6 --- /dev/null +++ b/app/online/rc_ol_0022.c @@ -0,0 +1,148 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/rc_ol_0022.pgc" +/* @tier medium @module rc @transform reconciliation-online */ +/* + * rc_ol_0022.pgc - 대사 온라인 서비스 (RC_OL_0022) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 rc 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "rc_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/rc_ol_0022.pgc" + + +TX_SERVICE(RC_OL_0022, ctx) +{ + rc_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[RC_OL_0022] 대사 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[RC_OL_0022] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[RC_OL_0022] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[RC_OL_0022] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, RC_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = rc_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[RC_OL_0022] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = rc_rec_count(bizdate, RC_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[RC_OL_0022] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/rc_ol_0022.pgc b/app/online/rc_ol_0022.pgc new file mode 100644 index 0000000..502d0b7 --- /dev/null +++ b/app/online/rc_ol_0022.pgc @@ -0,0 +1,70 @@ +/* @tier medium @module rc @transform reconciliation-online */ +/* + * rc_ol_0022.pgc - 대사 온라인 서비스 (RC_OL_0022) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 rc 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "rc_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(RC_OL_0022, ctx) +{ + rc_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[RC_OL_0022] 대사 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[RC_OL_0022] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[RC_OL_0022] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[RC_OL_0022] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, RC_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = rc_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[RC_OL_0022] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = rc_rec_count(bizdate, RC_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[RC_OL_0022] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/rc_ol_0023.c b/app/online/rc_ol_0023.c new file mode 100644 index 0000000..99a86c9 --- /dev/null +++ b/app/online/rc_ol_0023.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/rc_ol_0023.pgc" +/* @tier easy @module rc @transform reconciliation-online */ +/* + * rc_ol_0023.pgc - 대사 온라인 서비스 (RC_OL_0023) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 rc 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "rc_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/rc_ol_0023.pgc" + + +TX_SERVICE(RC_OL_0023, ctx) +{ + rc_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[RC_OL_0023] 대사 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[RC_OL_0023] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = rc_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[RC_OL_0023] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[RC_OL_0023] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/rc_ol_0023.pgc b/app/online/rc_ol_0023.pgc new file mode 100644 index 0000000..6d00a12 --- /dev/null +++ b/app/online/rc_ol_0023.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module rc @transform reconciliation-online */ +/* + * rc_ol_0023.pgc - 대사 온라인 서비스 (RC_OL_0023) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 rc 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "rc_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(RC_OL_0023, ctx) +{ + rc_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[RC_OL_0023] 대사 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[RC_OL_0023] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = rc_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[RC_OL_0023] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[RC_OL_0023] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/rc_ol_0024.c b/app/online/rc_ol_0024.c new file mode 100644 index 0000000..0dfaf5c --- /dev/null +++ b/app/online/rc_ol_0024.c @@ -0,0 +1,148 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/rc_ol_0024.pgc" +/* @tier medium @module rc @transform reconciliation-online */ +/* + * rc_ol_0024.pgc - 대사 온라인 서비스 (RC_OL_0024) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 rc 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "rc_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/rc_ol_0024.pgc" + + +TX_SERVICE(RC_OL_0024, ctx) +{ + rc_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[RC_OL_0024] 대사 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[RC_OL_0024] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[RC_OL_0024] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[RC_OL_0024] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, RC_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = rc_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[RC_OL_0024] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = rc_rec_count(bizdate, RC_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[RC_OL_0024] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/rc_ol_0024.pgc b/app/online/rc_ol_0024.pgc new file mode 100644 index 0000000..b7a31b6 --- /dev/null +++ b/app/online/rc_ol_0024.pgc @@ -0,0 +1,70 @@ +/* @tier medium @module rc @transform reconciliation-online */ +/* + * rc_ol_0024.pgc - 대사 온라인 서비스 (RC_OL_0024) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 rc 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "rc_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(RC_OL_0024, ctx) +{ + rc_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[RC_OL_0024] 대사 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[RC_OL_0024] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[RC_OL_0024] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[RC_OL_0024] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, RC_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = rc_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[RC_OL_0024] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = rc_rec_count(bizdate, RC_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[RC_OL_0024] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/rc_ol_0025.c b/app/online/rc_ol_0025.c new file mode 100644 index 0000000..e6df54c --- /dev/null +++ b/app/online/rc_ol_0025.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/rc_ol_0025.pgc" +/* @tier easy @module rc @transform reconciliation-online */ +/* + * rc_ol_0025.pgc - 대사 온라인 서비스 (RC_OL_0025) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 rc 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "rc_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/rc_ol_0025.pgc" + + +TX_SERVICE(RC_OL_0025, ctx) +{ + rc_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[RC_OL_0025] 대사 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[RC_OL_0025] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = rc_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[RC_OL_0025] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[RC_OL_0025] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/rc_ol_0025.pgc b/app/online/rc_ol_0025.pgc new file mode 100644 index 0000000..e579684 --- /dev/null +++ b/app/online/rc_ol_0025.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module rc @transform reconciliation-online */ +/* + * rc_ol_0025.pgc - 대사 온라인 서비스 (RC_OL_0025) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 rc 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "rc_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(RC_OL_0025, ctx) +{ + rc_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[RC_OL_0025] 대사 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[RC_OL_0025] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = rc_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[RC_OL_0025] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[RC_OL_0025] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/rc_ol_0026.c b/app/online/rc_ol_0026.c new file mode 100644 index 0000000..4fef5ea --- /dev/null +++ b/app/online/rc_ol_0026.c @@ -0,0 +1,176 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/rc_ol_0026.pgc" +/* @tier hard @module rc @transform reconciliation-online */ +/* + * rc_ol_0026.pgc - 대사 온라인 서비스 (RC_OL_0026) [tier=hard] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 rc 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "rc_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/rc_ol_0026.pgc" + + +TX_SERVICE(RC_OL_0026, ctx) +{ + rc_rec_t rec; + char key[16], merch[16], bizdate[16], nextbiz[9]; + long amount = 0, daysum = 0; + int rc; + TXBUF *sub_in; + TXBUF *sub_out; + + tx_log(TX_LOG_INFO, "[RC_OL_0026] 대사 트랜잭션 오케스트레이션 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[RC_OL_0026] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + if (!amount_is_valid(amount) || !date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[RC_OL_0026] 입력 검증 실패 amount=%ld date=%s", + amount, bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + /* 트랜잭션 시작 → 원장 반영 → 후속 서비스 연계 → 커밋 */ + if (tx_begin() != TX_OK) { + tx_return(ctx, TX_FAIL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, RC_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; + + rc = rc_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[RC_OL_0026] 원장반영 실패 rc=%d", rc); + tx_abort(); + tx_return(ctx, rc, ctx->out); + return; + } + + /* 정산 영업일 = 거래일의 다음 영업일 */ + if (date_next_business(bizdate, nextbiz) != 0) { + memcpy(nextbiz, bizdate, 8); + nextbiz[8] = '\0'; + } + + /* 후속 정산집계 서비스 연계 (레지스트리 문자열 디스패치) */ + sub_in = tx_buf_alloc(); + sub_out = tx_buf_alloc(); + if (sub_in && sub_out) { + tx_buf_sets(sub_in, "MERCHID", merch); + tx_buf_sets(sub_in, "BIZDATE", nextbiz); + tx_buf_setlong(sub_in, "AMOUNT", amount); + rc = tx_call("RC_POST", sub_in, sub_out); + if (rc != TX_OK) + tx_log(TX_LOG_WARN, "[RC_OL_0026] 후속연계 경고 rc=%d", rc); + } + tx_buf_free(sub_in); + tx_buf_free(sub_out); + + /* 교차 검증: 당일 합계 재계산 */ + if (rc_rec_sum(bizdate, &daysum) != TX_OK) + daysum = 0; + + tx_commit(); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYSUM", daysum); + tx_log(TX_LOG_INFO, "[RC_OL_0026] 완료 key=%s 당일합계=%ld", key, daysum); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/rc_ol_0026.pgc b/app/online/rc_ol_0026.pgc new file mode 100644 index 0000000..384998b --- /dev/null +++ b/app/online/rc_ol_0026.pgc @@ -0,0 +1,98 @@ +/* @tier hard @module rc @transform reconciliation-online */ +/* + * rc_ol_0026.pgc - 대사 온라인 서비스 (RC_OL_0026) [tier=hard] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 rc 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "rc_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(RC_OL_0026, ctx) +{ + rc_rec_t rec; + char key[16], merch[16], bizdate[16], nextbiz[9]; + long amount = 0, daysum = 0; + int rc; + TXBUF *sub_in; + TXBUF *sub_out; + + tx_log(TX_LOG_INFO, "[RC_OL_0026] 대사 트랜잭션 오케스트레이션 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[RC_OL_0026] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + if (!amount_is_valid(amount) || !date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[RC_OL_0026] 입력 검증 실패 amount=%ld date=%s", + amount, bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + /* 트랜잭션 시작 → 원장 반영 → 후속 서비스 연계 → 커밋 */ + if (tx_begin() != TX_OK) { + tx_return(ctx, TX_FAIL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, RC_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; + + rc = rc_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[RC_OL_0026] 원장반영 실패 rc=%d", rc); + tx_abort(); + tx_return(ctx, rc, ctx->out); + return; + } + + /* 정산 영업일 = 거래일의 다음 영업일 */ + if (date_next_business(bizdate, nextbiz) != 0) { + memcpy(nextbiz, bizdate, 8); + nextbiz[8] = '\0'; + } + + /* 후속 정산집계 서비스 연계 (레지스트리 문자열 디스패치) */ + sub_in = tx_buf_alloc(); + sub_out = tx_buf_alloc(); + if (sub_in && sub_out) { + tx_buf_sets(sub_in, "MERCHID", merch); + tx_buf_sets(sub_in, "BIZDATE", nextbiz); + tx_buf_setlong(sub_in, "AMOUNT", amount); + rc = tx_call("RC_POST", sub_in, sub_out); + if (rc != TX_OK) + tx_log(TX_LOG_WARN, "[RC_OL_0026] 후속연계 경고 rc=%d", rc); + } + tx_buf_free(sub_in); + tx_buf_free(sub_out); + + /* 교차 검증: 당일 합계 재계산 */ + if (rc_rec_sum(bizdate, &daysum) != TX_OK) + daysum = 0; + + tx_commit(); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYSUM", daysum); + tx_log(TX_LOG_INFO, "[RC_OL_0026] 완료 key=%s 당일합계=%ld", key, daysum); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/rc_ol_0027.c b/app/online/rc_ol_0027.c new file mode 100644 index 0000000..555c6fa --- /dev/null +++ b/app/online/rc_ol_0027.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/rc_ol_0027.pgc" +/* @tier easy @module rc @transform reconciliation-online */ +/* + * rc_ol_0027.pgc - 대사 온라인 서비스 (RC_OL_0027) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 rc 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "rc_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/rc_ol_0027.pgc" + + +TX_SERVICE(RC_OL_0027, ctx) +{ + rc_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[RC_OL_0027] 대사 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[RC_OL_0027] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = rc_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[RC_OL_0027] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[RC_OL_0027] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/rc_ol_0027.pgc b/app/online/rc_ol_0027.pgc new file mode 100644 index 0000000..b48f969 --- /dev/null +++ b/app/online/rc_ol_0027.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module rc @transform reconciliation-online */ +/* + * rc_ol_0027.pgc - 대사 온라인 서비스 (RC_OL_0027) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 rc 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "rc_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(RC_OL_0027, ctx) +{ + rc_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[RC_OL_0027] 대사 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[RC_OL_0027] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = rc_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[RC_OL_0027] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[RC_OL_0027] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/rc_ol_0028.c b/app/online/rc_ol_0028.c new file mode 100644 index 0000000..4782c1f --- /dev/null +++ b/app/online/rc_ol_0028.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/rc_ol_0028.pgc" +/* @tier easy @module rc @transform reconciliation-online */ +/* + * rc_ol_0028.pgc - 대사 온라인 서비스 (RC_OL_0028) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 rc 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "rc_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/rc_ol_0028.pgc" + + +TX_SERVICE(RC_OL_0028, ctx) +{ + rc_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[RC_OL_0028] 대사 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[RC_OL_0028] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = rc_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[RC_OL_0028] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[RC_OL_0028] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/rc_ol_0028.pgc b/app/online/rc_ol_0028.pgc new file mode 100644 index 0000000..4ef4206 --- /dev/null +++ b/app/online/rc_ol_0028.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module rc @transform reconciliation-online */ +/* + * rc_ol_0028.pgc - 대사 온라인 서비스 (RC_OL_0028) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 rc 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "rc_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(RC_OL_0028, ctx) +{ + rc_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[RC_OL_0028] 대사 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[RC_OL_0028] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = rc_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[RC_OL_0028] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[RC_OL_0028] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/rc_ol_0029.c b/app/online/rc_ol_0029.c new file mode 100644 index 0000000..2473fe9 --- /dev/null +++ b/app/online/rc_ol_0029.c @@ -0,0 +1,148 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/rc_ol_0029.pgc" +/* @tier medium @module rc @transform reconciliation-online */ +/* + * rc_ol_0029.pgc - 대사 온라인 서비스 (RC_OL_0029) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 rc 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "rc_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/rc_ol_0029.pgc" + + +TX_SERVICE(RC_OL_0029, ctx) +{ + rc_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[RC_OL_0029] 대사 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[RC_OL_0029] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[RC_OL_0029] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[RC_OL_0029] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, RC_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = rc_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[RC_OL_0029] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = rc_rec_count(bizdate, RC_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[RC_OL_0029] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/rc_ol_0029.pgc b/app/online/rc_ol_0029.pgc new file mode 100644 index 0000000..3f82d9d --- /dev/null +++ b/app/online/rc_ol_0029.pgc @@ -0,0 +1,70 @@ +/* @tier medium @module rc @transform reconciliation-online */ +/* + * rc_ol_0029.pgc - 대사 온라인 서비스 (RC_OL_0029) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 rc 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "rc_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(RC_OL_0029, ctx) +{ + rc_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[RC_OL_0029] 대사 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[RC_OL_0029] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[RC_OL_0029] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[RC_OL_0029] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, RC_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = rc_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[RC_OL_0029] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = rc_rec_count(bizdate, RC_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[RC_OL_0029] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/rc_ol_0030.c b/app/online/rc_ol_0030.c new file mode 100644 index 0000000..b69ab54 --- /dev/null +++ b/app/online/rc_ol_0030.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/rc_ol_0030.pgc" +/* @tier easy @module rc @transform reconciliation-online */ +/* + * rc_ol_0030.pgc - 대사 온라인 서비스 (RC_OL_0030) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 rc 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "rc_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/rc_ol_0030.pgc" + + +TX_SERVICE(RC_OL_0030, ctx) +{ + rc_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[RC_OL_0030] 대사 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[RC_OL_0030] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = rc_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[RC_OL_0030] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[RC_OL_0030] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/rc_ol_0030.pgc b/app/online/rc_ol_0030.pgc new file mode 100644 index 0000000..9daf2b9 --- /dev/null +++ b/app/online/rc_ol_0030.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module rc @transform reconciliation-online */ +/* + * rc_ol_0030.pgc - 대사 온라인 서비스 (RC_OL_0030) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 rc 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "rc_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(RC_OL_0030, ctx) +{ + rc_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[RC_OL_0030] 대사 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[RC_OL_0030] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = rc_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[RC_OL_0030] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[RC_OL_0030] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/rc_ol_0031.c b/app/online/rc_ol_0031.c new file mode 100644 index 0000000..194f90f --- /dev/null +++ b/app/online/rc_ol_0031.c @@ -0,0 +1,148 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/rc_ol_0031.pgc" +/* @tier medium @module rc @transform reconciliation-online */ +/* + * rc_ol_0031.pgc - 대사 온라인 서비스 (RC_OL_0031) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 rc 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "rc_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/rc_ol_0031.pgc" + + +TX_SERVICE(RC_OL_0031, ctx) +{ + rc_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[RC_OL_0031] 대사 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[RC_OL_0031] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[RC_OL_0031] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[RC_OL_0031] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, RC_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = rc_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[RC_OL_0031] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = rc_rec_count(bizdate, RC_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[RC_OL_0031] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/rc_ol_0031.pgc b/app/online/rc_ol_0031.pgc new file mode 100644 index 0000000..2be47fa --- /dev/null +++ b/app/online/rc_ol_0031.pgc @@ -0,0 +1,70 @@ +/* @tier medium @module rc @transform reconciliation-online */ +/* + * rc_ol_0031.pgc - 대사 온라인 서비스 (RC_OL_0031) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 rc 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "rc_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(RC_OL_0031, ctx) +{ + rc_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[RC_OL_0031] 대사 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[RC_OL_0031] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[RC_OL_0031] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[RC_OL_0031] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, RC_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = rc_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[RC_OL_0031] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = rc_rec_count(bizdate, RC_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[RC_OL_0031] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/rc_ol_0032.c b/app/online/rc_ol_0032.c new file mode 100644 index 0000000..4d98079 --- /dev/null +++ b/app/online/rc_ol_0032.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/rc_ol_0032.pgc" +/* @tier easy @module rc @transform reconciliation-online */ +/* + * rc_ol_0032.pgc - 대사 온라인 서비스 (RC_OL_0032) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 rc 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "rc_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/rc_ol_0032.pgc" + + +TX_SERVICE(RC_OL_0032, ctx) +{ + rc_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[RC_OL_0032] 대사 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[RC_OL_0032] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = rc_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[RC_OL_0032] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[RC_OL_0032] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/rc_ol_0032.pgc b/app/online/rc_ol_0032.pgc new file mode 100644 index 0000000..c7e366a --- /dev/null +++ b/app/online/rc_ol_0032.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module rc @transform reconciliation-online */ +/* + * rc_ol_0032.pgc - 대사 온라인 서비스 (RC_OL_0032) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 rc 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "rc_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(RC_OL_0032, ctx) +{ + rc_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[RC_OL_0032] 대사 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[RC_OL_0032] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = rc_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[RC_OL_0032] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[RC_OL_0032] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/st_ol_0001.c b/app/online/st_ol_0001.c new file mode 100644 index 0000000..931c556 --- /dev/null +++ b/app/online/st_ol_0001.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/st_ol_0001.pgc" +/* @tier easy @module st @transform settlement-online */ +/* + * st_ol_0001.pgc - 정산수수료 온라인 서비스 (ST_OL_0001) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 st 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "st_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/st_ol_0001.pgc" + + +TX_SERVICE(ST_OL_0001, ctx) +{ + st_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[ST_OL_0001] 정산수수료 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[ST_OL_0001] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = st_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[ST_OL_0001] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[ST_OL_0001] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/st_ol_0001.pgc b/app/online/st_ol_0001.pgc new file mode 100644 index 0000000..c5cf283 --- /dev/null +++ b/app/online/st_ol_0001.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module st @transform settlement-online */ +/* + * st_ol_0001.pgc - 정산수수료 온라인 서비스 (ST_OL_0001) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 st 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "st_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(ST_OL_0001, ctx) +{ + st_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[ST_OL_0001] 정산수수료 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[ST_OL_0001] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = st_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[ST_OL_0001] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[ST_OL_0001] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/st_ol_0002.c b/app/online/st_ol_0002.c new file mode 100644 index 0000000..ab00cb0 --- /dev/null +++ b/app/online/st_ol_0002.c @@ -0,0 +1,148 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/st_ol_0002.pgc" +/* @tier medium @module st @transform settlement-online */ +/* + * st_ol_0002.pgc - 정산수수료 온라인 서비스 (ST_OL_0002) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 st 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "st_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/st_ol_0002.pgc" + + +TX_SERVICE(ST_OL_0002, ctx) +{ + st_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[ST_OL_0002] 정산수수료 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[ST_OL_0002] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[ST_OL_0002] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[ST_OL_0002] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, ST_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = st_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[ST_OL_0002] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = st_rec_count(bizdate, ST_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[ST_OL_0002] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/st_ol_0002.pgc b/app/online/st_ol_0002.pgc new file mode 100644 index 0000000..42b5058 --- /dev/null +++ b/app/online/st_ol_0002.pgc @@ -0,0 +1,70 @@ +/* @tier medium @module st @transform settlement-online */ +/* + * st_ol_0002.pgc - 정산수수료 온라인 서비스 (ST_OL_0002) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 st 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "st_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(ST_OL_0002, ctx) +{ + st_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[ST_OL_0002] 정산수수료 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[ST_OL_0002] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[ST_OL_0002] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[ST_OL_0002] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, ST_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = st_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[ST_OL_0002] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = st_rec_count(bizdate, ST_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[ST_OL_0002] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/st_ol_0003.c b/app/online/st_ol_0003.c new file mode 100644 index 0000000..102531f --- /dev/null +++ b/app/online/st_ol_0003.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/st_ol_0003.pgc" +/* @tier easy @module st @transform settlement-online */ +/* + * st_ol_0003.pgc - 정산수수료 온라인 서비스 (ST_OL_0003) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 st 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "st_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/st_ol_0003.pgc" + + +TX_SERVICE(ST_OL_0003, ctx) +{ + st_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[ST_OL_0003] 정산수수료 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[ST_OL_0003] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = st_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[ST_OL_0003] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[ST_OL_0003] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/st_ol_0003.pgc b/app/online/st_ol_0003.pgc new file mode 100644 index 0000000..af86c0d --- /dev/null +++ b/app/online/st_ol_0003.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module st @transform settlement-online */ +/* + * st_ol_0003.pgc - 정산수수료 온라인 서비스 (ST_OL_0003) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 st 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "st_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(ST_OL_0003, ctx) +{ + st_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[ST_OL_0003] 정산수수료 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[ST_OL_0003] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = st_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[ST_OL_0003] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[ST_OL_0003] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/st_ol_0004.c b/app/online/st_ol_0004.c new file mode 100644 index 0000000..fb7a283 --- /dev/null +++ b/app/online/st_ol_0004.c @@ -0,0 +1,176 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/st_ol_0004.pgc" +/* @tier hard @module st @transform settlement-online */ +/* + * st_ol_0004.pgc - 정산수수료 온라인 서비스 (ST_OL_0004) [tier=hard] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 st 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "st_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/st_ol_0004.pgc" + + +TX_SERVICE(ST_OL_0004, ctx) +{ + st_rec_t rec; + char key[16], merch[16], bizdate[16], nextbiz[9]; + long amount = 0, daysum = 0; + int rc; + TXBUF *sub_in; + TXBUF *sub_out; + + tx_log(TX_LOG_INFO, "[ST_OL_0004] 정산수수료 트랜잭션 오케스트레이션 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[ST_OL_0004] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + if (!amount_is_valid(amount) || !date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[ST_OL_0004] 입력 검증 실패 amount=%ld date=%s", + amount, bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + /* 트랜잭션 시작 → 원장 반영 → 후속 서비스 연계 → 커밋 */ + if (tx_begin() != TX_OK) { + tx_return(ctx, TX_FAIL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, ST_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; + + rc = st_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[ST_OL_0004] 원장반영 실패 rc=%d", rc); + tx_abort(); + tx_return(ctx, rc, ctx->out); + return; + } + + /* 정산 영업일 = 거래일의 다음 영업일 */ + if (date_next_business(bizdate, nextbiz) != 0) { + memcpy(nextbiz, bizdate, 8); + nextbiz[8] = '\0'; + } + + /* 후속 정산집계 서비스 연계 (레지스트리 문자열 디스패치) */ + sub_in = tx_buf_alloc(); + sub_out = tx_buf_alloc(); + if (sub_in && sub_out) { + tx_buf_sets(sub_in, "MERCHID", merch); + tx_buf_sets(sub_in, "BIZDATE", nextbiz); + tx_buf_setlong(sub_in, "AMOUNT", amount); + rc = tx_call("ST_POST", sub_in, sub_out); + if (rc != TX_OK) + tx_log(TX_LOG_WARN, "[ST_OL_0004] 후속연계 경고 rc=%d", rc); + } + tx_buf_free(sub_in); + tx_buf_free(sub_out); + + /* 교차 검증: 당일 합계 재계산 */ + if (st_rec_sum(bizdate, &daysum) != TX_OK) + daysum = 0; + + tx_commit(); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYSUM", daysum); + tx_log(TX_LOG_INFO, "[ST_OL_0004] 완료 key=%s 당일합계=%ld", key, daysum); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/st_ol_0004.pgc b/app/online/st_ol_0004.pgc new file mode 100644 index 0000000..7bff7dd --- /dev/null +++ b/app/online/st_ol_0004.pgc @@ -0,0 +1,98 @@ +/* @tier hard @module st @transform settlement-online */ +/* + * st_ol_0004.pgc - 정산수수료 온라인 서비스 (ST_OL_0004) [tier=hard] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 st 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "st_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(ST_OL_0004, ctx) +{ + st_rec_t rec; + char key[16], merch[16], bizdate[16], nextbiz[9]; + long amount = 0, daysum = 0; + int rc; + TXBUF *sub_in; + TXBUF *sub_out; + + tx_log(TX_LOG_INFO, "[ST_OL_0004] 정산수수료 트랜잭션 오케스트레이션 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[ST_OL_0004] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + if (!amount_is_valid(amount) || !date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[ST_OL_0004] 입력 검증 실패 amount=%ld date=%s", + amount, bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + /* 트랜잭션 시작 → 원장 반영 → 후속 서비스 연계 → 커밋 */ + if (tx_begin() != TX_OK) { + tx_return(ctx, TX_FAIL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, ST_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; + + rc = st_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[ST_OL_0004] 원장반영 실패 rc=%d", rc); + tx_abort(); + tx_return(ctx, rc, ctx->out); + return; + } + + /* 정산 영업일 = 거래일의 다음 영업일 */ + if (date_next_business(bizdate, nextbiz) != 0) { + memcpy(nextbiz, bizdate, 8); + nextbiz[8] = '\0'; + } + + /* 후속 정산집계 서비스 연계 (레지스트리 문자열 디스패치) */ + sub_in = tx_buf_alloc(); + sub_out = tx_buf_alloc(); + if (sub_in && sub_out) { + tx_buf_sets(sub_in, "MERCHID", merch); + tx_buf_sets(sub_in, "BIZDATE", nextbiz); + tx_buf_setlong(sub_in, "AMOUNT", amount); + rc = tx_call("ST_POST", sub_in, sub_out); + if (rc != TX_OK) + tx_log(TX_LOG_WARN, "[ST_OL_0004] 후속연계 경고 rc=%d", rc); + } + tx_buf_free(sub_in); + tx_buf_free(sub_out); + + /* 교차 검증: 당일 합계 재계산 */ + if (st_rec_sum(bizdate, &daysum) != TX_OK) + daysum = 0; + + tx_commit(); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYSUM", daysum); + tx_log(TX_LOG_INFO, "[ST_OL_0004] 완료 key=%s 당일합계=%ld", key, daysum); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/st_ol_0005.c b/app/online/st_ol_0005.c new file mode 100644 index 0000000..7cfd6fb --- /dev/null +++ b/app/online/st_ol_0005.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/st_ol_0005.pgc" +/* @tier easy @module st @transform settlement-online */ +/* + * st_ol_0005.pgc - 정산수수료 온라인 서비스 (ST_OL_0005) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 st 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "st_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/st_ol_0005.pgc" + + +TX_SERVICE(ST_OL_0005, ctx) +{ + st_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[ST_OL_0005] 정산수수료 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[ST_OL_0005] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = st_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[ST_OL_0005] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[ST_OL_0005] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/st_ol_0005.pgc b/app/online/st_ol_0005.pgc new file mode 100644 index 0000000..795ad5f --- /dev/null +++ b/app/online/st_ol_0005.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module st @transform settlement-online */ +/* + * st_ol_0005.pgc - 정산수수료 온라인 서비스 (ST_OL_0005) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 st 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "st_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(ST_OL_0005, ctx) +{ + st_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[ST_OL_0005] 정산수수료 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[ST_OL_0005] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = st_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[ST_OL_0005] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[ST_OL_0005] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/st_ol_0006.c b/app/online/st_ol_0006.c new file mode 100644 index 0000000..e1582f7 --- /dev/null +++ b/app/online/st_ol_0006.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/st_ol_0006.pgc" +/* @tier easy @module st @transform settlement-online */ +/* + * st_ol_0006.pgc - 정산수수료 온라인 서비스 (ST_OL_0006) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 st 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "st_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/st_ol_0006.pgc" + + +TX_SERVICE(ST_OL_0006, ctx) +{ + st_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[ST_OL_0006] 정산수수료 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[ST_OL_0006] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = st_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[ST_OL_0006] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[ST_OL_0006] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/st_ol_0006.pgc b/app/online/st_ol_0006.pgc new file mode 100644 index 0000000..120574b --- /dev/null +++ b/app/online/st_ol_0006.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module st @transform settlement-online */ +/* + * st_ol_0006.pgc - 정산수수료 온라인 서비스 (ST_OL_0006) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 st 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "st_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(ST_OL_0006, ctx) +{ + st_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[ST_OL_0006] 정산수수료 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[ST_OL_0006] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = st_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[ST_OL_0006] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[ST_OL_0006] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/st_ol_0007.c b/app/online/st_ol_0007.c new file mode 100644 index 0000000..df345f7 --- /dev/null +++ b/app/online/st_ol_0007.c @@ -0,0 +1,148 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/st_ol_0007.pgc" +/* @tier medium @module st @transform settlement-online */ +/* + * st_ol_0007.pgc - 정산수수료 온라인 서비스 (ST_OL_0007) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 st 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "st_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/st_ol_0007.pgc" + + +TX_SERVICE(ST_OL_0007, ctx) +{ + st_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[ST_OL_0007] 정산수수료 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[ST_OL_0007] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[ST_OL_0007] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[ST_OL_0007] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, ST_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = st_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[ST_OL_0007] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = st_rec_count(bizdate, ST_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[ST_OL_0007] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/st_ol_0007.pgc b/app/online/st_ol_0007.pgc new file mode 100644 index 0000000..020b88c --- /dev/null +++ b/app/online/st_ol_0007.pgc @@ -0,0 +1,70 @@ +/* @tier medium @module st @transform settlement-online */ +/* + * st_ol_0007.pgc - 정산수수료 온라인 서비스 (ST_OL_0007) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 st 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "st_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(ST_OL_0007, ctx) +{ + st_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[ST_OL_0007] 정산수수료 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[ST_OL_0007] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[ST_OL_0007] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[ST_OL_0007] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, ST_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = st_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[ST_OL_0007] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = st_rec_count(bizdate, ST_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[ST_OL_0007] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/st_ol_0008.c b/app/online/st_ol_0008.c new file mode 100644 index 0000000..e34fb53 --- /dev/null +++ b/app/online/st_ol_0008.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/st_ol_0008.pgc" +/* @tier easy @module st @transform settlement-online */ +/* + * st_ol_0008.pgc - 정산수수료 온라인 서비스 (ST_OL_0008) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 st 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "st_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/st_ol_0008.pgc" + + +TX_SERVICE(ST_OL_0008, ctx) +{ + st_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[ST_OL_0008] 정산수수료 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[ST_OL_0008] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = st_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[ST_OL_0008] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[ST_OL_0008] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/st_ol_0008.pgc b/app/online/st_ol_0008.pgc new file mode 100644 index 0000000..7fde71f --- /dev/null +++ b/app/online/st_ol_0008.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module st @transform settlement-online */ +/* + * st_ol_0008.pgc - 정산수수료 온라인 서비스 (ST_OL_0008) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 st 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "st_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(ST_OL_0008, ctx) +{ + st_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[ST_OL_0008] 정산수수료 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[ST_OL_0008] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = st_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[ST_OL_0008] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[ST_OL_0008] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/st_ol_0009.c b/app/online/st_ol_0009.c new file mode 100644 index 0000000..c7ad37f --- /dev/null +++ b/app/online/st_ol_0009.c @@ -0,0 +1,148 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/st_ol_0009.pgc" +/* @tier medium @module st @transform settlement-online */ +/* + * st_ol_0009.pgc - 정산수수료 온라인 서비스 (ST_OL_0009) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 st 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "st_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/st_ol_0009.pgc" + + +TX_SERVICE(ST_OL_0009, ctx) +{ + st_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[ST_OL_0009] 정산수수료 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[ST_OL_0009] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[ST_OL_0009] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[ST_OL_0009] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, ST_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = st_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[ST_OL_0009] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = st_rec_count(bizdate, ST_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[ST_OL_0009] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/st_ol_0009.pgc b/app/online/st_ol_0009.pgc new file mode 100644 index 0000000..03eed82 --- /dev/null +++ b/app/online/st_ol_0009.pgc @@ -0,0 +1,70 @@ +/* @tier medium @module st @transform settlement-online */ +/* + * st_ol_0009.pgc - 정산수수료 온라인 서비스 (ST_OL_0009) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 st 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "st_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(ST_OL_0009, ctx) +{ + st_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[ST_OL_0009] 정산수수료 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[ST_OL_0009] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[ST_OL_0009] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[ST_OL_0009] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, ST_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = st_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[ST_OL_0009] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = st_rec_count(bizdate, ST_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[ST_OL_0009] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/st_ol_0010.c b/app/online/st_ol_0010.c new file mode 100644 index 0000000..b3ad1f1 --- /dev/null +++ b/app/online/st_ol_0010.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/st_ol_0010.pgc" +/* @tier easy @module st @transform settlement-online */ +/* + * st_ol_0010.pgc - 정산수수료 온라인 서비스 (ST_OL_0010) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 st 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "st_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/st_ol_0010.pgc" + + +TX_SERVICE(ST_OL_0010, ctx) +{ + st_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[ST_OL_0010] 정산수수료 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[ST_OL_0010] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = st_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[ST_OL_0010] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[ST_OL_0010] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/st_ol_0010.pgc b/app/online/st_ol_0010.pgc new file mode 100644 index 0000000..0897f0e --- /dev/null +++ b/app/online/st_ol_0010.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module st @transform settlement-online */ +/* + * st_ol_0010.pgc - 정산수수료 온라인 서비스 (ST_OL_0010) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 st 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "st_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(ST_OL_0010, ctx) +{ + st_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[ST_OL_0010] 정산수수료 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[ST_OL_0010] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = st_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[ST_OL_0010] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[ST_OL_0010] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/st_ol_0011.c b/app/online/st_ol_0011.c new file mode 100644 index 0000000..ddb3732 --- /dev/null +++ b/app/online/st_ol_0011.c @@ -0,0 +1,148 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/st_ol_0011.pgc" +/* @tier medium @module st @transform settlement-online */ +/* + * st_ol_0011.pgc - 정산수수료 온라인 서비스 (ST_OL_0011) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 st 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "st_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/st_ol_0011.pgc" + + +TX_SERVICE(ST_OL_0011, ctx) +{ + st_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[ST_OL_0011] 정산수수료 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[ST_OL_0011] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[ST_OL_0011] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[ST_OL_0011] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, ST_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = st_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[ST_OL_0011] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = st_rec_count(bizdate, ST_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[ST_OL_0011] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/st_ol_0011.pgc b/app/online/st_ol_0011.pgc new file mode 100644 index 0000000..174919f --- /dev/null +++ b/app/online/st_ol_0011.pgc @@ -0,0 +1,70 @@ +/* @tier medium @module st @transform settlement-online */ +/* + * st_ol_0011.pgc - 정산수수료 온라인 서비스 (ST_OL_0011) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 st 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "st_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(ST_OL_0011, ctx) +{ + st_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[ST_OL_0011] 정산수수료 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[ST_OL_0011] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[ST_OL_0011] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[ST_OL_0011] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, ST_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = st_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[ST_OL_0011] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = st_rec_count(bizdate, ST_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[ST_OL_0011] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/st_ol_0012.c b/app/online/st_ol_0012.c new file mode 100644 index 0000000..6aecec0 --- /dev/null +++ b/app/online/st_ol_0012.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/st_ol_0012.pgc" +/* @tier easy @module st @transform settlement-online */ +/* + * st_ol_0012.pgc - 정산수수료 온라인 서비스 (ST_OL_0012) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 st 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "st_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/st_ol_0012.pgc" + + +TX_SERVICE(ST_OL_0012, ctx) +{ + st_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[ST_OL_0012] 정산수수료 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[ST_OL_0012] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = st_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[ST_OL_0012] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[ST_OL_0012] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/st_ol_0012.pgc b/app/online/st_ol_0012.pgc new file mode 100644 index 0000000..986e0ce --- /dev/null +++ b/app/online/st_ol_0012.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module st @transform settlement-online */ +/* + * st_ol_0012.pgc - 정산수수료 온라인 서비스 (ST_OL_0012) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 st 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "st_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(ST_OL_0012, ctx) +{ + st_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[ST_OL_0012] 정산수수료 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[ST_OL_0012] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = st_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[ST_OL_0012] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[ST_OL_0012] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/st_ol_0013.c b/app/online/st_ol_0013.c new file mode 100644 index 0000000..f619637 --- /dev/null +++ b/app/online/st_ol_0013.c @@ -0,0 +1,176 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/st_ol_0013.pgc" +/* @tier hard @module st @transform settlement-online */ +/* + * st_ol_0013.pgc - 정산수수료 온라인 서비스 (ST_OL_0013) [tier=hard] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 st 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "st_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/st_ol_0013.pgc" + + +TX_SERVICE(ST_OL_0013, ctx) +{ + st_rec_t rec; + char key[16], merch[16], bizdate[16], nextbiz[9]; + long amount = 0, daysum = 0; + int rc; + TXBUF *sub_in; + TXBUF *sub_out; + + tx_log(TX_LOG_INFO, "[ST_OL_0013] 정산수수료 트랜잭션 오케스트레이션 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[ST_OL_0013] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + if (!amount_is_valid(amount) || !date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[ST_OL_0013] 입력 검증 실패 amount=%ld date=%s", + amount, bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + /* 트랜잭션 시작 → 원장 반영 → 후속 서비스 연계 → 커밋 */ + if (tx_begin() != TX_OK) { + tx_return(ctx, TX_FAIL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, ST_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; + + rc = st_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[ST_OL_0013] 원장반영 실패 rc=%d", rc); + tx_abort(); + tx_return(ctx, rc, ctx->out); + return; + } + + /* 정산 영업일 = 거래일의 다음 영업일 */ + if (date_next_business(bizdate, nextbiz) != 0) { + memcpy(nextbiz, bizdate, 8); + nextbiz[8] = '\0'; + } + + /* 후속 정산집계 서비스 연계 (레지스트리 문자열 디스패치) */ + sub_in = tx_buf_alloc(); + sub_out = tx_buf_alloc(); + if (sub_in && sub_out) { + tx_buf_sets(sub_in, "MERCHID", merch); + tx_buf_sets(sub_in, "BIZDATE", nextbiz); + tx_buf_setlong(sub_in, "AMOUNT", amount); + rc = tx_call("ST_POST", sub_in, sub_out); + if (rc != TX_OK) + tx_log(TX_LOG_WARN, "[ST_OL_0013] 후속연계 경고 rc=%d", rc); + } + tx_buf_free(sub_in); + tx_buf_free(sub_out); + + /* 교차 검증: 당일 합계 재계산 */ + if (st_rec_sum(bizdate, &daysum) != TX_OK) + daysum = 0; + + tx_commit(); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYSUM", daysum); + tx_log(TX_LOG_INFO, "[ST_OL_0013] 완료 key=%s 당일합계=%ld", key, daysum); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/st_ol_0013.pgc b/app/online/st_ol_0013.pgc new file mode 100644 index 0000000..9fc6884 --- /dev/null +++ b/app/online/st_ol_0013.pgc @@ -0,0 +1,98 @@ +/* @tier hard @module st @transform settlement-online */ +/* + * st_ol_0013.pgc - 정산수수료 온라인 서비스 (ST_OL_0013) [tier=hard] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 st 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "st_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(ST_OL_0013, ctx) +{ + st_rec_t rec; + char key[16], merch[16], bizdate[16], nextbiz[9]; + long amount = 0, daysum = 0; + int rc; + TXBUF *sub_in; + TXBUF *sub_out; + + tx_log(TX_LOG_INFO, "[ST_OL_0013] 정산수수료 트랜잭션 오케스트레이션 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[ST_OL_0013] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + if (!amount_is_valid(amount) || !date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[ST_OL_0013] 입력 검증 실패 amount=%ld date=%s", + amount, bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + /* 트랜잭션 시작 → 원장 반영 → 후속 서비스 연계 → 커밋 */ + if (tx_begin() != TX_OK) { + tx_return(ctx, TX_FAIL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, ST_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; + + rc = st_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[ST_OL_0013] 원장반영 실패 rc=%d", rc); + tx_abort(); + tx_return(ctx, rc, ctx->out); + return; + } + + /* 정산 영업일 = 거래일의 다음 영업일 */ + if (date_next_business(bizdate, nextbiz) != 0) { + memcpy(nextbiz, bizdate, 8); + nextbiz[8] = '\0'; + } + + /* 후속 정산집계 서비스 연계 (레지스트리 문자열 디스패치) */ + sub_in = tx_buf_alloc(); + sub_out = tx_buf_alloc(); + if (sub_in && sub_out) { + tx_buf_sets(sub_in, "MERCHID", merch); + tx_buf_sets(sub_in, "BIZDATE", nextbiz); + tx_buf_setlong(sub_in, "AMOUNT", amount); + rc = tx_call("ST_POST", sub_in, sub_out); + if (rc != TX_OK) + tx_log(TX_LOG_WARN, "[ST_OL_0013] 후속연계 경고 rc=%d", rc); + } + tx_buf_free(sub_in); + tx_buf_free(sub_out); + + /* 교차 검증: 당일 합계 재계산 */ + if (st_rec_sum(bizdate, &daysum) != TX_OK) + daysum = 0; + + tx_commit(); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYSUM", daysum); + tx_log(TX_LOG_INFO, "[ST_OL_0013] 완료 key=%s 당일합계=%ld", key, daysum); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/st_ol_0014.c b/app/online/st_ol_0014.c new file mode 100644 index 0000000..4d38bfb --- /dev/null +++ b/app/online/st_ol_0014.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/st_ol_0014.pgc" +/* @tier easy @module st @transform settlement-online */ +/* + * st_ol_0014.pgc - 정산수수료 온라인 서비스 (ST_OL_0014) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 st 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "st_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/st_ol_0014.pgc" + + +TX_SERVICE(ST_OL_0014, ctx) +{ + st_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[ST_OL_0014] 정산수수료 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[ST_OL_0014] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = st_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[ST_OL_0014] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[ST_OL_0014] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/st_ol_0014.pgc b/app/online/st_ol_0014.pgc new file mode 100644 index 0000000..bc1d9f1 --- /dev/null +++ b/app/online/st_ol_0014.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module st @transform settlement-online */ +/* + * st_ol_0014.pgc - 정산수수료 온라인 서비스 (ST_OL_0014) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 st 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "st_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(ST_OL_0014, ctx) +{ + st_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[ST_OL_0014] 정산수수료 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[ST_OL_0014] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = st_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[ST_OL_0014] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[ST_OL_0014] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/st_ol_0015.c b/app/online/st_ol_0015.c new file mode 100644 index 0000000..ff66341 --- /dev/null +++ b/app/online/st_ol_0015.c @@ -0,0 +1,176 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/st_ol_0015.pgc" +/* @tier hard @module st @transform settlement-online */ +/* + * st_ol_0015.pgc - 정산수수료 온라인 서비스 (ST_OL_0015) [tier=hard] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 st 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "st_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/st_ol_0015.pgc" + + +TX_SERVICE(ST_OL_0015, ctx) +{ + st_rec_t rec; + char key[16], merch[16], bizdate[16], nextbiz[9]; + long amount = 0, daysum = 0; + int rc; + TXBUF *sub_in; + TXBUF *sub_out; + + tx_log(TX_LOG_INFO, "[ST_OL_0015] 정산수수료 트랜잭션 오케스트레이션 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[ST_OL_0015] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + if (!amount_is_valid(amount) || !date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[ST_OL_0015] 입력 검증 실패 amount=%ld date=%s", + amount, bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + /* 트랜잭션 시작 → 원장 반영 → 후속 서비스 연계 → 커밋 */ + if (tx_begin() != TX_OK) { + tx_return(ctx, TX_FAIL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, ST_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; + + rc = st_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[ST_OL_0015] 원장반영 실패 rc=%d", rc); + tx_abort(); + tx_return(ctx, rc, ctx->out); + return; + } + + /* 정산 영업일 = 거래일의 다음 영업일 */ + if (date_next_business(bizdate, nextbiz) != 0) { + memcpy(nextbiz, bizdate, 8); + nextbiz[8] = '\0'; + } + + /* 후속 정산집계 서비스 연계 (레지스트리 문자열 디스패치) */ + sub_in = tx_buf_alloc(); + sub_out = tx_buf_alloc(); + if (sub_in && sub_out) { + tx_buf_sets(sub_in, "MERCHID", merch); + tx_buf_sets(sub_in, "BIZDATE", nextbiz); + tx_buf_setlong(sub_in, "AMOUNT", amount); + rc = tx_call("ST_POST", sub_in, sub_out); + if (rc != TX_OK) + tx_log(TX_LOG_WARN, "[ST_OL_0015] 후속연계 경고 rc=%d", rc); + } + tx_buf_free(sub_in); + tx_buf_free(sub_out); + + /* 교차 검증: 당일 합계 재계산 */ + if (st_rec_sum(bizdate, &daysum) != TX_OK) + daysum = 0; + + tx_commit(); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYSUM", daysum); + tx_log(TX_LOG_INFO, "[ST_OL_0015] 완료 key=%s 당일합계=%ld", key, daysum); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/st_ol_0015.pgc b/app/online/st_ol_0015.pgc new file mode 100644 index 0000000..2b57c3c --- /dev/null +++ b/app/online/st_ol_0015.pgc @@ -0,0 +1,98 @@ +/* @tier hard @module st @transform settlement-online */ +/* + * st_ol_0015.pgc - 정산수수료 온라인 서비스 (ST_OL_0015) [tier=hard] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 st 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "st_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(ST_OL_0015, ctx) +{ + st_rec_t rec; + char key[16], merch[16], bizdate[16], nextbiz[9]; + long amount = 0, daysum = 0; + int rc; + TXBUF *sub_in; + TXBUF *sub_out; + + tx_log(TX_LOG_INFO, "[ST_OL_0015] 정산수수료 트랜잭션 오케스트레이션 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[ST_OL_0015] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + if (!amount_is_valid(amount) || !date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[ST_OL_0015] 입력 검증 실패 amount=%ld date=%s", + amount, bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + /* 트랜잭션 시작 → 원장 반영 → 후속 서비스 연계 → 커밋 */ + if (tx_begin() != TX_OK) { + tx_return(ctx, TX_FAIL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, ST_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; + + rc = st_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[ST_OL_0015] 원장반영 실패 rc=%d", rc); + tx_abort(); + tx_return(ctx, rc, ctx->out); + return; + } + + /* 정산 영업일 = 거래일의 다음 영업일 */ + if (date_next_business(bizdate, nextbiz) != 0) { + memcpy(nextbiz, bizdate, 8); + nextbiz[8] = '\0'; + } + + /* 후속 정산집계 서비스 연계 (레지스트리 문자열 디스패치) */ + sub_in = tx_buf_alloc(); + sub_out = tx_buf_alloc(); + if (sub_in && sub_out) { + tx_buf_sets(sub_in, "MERCHID", merch); + tx_buf_sets(sub_in, "BIZDATE", nextbiz); + tx_buf_setlong(sub_in, "AMOUNT", amount); + rc = tx_call("ST_POST", sub_in, sub_out); + if (rc != TX_OK) + tx_log(TX_LOG_WARN, "[ST_OL_0015] 후속연계 경고 rc=%d", rc); + } + tx_buf_free(sub_in); + tx_buf_free(sub_out); + + /* 교차 검증: 당일 합계 재계산 */ + if (st_rec_sum(bizdate, &daysum) != TX_OK) + daysum = 0; + + tx_commit(); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYSUM", daysum); + tx_log(TX_LOG_INFO, "[ST_OL_0015] 완료 key=%s 당일합계=%ld", key, daysum); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/st_ol_0016.c b/app/online/st_ol_0016.c new file mode 100644 index 0000000..6fad329 --- /dev/null +++ b/app/online/st_ol_0016.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/st_ol_0016.pgc" +/* @tier easy @module st @transform settlement-online */ +/* + * st_ol_0016.pgc - 정산수수료 온라인 서비스 (ST_OL_0016) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 st 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "st_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/st_ol_0016.pgc" + + +TX_SERVICE(ST_OL_0016, ctx) +{ + st_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[ST_OL_0016] 정산수수료 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[ST_OL_0016] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = st_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[ST_OL_0016] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[ST_OL_0016] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/st_ol_0016.pgc b/app/online/st_ol_0016.pgc new file mode 100644 index 0000000..c98542a --- /dev/null +++ b/app/online/st_ol_0016.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module st @transform settlement-online */ +/* + * st_ol_0016.pgc - 정산수수료 온라인 서비스 (ST_OL_0016) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 st 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "st_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(ST_OL_0016, ctx) +{ + st_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[ST_OL_0016] 정산수수료 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[ST_OL_0016] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = st_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[ST_OL_0016] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[ST_OL_0016] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/st_ol_0017.c b/app/online/st_ol_0017.c new file mode 100644 index 0000000..1e03e94 --- /dev/null +++ b/app/online/st_ol_0017.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/st_ol_0017.pgc" +/* @tier easy @module st @transform settlement-online */ +/* + * st_ol_0017.pgc - 정산수수료 온라인 서비스 (ST_OL_0017) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 st 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "st_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/st_ol_0017.pgc" + + +TX_SERVICE(ST_OL_0017, ctx) +{ + st_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[ST_OL_0017] 정산수수료 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[ST_OL_0017] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = st_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[ST_OL_0017] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[ST_OL_0017] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/st_ol_0017.pgc b/app/online/st_ol_0017.pgc new file mode 100644 index 0000000..95b13e1 --- /dev/null +++ b/app/online/st_ol_0017.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module st @transform settlement-online */ +/* + * st_ol_0017.pgc - 정산수수료 온라인 서비스 (ST_OL_0017) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 st 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "st_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(ST_OL_0017, ctx) +{ + st_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[ST_OL_0017] 정산수수료 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[ST_OL_0017] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = st_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[ST_OL_0017] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[ST_OL_0017] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/st_ol_0018.c b/app/online/st_ol_0018.c new file mode 100644 index 0000000..48a00b9 --- /dev/null +++ b/app/online/st_ol_0018.c @@ -0,0 +1,148 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/st_ol_0018.pgc" +/* @tier medium @module st @transform settlement-online */ +/* + * st_ol_0018.pgc - 정산수수료 온라인 서비스 (ST_OL_0018) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 st 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "st_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/st_ol_0018.pgc" + + +TX_SERVICE(ST_OL_0018, ctx) +{ + st_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[ST_OL_0018] 정산수수료 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[ST_OL_0018] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[ST_OL_0018] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[ST_OL_0018] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, ST_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = st_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[ST_OL_0018] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = st_rec_count(bizdate, ST_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[ST_OL_0018] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/st_ol_0018.pgc b/app/online/st_ol_0018.pgc new file mode 100644 index 0000000..9fec94c --- /dev/null +++ b/app/online/st_ol_0018.pgc @@ -0,0 +1,70 @@ +/* @tier medium @module st @transform settlement-online */ +/* + * st_ol_0018.pgc - 정산수수료 온라인 서비스 (ST_OL_0018) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 st 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "st_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(ST_OL_0018, ctx) +{ + st_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[ST_OL_0018] 정산수수료 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[ST_OL_0018] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[ST_OL_0018] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[ST_OL_0018] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, ST_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = st_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[ST_OL_0018] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = st_rec_count(bizdate, ST_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[ST_OL_0018] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/st_ol_0019.c b/app/online/st_ol_0019.c new file mode 100644 index 0000000..0daba17 --- /dev/null +++ b/app/online/st_ol_0019.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/st_ol_0019.pgc" +/* @tier easy @module st @transform settlement-online */ +/* + * st_ol_0019.pgc - 정산수수료 온라인 서비스 (ST_OL_0019) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 st 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "st_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/st_ol_0019.pgc" + + +TX_SERVICE(ST_OL_0019, ctx) +{ + st_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[ST_OL_0019] 정산수수료 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[ST_OL_0019] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = st_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[ST_OL_0019] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[ST_OL_0019] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/st_ol_0019.pgc b/app/online/st_ol_0019.pgc new file mode 100644 index 0000000..b331590 --- /dev/null +++ b/app/online/st_ol_0019.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module st @transform settlement-online */ +/* + * st_ol_0019.pgc - 정산수수료 온라인 서비스 (ST_OL_0019) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 st 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "st_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(ST_OL_0019, ctx) +{ + st_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[ST_OL_0019] 정산수수료 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[ST_OL_0019] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = st_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[ST_OL_0019] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[ST_OL_0019] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/st_ol_0020.c b/app/online/st_ol_0020.c new file mode 100644 index 0000000..7a37415 --- /dev/null +++ b/app/online/st_ol_0020.c @@ -0,0 +1,148 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/st_ol_0020.pgc" +/* @tier medium @module st @transform settlement-online */ +/* + * st_ol_0020.pgc - 정산수수료 온라인 서비스 (ST_OL_0020) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 st 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "st_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/st_ol_0020.pgc" + + +TX_SERVICE(ST_OL_0020, ctx) +{ + st_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[ST_OL_0020] 정산수수료 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[ST_OL_0020] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[ST_OL_0020] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[ST_OL_0020] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, ST_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = st_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[ST_OL_0020] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = st_rec_count(bizdate, ST_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[ST_OL_0020] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/st_ol_0020.pgc b/app/online/st_ol_0020.pgc new file mode 100644 index 0000000..ad13a2d --- /dev/null +++ b/app/online/st_ol_0020.pgc @@ -0,0 +1,70 @@ +/* @tier medium @module st @transform settlement-online */ +/* + * st_ol_0020.pgc - 정산수수료 온라인 서비스 (ST_OL_0020) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 st 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "st_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(ST_OL_0020, ctx) +{ + st_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[ST_OL_0020] 정산수수료 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[ST_OL_0020] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[ST_OL_0020] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[ST_OL_0020] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, ST_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = st_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[ST_OL_0020] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = st_rec_count(bizdate, ST_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[ST_OL_0020] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/st_ol_0021.c b/app/online/st_ol_0021.c new file mode 100644 index 0000000..7224485 --- /dev/null +++ b/app/online/st_ol_0021.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/st_ol_0021.pgc" +/* @tier easy @module st @transform settlement-online */ +/* + * st_ol_0021.pgc - 정산수수료 온라인 서비스 (ST_OL_0021) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 st 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "st_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/st_ol_0021.pgc" + + +TX_SERVICE(ST_OL_0021, ctx) +{ + st_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[ST_OL_0021] 정산수수료 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[ST_OL_0021] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = st_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[ST_OL_0021] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[ST_OL_0021] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/st_ol_0021.pgc b/app/online/st_ol_0021.pgc new file mode 100644 index 0000000..0afc3a0 --- /dev/null +++ b/app/online/st_ol_0021.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module st @transform settlement-online */ +/* + * st_ol_0021.pgc - 정산수수료 온라인 서비스 (ST_OL_0021) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 st 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "st_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(ST_OL_0021, ctx) +{ + st_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[ST_OL_0021] 정산수수료 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[ST_OL_0021] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = st_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[ST_OL_0021] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[ST_OL_0021] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/st_ol_0022.c b/app/online/st_ol_0022.c new file mode 100644 index 0000000..0c3e338 --- /dev/null +++ b/app/online/st_ol_0022.c @@ -0,0 +1,148 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/st_ol_0022.pgc" +/* @tier medium @module st @transform settlement-online */ +/* + * st_ol_0022.pgc - 정산수수료 온라인 서비스 (ST_OL_0022) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 st 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "st_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/st_ol_0022.pgc" + + +TX_SERVICE(ST_OL_0022, ctx) +{ + st_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[ST_OL_0022] 정산수수료 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[ST_OL_0022] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[ST_OL_0022] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[ST_OL_0022] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, ST_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = st_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[ST_OL_0022] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = st_rec_count(bizdate, ST_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[ST_OL_0022] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/st_ol_0022.pgc b/app/online/st_ol_0022.pgc new file mode 100644 index 0000000..8bf3505 --- /dev/null +++ b/app/online/st_ol_0022.pgc @@ -0,0 +1,70 @@ +/* @tier medium @module st @transform settlement-online */ +/* + * st_ol_0022.pgc - 정산수수료 온라인 서비스 (ST_OL_0022) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 st 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "st_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(ST_OL_0022, ctx) +{ + st_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[ST_OL_0022] 정산수수료 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[ST_OL_0022] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[ST_OL_0022] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[ST_OL_0022] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, ST_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = st_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[ST_OL_0022] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = st_rec_count(bizdate, ST_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[ST_OL_0022] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/st_ol_0023.c b/app/online/st_ol_0023.c new file mode 100644 index 0000000..3353dd3 --- /dev/null +++ b/app/online/st_ol_0023.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/st_ol_0023.pgc" +/* @tier easy @module st @transform settlement-online */ +/* + * st_ol_0023.pgc - 정산수수료 온라인 서비스 (ST_OL_0023) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 st 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "st_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/st_ol_0023.pgc" + + +TX_SERVICE(ST_OL_0023, ctx) +{ + st_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[ST_OL_0023] 정산수수료 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[ST_OL_0023] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = st_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[ST_OL_0023] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[ST_OL_0023] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/st_ol_0023.pgc b/app/online/st_ol_0023.pgc new file mode 100644 index 0000000..70e481c --- /dev/null +++ b/app/online/st_ol_0023.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module st @transform settlement-online */ +/* + * st_ol_0023.pgc - 정산수수료 온라인 서비스 (ST_OL_0023) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 st 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "st_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(ST_OL_0023, ctx) +{ + st_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[ST_OL_0023] 정산수수료 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[ST_OL_0023] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = st_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[ST_OL_0023] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[ST_OL_0023] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/st_ol_0024.c b/app/online/st_ol_0024.c new file mode 100644 index 0000000..25f8641 --- /dev/null +++ b/app/online/st_ol_0024.c @@ -0,0 +1,176 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/st_ol_0024.pgc" +/* @tier hard @module st @transform settlement-online */ +/* + * st_ol_0024.pgc - 정산수수료 온라인 서비스 (ST_OL_0024) [tier=hard] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 st 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "st_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/st_ol_0024.pgc" + + +TX_SERVICE(ST_OL_0024, ctx) +{ + st_rec_t rec; + char key[16], merch[16], bizdate[16], nextbiz[9]; + long amount = 0, daysum = 0; + int rc; + TXBUF *sub_in; + TXBUF *sub_out; + + tx_log(TX_LOG_INFO, "[ST_OL_0024] 정산수수료 트랜잭션 오케스트레이션 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[ST_OL_0024] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + if (!amount_is_valid(amount) || !date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[ST_OL_0024] 입력 검증 실패 amount=%ld date=%s", + amount, bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + /* 트랜잭션 시작 → 원장 반영 → 후속 서비스 연계 → 커밋 */ + if (tx_begin() != TX_OK) { + tx_return(ctx, TX_FAIL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, ST_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; + + rc = st_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[ST_OL_0024] 원장반영 실패 rc=%d", rc); + tx_abort(); + tx_return(ctx, rc, ctx->out); + return; + } + + /* 정산 영업일 = 거래일의 다음 영업일 */ + if (date_next_business(bizdate, nextbiz) != 0) { + memcpy(nextbiz, bizdate, 8); + nextbiz[8] = '\0'; + } + + /* 후속 정산집계 서비스 연계 (레지스트리 문자열 디스패치) */ + sub_in = tx_buf_alloc(); + sub_out = tx_buf_alloc(); + if (sub_in && sub_out) { + tx_buf_sets(sub_in, "MERCHID", merch); + tx_buf_sets(sub_in, "BIZDATE", nextbiz); + tx_buf_setlong(sub_in, "AMOUNT", amount); + rc = tx_call("ST_POST", sub_in, sub_out); + if (rc != TX_OK) + tx_log(TX_LOG_WARN, "[ST_OL_0024] 후속연계 경고 rc=%d", rc); + } + tx_buf_free(sub_in); + tx_buf_free(sub_out); + + /* 교차 검증: 당일 합계 재계산 */ + if (st_rec_sum(bizdate, &daysum) != TX_OK) + daysum = 0; + + tx_commit(); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYSUM", daysum); + tx_log(TX_LOG_INFO, "[ST_OL_0024] 완료 key=%s 당일합계=%ld", key, daysum); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/st_ol_0024.pgc b/app/online/st_ol_0024.pgc new file mode 100644 index 0000000..148e822 --- /dev/null +++ b/app/online/st_ol_0024.pgc @@ -0,0 +1,98 @@ +/* @tier hard @module st @transform settlement-online */ +/* + * st_ol_0024.pgc - 정산수수료 온라인 서비스 (ST_OL_0024) [tier=hard] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 st 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "st_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(ST_OL_0024, ctx) +{ + st_rec_t rec; + char key[16], merch[16], bizdate[16], nextbiz[9]; + long amount = 0, daysum = 0; + int rc; + TXBUF *sub_in; + TXBUF *sub_out; + + tx_log(TX_LOG_INFO, "[ST_OL_0024] 정산수수료 트랜잭션 오케스트레이션 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[ST_OL_0024] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + if (!amount_is_valid(amount) || !date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[ST_OL_0024] 입력 검증 실패 amount=%ld date=%s", + amount, bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + /* 트랜잭션 시작 → 원장 반영 → 후속 서비스 연계 → 커밋 */ + if (tx_begin() != TX_OK) { + tx_return(ctx, TX_FAIL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, ST_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; + + rc = st_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[ST_OL_0024] 원장반영 실패 rc=%d", rc); + tx_abort(); + tx_return(ctx, rc, ctx->out); + return; + } + + /* 정산 영업일 = 거래일의 다음 영업일 */ + if (date_next_business(bizdate, nextbiz) != 0) { + memcpy(nextbiz, bizdate, 8); + nextbiz[8] = '\0'; + } + + /* 후속 정산집계 서비스 연계 (레지스트리 문자열 디스패치) */ + sub_in = tx_buf_alloc(); + sub_out = tx_buf_alloc(); + if (sub_in && sub_out) { + tx_buf_sets(sub_in, "MERCHID", merch); + tx_buf_sets(sub_in, "BIZDATE", nextbiz); + tx_buf_setlong(sub_in, "AMOUNT", amount); + rc = tx_call("ST_POST", sub_in, sub_out); + if (rc != TX_OK) + tx_log(TX_LOG_WARN, "[ST_OL_0024] 후속연계 경고 rc=%d", rc); + } + tx_buf_free(sub_in); + tx_buf_free(sub_out); + + /* 교차 검증: 당일 합계 재계산 */ + if (st_rec_sum(bizdate, &daysum) != TX_OK) + daysum = 0; + + tx_commit(); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYSUM", daysum); + tx_log(TX_LOG_INFO, "[ST_OL_0024] 완료 key=%s 당일합계=%ld", key, daysum); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/st_ol_0025.c b/app/online/st_ol_0025.c new file mode 100644 index 0000000..f2623c7 --- /dev/null +++ b/app/online/st_ol_0025.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/st_ol_0025.pgc" +/* @tier easy @module st @transform settlement-online */ +/* + * st_ol_0025.pgc - 정산수수료 온라인 서비스 (ST_OL_0025) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 st 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "st_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/st_ol_0025.pgc" + + +TX_SERVICE(ST_OL_0025, ctx) +{ + st_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[ST_OL_0025] 정산수수료 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[ST_OL_0025] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = st_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[ST_OL_0025] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[ST_OL_0025] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/st_ol_0025.pgc b/app/online/st_ol_0025.pgc new file mode 100644 index 0000000..8a5d997 --- /dev/null +++ b/app/online/st_ol_0025.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module st @transform settlement-online */ +/* + * st_ol_0025.pgc - 정산수수료 온라인 서비스 (ST_OL_0025) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 st 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "st_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(ST_OL_0025, ctx) +{ + st_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[ST_OL_0025] 정산수수료 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[ST_OL_0025] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = st_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[ST_OL_0025] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[ST_OL_0025] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/st_ol_0026.c b/app/online/st_ol_0026.c new file mode 100644 index 0000000..80eb41d --- /dev/null +++ b/app/online/st_ol_0026.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/st_ol_0026.pgc" +/* @tier easy @module st @transform settlement-online */ +/* + * st_ol_0026.pgc - 정산수수료 온라인 서비스 (ST_OL_0026) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 st 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "st_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/st_ol_0026.pgc" + + +TX_SERVICE(ST_OL_0026, ctx) +{ + st_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[ST_OL_0026] 정산수수료 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[ST_OL_0026] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = st_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[ST_OL_0026] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[ST_OL_0026] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/st_ol_0026.pgc b/app/online/st_ol_0026.pgc new file mode 100644 index 0000000..c3d8926 --- /dev/null +++ b/app/online/st_ol_0026.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module st @transform settlement-online */ +/* + * st_ol_0026.pgc - 정산수수료 온라인 서비스 (ST_OL_0026) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 st 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "st_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(ST_OL_0026, ctx) +{ + st_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[ST_OL_0026] 정산수수료 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[ST_OL_0026] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = st_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[ST_OL_0026] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[ST_OL_0026] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/st_ol_0027.c b/app/online/st_ol_0027.c new file mode 100644 index 0000000..d73f389 --- /dev/null +++ b/app/online/st_ol_0027.c @@ -0,0 +1,148 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/st_ol_0027.pgc" +/* @tier medium @module st @transform settlement-online */ +/* + * st_ol_0027.pgc - 정산수수료 온라인 서비스 (ST_OL_0027) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 st 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "st_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/st_ol_0027.pgc" + + +TX_SERVICE(ST_OL_0027, ctx) +{ + st_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[ST_OL_0027] 정산수수료 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[ST_OL_0027] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[ST_OL_0027] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[ST_OL_0027] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, ST_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = st_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[ST_OL_0027] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = st_rec_count(bizdate, ST_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[ST_OL_0027] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/st_ol_0027.pgc b/app/online/st_ol_0027.pgc new file mode 100644 index 0000000..4645112 --- /dev/null +++ b/app/online/st_ol_0027.pgc @@ -0,0 +1,70 @@ +/* @tier medium @module st @transform settlement-online */ +/* + * st_ol_0027.pgc - 정산수수료 온라인 서비스 (ST_OL_0027) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 st 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "st_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(ST_OL_0027, ctx) +{ + st_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[ST_OL_0027] 정산수수료 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[ST_OL_0027] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[ST_OL_0027] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[ST_OL_0027] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, ST_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = st_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[ST_OL_0027] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = st_rec_count(bizdate, ST_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[ST_OL_0027] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/st_ol_0028.c b/app/online/st_ol_0028.c new file mode 100644 index 0000000..21ee0ad --- /dev/null +++ b/app/online/st_ol_0028.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/st_ol_0028.pgc" +/* @tier easy @module st @transform settlement-online */ +/* + * st_ol_0028.pgc - 정산수수료 온라인 서비스 (ST_OL_0028) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 st 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "st_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/st_ol_0028.pgc" + + +TX_SERVICE(ST_OL_0028, ctx) +{ + st_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[ST_OL_0028] 정산수수료 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[ST_OL_0028] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = st_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[ST_OL_0028] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[ST_OL_0028] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/st_ol_0028.pgc b/app/online/st_ol_0028.pgc new file mode 100644 index 0000000..f00d0d4 --- /dev/null +++ b/app/online/st_ol_0028.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module st @transform settlement-online */ +/* + * st_ol_0028.pgc - 정산수수료 온라인 서비스 (ST_OL_0028) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 st 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "st_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(ST_OL_0028, ctx) +{ + st_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[ST_OL_0028] 정산수수료 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[ST_OL_0028] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = st_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[ST_OL_0028] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[ST_OL_0028] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/st_ol_0029.c b/app/online/st_ol_0029.c new file mode 100644 index 0000000..9305d7f --- /dev/null +++ b/app/online/st_ol_0029.c @@ -0,0 +1,148 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/st_ol_0029.pgc" +/* @tier medium @module st @transform settlement-online */ +/* + * st_ol_0029.pgc - 정산수수료 온라인 서비스 (ST_OL_0029) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 st 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "st_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/st_ol_0029.pgc" + + +TX_SERVICE(ST_OL_0029, ctx) +{ + st_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[ST_OL_0029] 정산수수료 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[ST_OL_0029] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[ST_OL_0029] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[ST_OL_0029] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, ST_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = st_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[ST_OL_0029] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = st_rec_count(bizdate, ST_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[ST_OL_0029] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/st_ol_0029.pgc b/app/online/st_ol_0029.pgc new file mode 100644 index 0000000..18a3fe8 --- /dev/null +++ b/app/online/st_ol_0029.pgc @@ -0,0 +1,70 @@ +/* @tier medium @module st @transform settlement-online */ +/* + * st_ol_0029.pgc - 정산수수료 온라인 서비스 (ST_OL_0029) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 st 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "st_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(ST_OL_0029, ctx) +{ + st_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[ST_OL_0029] 정산수수료 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[ST_OL_0029] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[ST_OL_0029] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[ST_OL_0029] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, ST_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = st_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[ST_OL_0029] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = st_rec_count(bizdate, ST_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[ST_OL_0029] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/st_ol_0030.c b/app/online/st_ol_0030.c new file mode 100644 index 0000000..88f9e19 --- /dev/null +++ b/app/online/st_ol_0030.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/st_ol_0030.pgc" +/* @tier easy @module st @transform settlement-online */ +/* + * st_ol_0030.pgc - 정산수수료 온라인 서비스 (ST_OL_0030) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 st 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "st_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/st_ol_0030.pgc" + + +TX_SERVICE(ST_OL_0030, ctx) +{ + st_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[ST_OL_0030] 정산수수료 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[ST_OL_0030] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = st_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[ST_OL_0030] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[ST_OL_0030] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/st_ol_0030.pgc b/app/online/st_ol_0030.pgc new file mode 100644 index 0000000..0527360 --- /dev/null +++ b/app/online/st_ol_0030.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module st @transform settlement-online */ +/* + * st_ol_0030.pgc - 정산수수료 온라인 서비스 (ST_OL_0030) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 st 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "st_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(ST_OL_0030, ctx) +{ + st_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[ST_OL_0030] 정산수수료 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[ST_OL_0030] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = st_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[ST_OL_0030] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[ST_OL_0030] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/st_ol_0031.c b/app/online/st_ol_0031.c new file mode 100644 index 0000000..21408d8 --- /dev/null +++ b/app/online/st_ol_0031.c @@ -0,0 +1,148 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/st_ol_0031.pgc" +/* @tier medium @module st @transform settlement-online */ +/* + * st_ol_0031.pgc - 정산수수료 온라인 서비스 (ST_OL_0031) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 st 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "st_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/st_ol_0031.pgc" + + +TX_SERVICE(ST_OL_0031, ctx) +{ + st_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[ST_OL_0031] 정산수수료 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[ST_OL_0031] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[ST_OL_0031] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[ST_OL_0031] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, ST_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = st_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[ST_OL_0031] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = st_rec_count(bizdate, ST_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[ST_OL_0031] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/st_ol_0031.pgc b/app/online/st_ol_0031.pgc new file mode 100644 index 0000000..71edaec --- /dev/null +++ b/app/online/st_ol_0031.pgc @@ -0,0 +1,70 @@ +/* @tier medium @module st @transform settlement-online */ +/* + * st_ol_0031.pgc - 정산수수료 온라인 서비스 (ST_OL_0031) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 st 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "st_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(ST_OL_0031, ctx) +{ + st_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[ST_OL_0031] 정산수수료 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[ST_OL_0031] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[ST_OL_0031] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[ST_OL_0031] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, ST_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = st_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[ST_OL_0031] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = st_rec_count(bizdate, ST_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[ST_OL_0031] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/st_ol_0032.c b/app/online/st_ol_0032.c new file mode 100644 index 0000000..321d619 --- /dev/null +++ b/app/online/st_ol_0032.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/st_ol_0032.pgc" +/* @tier easy @module st @transform settlement-online */ +/* + * st_ol_0032.pgc - 정산수수료 온라인 서비스 (ST_OL_0032) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 st 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "st_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/st_ol_0032.pgc" + + +TX_SERVICE(ST_OL_0032, ctx) +{ + st_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[ST_OL_0032] 정산수수료 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[ST_OL_0032] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = st_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[ST_OL_0032] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[ST_OL_0032] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/st_ol_0032.pgc b/app/online/st_ol_0032.pgc new file mode 100644 index 0000000..1a2796a --- /dev/null +++ b/app/online/st_ol_0032.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module st @transform settlement-online */ +/* + * st_ol_0032.pgc - 정산수수료 온라인 서비스 (ST_OL_0032) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 st 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "st_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(ST_OL_0032, ctx) +{ + st_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[ST_OL_0032] 정산수수료 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[ST_OL_0032] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = st_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[ST_OL_0032] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[ST_OL_0032] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/vl_ol_0001.c b/app/online/vl_ol_0001.c new file mode 100644 index 0000000..e0938e2 --- /dev/null +++ b/app/online/vl_ol_0001.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/vl_ol_0001.pgc" +/* @tier easy @module vl @transform validation-online */ +/* + * vl_ol_0001.pgc - 정합성 온라인 서비스 (VL_OL_0001) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 vl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "vl_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/vl_ol_0001.pgc" + + +TX_SERVICE(VL_OL_0001, ctx) +{ + vl_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[VL_OL_0001] 정합성 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[VL_OL_0001] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = vl_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[VL_OL_0001] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[VL_OL_0001] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/vl_ol_0001.pgc b/app/online/vl_ol_0001.pgc new file mode 100644 index 0000000..293d344 --- /dev/null +++ b/app/online/vl_ol_0001.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module vl @transform validation-online */ +/* + * vl_ol_0001.pgc - 정합성 온라인 서비스 (VL_OL_0001) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 vl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "vl_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(VL_OL_0001, ctx) +{ + vl_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[VL_OL_0001] 정합성 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[VL_OL_0001] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = vl_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[VL_OL_0001] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[VL_OL_0001] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/vl_ol_0002.c b/app/online/vl_ol_0002.c new file mode 100644 index 0000000..e12aa15 --- /dev/null +++ b/app/online/vl_ol_0002.c @@ -0,0 +1,148 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/vl_ol_0002.pgc" +/* @tier medium @module vl @transform validation-online */ +/* + * vl_ol_0002.pgc - 정합성 온라인 서비스 (VL_OL_0002) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 vl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "vl_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/vl_ol_0002.pgc" + + +TX_SERVICE(VL_OL_0002, ctx) +{ + vl_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[VL_OL_0002] 정합성 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[VL_OL_0002] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[VL_OL_0002] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[VL_OL_0002] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, VL_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = vl_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[VL_OL_0002] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = vl_rec_count(bizdate, VL_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[VL_OL_0002] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/vl_ol_0002.pgc b/app/online/vl_ol_0002.pgc new file mode 100644 index 0000000..630f406 --- /dev/null +++ b/app/online/vl_ol_0002.pgc @@ -0,0 +1,70 @@ +/* @tier medium @module vl @transform validation-online */ +/* + * vl_ol_0002.pgc - 정합성 온라인 서비스 (VL_OL_0002) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 vl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "vl_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(VL_OL_0002, ctx) +{ + vl_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[VL_OL_0002] 정합성 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[VL_OL_0002] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[VL_OL_0002] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[VL_OL_0002] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, VL_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = vl_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[VL_OL_0002] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = vl_rec_count(bizdate, VL_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[VL_OL_0002] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/vl_ol_0003.c b/app/online/vl_ol_0003.c new file mode 100644 index 0000000..fb506d4 --- /dev/null +++ b/app/online/vl_ol_0003.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/vl_ol_0003.pgc" +/* @tier easy @module vl @transform validation-online */ +/* + * vl_ol_0003.pgc - 정합성 온라인 서비스 (VL_OL_0003) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 vl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "vl_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/vl_ol_0003.pgc" + + +TX_SERVICE(VL_OL_0003, ctx) +{ + vl_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[VL_OL_0003] 정합성 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[VL_OL_0003] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = vl_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[VL_OL_0003] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[VL_OL_0003] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/vl_ol_0003.pgc b/app/online/vl_ol_0003.pgc new file mode 100644 index 0000000..a18df3b --- /dev/null +++ b/app/online/vl_ol_0003.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module vl @transform validation-online */ +/* + * vl_ol_0003.pgc - 정합성 온라인 서비스 (VL_OL_0003) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 vl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "vl_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(VL_OL_0003, ctx) +{ + vl_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[VL_OL_0003] 정합성 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[VL_OL_0003] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = vl_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[VL_OL_0003] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[VL_OL_0003] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/vl_ol_0004.c b/app/online/vl_ol_0004.c new file mode 100644 index 0000000..14634e5 --- /dev/null +++ b/app/online/vl_ol_0004.c @@ -0,0 +1,176 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/vl_ol_0004.pgc" +/* @tier hard @module vl @transform validation-online */ +/* + * vl_ol_0004.pgc - 정합성 온라인 서비스 (VL_OL_0004) [tier=hard] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 vl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "vl_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/vl_ol_0004.pgc" + + +TX_SERVICE(VL_OL_0004, ctx) +{ + vl_rec_t rec; + char key[16], merch[16], bizdate[16], nextbiz[9]; + long amount = 0, daysum = 0; + int rc; + TXBUF *sub_in; + TXBUF *sub_out; + + tx_log(TX_LOG_INFO, "[VL_OL_0004] 정합성 트랜잭션 오케스트레이션 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[VL_OL_0004] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + if (!amount_is_valid(amount) || !date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[VL_OL_0004] 입력 검증 실패 amount=%ld date=%s", + amount, bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + /* 트랜잭션 시작 → 원장 반영 → 후속 서비스 연계 → 커밋 */ + if (tx_begin() != TX_OK) { + tx_return(ctx, TX_FAIL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, VL_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; + + rc = vl_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[VL_OL_0004] 원장반영 실패 rc=%d", rc); + tx_abort(); + tx_return(ctx, rc, ctx->out); + return; + } + + /* 정산 영업일 = 거래일의 다음 영업일 */ + if (date_next_business(bizdate, nextbiz) != 0) { + memcpy(nextbiz, bizdate, 8); + nextbiz[8] = '\0'; + } + + /* 후속 정산집계 서비스 연계 (레지스트리 문자열 디스패치) */ + sub_in = tx_buf_alloc(); + sub_out = tx_buf_alloc(); + if (sub_in && sub_out) { + tx_buf_sets(sub_in, "MERCHID", merch); + tx_buf_sets(sub_in, "BIZDATE", nextbiz); + tx_buf_setlong(sub_in, "AMOUNT", amount); + rc = tx_call("VL_POST", sub_in, sub_out); + if (rc != TX_OK) + tx_log(TX_LOG_WARN, "[VL_OL_0004] 후속연계 경고 rc=%d", rc); + } + tx_buf_free(sub_in); + tx_buf_free(sub_out); + + /* 교차 검증: 당일 합계 재계산 */ + if (vl_rec_sum(bizdate, &daysum) != TX_OK) + daysum = 0; + + tx_commit(); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYSUM", daysum); + tx_log(TX_LOG_INFO, "[VL_OL_0004] 완료 key=%s 당일합계=%ld", key, daysum); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/vl_ol_0004.pgc b/app/online/vl_ol_0004.pgc new file mode 100644 index 0000000..8d23685 --- /dev/null +++ b/app/online/vl_ol_0004.pgc @@ -0,0 +1,98 @@ +/* @tier hard @module vl @transform validation-online */ +/* + * vl_ol_0004.pgc - 정합성 온라인 서비스 (VL_OL_0004) [tier=hard] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 vl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "vl_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(VL_OL_0004, ctx) +{ + vl_rec_t rec; + char key[16], merch[16], bizdate[16], nextbiz[9]; + long amount = 0, daysum = 0; + int rc; + TXBUF *sub_in; + TXBUF *sub_out; + + tx_log(TX_LOG_INFO, "[VL_OL_0004] 정합성 트랜잭션 오케스트레이션 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[VL_OL_0004] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + if (!amount_is_valid(amount) || !date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[VL_OL_0004] 입력 검증 실패 amount=%ld date=%s", + amount, bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + /* 트랜잭션 시작 → 원장 반영 → 후속 서비스 연계 → 커밋 */ + if (tx_begin() != TX_OK) { + tx_return(ctx, TX_FAIL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, VL_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; + + rc = vl_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[VL_OL_0004] 원장반영 실패 rc=%d", rc); + tx_abort(); + tx_return(ctx, rc, ctx->out); + return; + } + + /* 정산 영업일 = 거래일의 다음 영업일 */ + if (date_next_business(bizdate, nextbiz) != 0) { + memcpy(nextbiz, bizdate, 8); + nextbiz[8] = '\0'; + } + + /* 후속 정산집계 서비스 연계 (레지스트리 문자열 디스패치) */ + sub_in = tx_buf_alloc(); + sub_out = tx_buf_alloc(); + if (sub_in && sub_out) { + tx_buf_sets(sub_in, "MERCHID", merch); + tx_buf_sets(sub_in, "BIZDATE", nextbiz); + tx_buf_setlong(sub_in, "AMOUNT", amount); + rc = tx_call("VL_POST", sub_in, sub_out); + if (rc != TX_OK) + tx_log(TX_LOG_WARN, "[VL_OL_0004] 후속연계 경고 rc=%d", rc); + } + tx_buf_free(sub_in); + tx_buf_free(sub_out); + + /* 교차 검증: 당일 합계 재계산 */ + if (vl_rec_sum(bizdate, &daysum) != TX_OK) + daysum = 0; + + tx_commit(); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYSUM", daysum); + tx_log(TX_LOG_INFO, "[VL_OL_0004] 완료 key=%s 당일합계=%ld", key, daysum); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/vl_ol_0005.c b/app/online/vl_ol_0005.c new file mode 100644 index 0000000..13ee48b --- /dev/null +++ b/app/online/vl_ol_0005.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/vl_ol_0005.pgc" +/* @tier easy @module vl @transform validation-online */ +/* + * vl_ol_0005.pgc - 정합성 온라인 서비스 (VL_OL_0005) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 vl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "vl_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/vl_ol_0005.pgc" + + +TX_SERVICE(VL_OL_0005, ctx) +{ + vl_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[VL_OL_0005] 정합성 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[VL_OL_0005] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = vl_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[VL_OL_0005] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[VL_OL_0005] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/vl_ol_0005.pgc b/app/online/vl_ol_0005.pgc new file mode 100644 index 0000000..b0be2b9 --- /dev/null +++ b/app/online/vl_ol_0005.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module vl @transform validation-online */ +/* + * vl_ol_0005.pgc - 정합성 온라인 서비스 (VL_OL_0005) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 vl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "vl_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(VL_OL_0005, ctx) +{ + vl_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[VL_OL_0005] 정합성 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[VL_OL_0005] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = vl_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[VL_OL_0005] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[VL_OL_0005] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/vl_ol_0006.c b/app/online/vl_ol_0006.c new file mode 100644 index 0000000..46133bb --- /dev/null +++ b/app/online/vl_ol_0006.c @@ -0,0 +1,176 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/vl_ol_0006.pgc" +/* @tier hard @module vl @transform validation-online */ +/* + * vl_ol_0006.pgc - 정합성 온라인 서비스 (VL_OL_0006) [tier=hard] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 vl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "vl_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/vl_ol_0006.pgc" + + +TX_SERVICE(VL_OL_0006, ctx) +{ + vl_rec_t rec; + char key[16], merch[16], bizdate[16], nextbiz[9]; + long amount = 0, daysum = 0; + int rc; + TXBUF *sub_in; + TXBUF *sub_out; + + tx_log(TX_LOG_INFO, "[VL_OL_0006] 정합성 트랜잭션 오케스트레이션 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[VL_OL_0006] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + if (!amount_is_valid(amount) || !date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[VL_OL_0006] 입력 검증 실패 amount=%ld date=%s", + amount, bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + /* 트랜잭션 시작 → 원장 반영 → 후속 서비스 연계 → 커밋 */ + if (tx_begin() != TX_OK) { + tx_return(ctx, TX_FAIL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, VL_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; + + rc = vl_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[VL_OL_0006] 원장반영 실패 rc=%d", rc); + tx_abort(); + tx_return(ctx, rc, ctx->out); + return; + } + + /* 정산 영업일 = 거래일의 다음 영업일 */ + if (date_next_business(bizdate, nextbiz) != 0) { + memcpy(nextbiz, bizdate, 8); + nextbiz[8] = '\0'; + } + + /* 후속 정산집계 서비스 연계 (레지스트리 문자열 디스패치) */ + sub_in = tx_buf_alloc(); + sub_out = tx_buf_alloc(); + if (sub_in && sub_out) { + tx_buf_sets(sub_in, "MERCHID", merch); + tx_buf_sets(sub_in, "BIZDATE", nextbiz); + tx_buf_setlong(sub_in, "AMOUNT", amount); + rc = tx_call("VL_POST", sub_in, sub_out); + if (rc != TX_OK) + tx_log(TX_LOG_WARN, "[VL_OL_0006] 후속연계 경고 rc=%d", rc); + } + tx_buf_free(sub_in); + tx_buf_free(sub_out); + + /* 교차 검증: 당일 합계 재계산 */ + if (vl_rec_sum(bizdate, &daysum) != TX_OK) + daysum = 0; + + tx_commit(); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYSUM", daysum); + tx_log(TX_LOG_INFO, "[VL_OL_0006] 완료 key=%s 당일합계=%ld", key, daysum); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/vl_ol_0006.pgc b/app/online/vl_ol_0006.pgc new file mode 100644 index 0000000..590bc97 --- /dev/null +++ b/app/online/vl_ol_0006.pgc @@ -0,0 +1,98 @@ +/* @tier hard @module vl @transform validation-online */ +/* + * vl_ol_0006.pgc - 정합성 온라인 서비스 (VL_OL_0006) [tier=hard] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 vl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "vl_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(VL_OL_0006, ctx) +{ + vl_rec_t rec; + char key[16], merch[16], bizdate[16], nextbiz[9]; + long amount = 0, daysum = 0; + int rc; + TXBUF *sub_in; + TXBUF *sub_out; + + tx_log(TX_LOG_INFO, "[VL_OL_0006] 정합성 트랜잭션 오케스트레이션 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[VL_OL_0006] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + if (!amount_is_valid(amount) || !date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[VL_OL_0006] 입력 검증 실패 amount=%ld date=%s", + amount, bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + /* 트랜잭션 시작 → 원장 반영 → 후속 서비스 연계 → 커밋 */ + if (tx_begin() != TX_OK) { + tx_return(ctx, TX_FAIL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, VL_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; + + rc = vl_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[VL_OL_0006] 원장반영 실패 rc=%d", rc); + tx_abort(); + tx_return(ctx, rc, ctx->out); + return; + } + + /* 정산 영업일 = 거래일의 다음 영업일 */ + if (date_next_business(bizdate, nextbiz) != 0) { + memcpy(nextbiz, bizdate, 8); + nextbiz[8] = '\0'; + } + + /* 후속 정산집계 서비스 연계 (레지스트리 문자열 디스패치) */ + sub_in = tx_buf_alloc(); + sub_out = tx_buf_alloc(); + if (sub_in && sub_out) { + tx_buf_sets(sub_in, "MERCHID", merch); + tx_buf_sets(sub_in, "BIZDATE", nextbiz); + tx_buf_setlong(sub_in, "AMOUNT", amount); + rc = tx_call("VL_POST", sub_in, sub_out); + if (rc != TX_OK) + tx_log(TX_LOG_WARN, "[VL_OL_0006] 후속연계 경고 rc=%d", rc); + } + tx_buf_free(sub_in); + tx_buf_free(sub_out); + + /* 교차 검증: 당일 합계 재계산 */ + if (vl_rec_sum(bizdate, &daysum) != TX_OK) + daysum = 0; + + tx_commit(); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYSUM", daysum); + tx_log(TX_LOG_INFO, "[VL_OL_0006] 완료 key=%s 당일합계=%ld", key, daysum); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/vl_ol_0007.c b/app/online/vl_ol_0007.c new file mode 100644 index 0000000..a8e5015 --- /dev/null +++ b/app/online/vl_ol_0007.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/vl_ol_0007.pgc" +/* @tier easy @module vl @transform validation-online */ +/* + * vl_ol_0007.pgc - 정합성 온라인 서비스 (VL_OL_0007) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 vl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "vl_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/vl_ol_0007.pgc" + + +TX_SERVICE(VL_OL_0007, ctx) +{ + vl_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[VL_OL_0007] 정합성 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[VL_OL_0007] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = vl_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[VL_OL_0007] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[VL_OL_0007] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/vl_ol_0007.pgc b/app/online/vl_ol_0007.pgc new file mode 100644 index 0000000..4ddce1f --- /dev/null +++ b/app/online/vl_ol_0007.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module vl @transform validation-online */ +/* + * vl_ol_0007.pgc - 정합성 온라인 서비스 (VL_OL_0007) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 vl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "vl_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(VL_OL_0007, ctx) +{ + vl_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[VL_OL_0007] 정합성 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[VL_OL_0007] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = vl_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[VL_OL_0007] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[VL_OL_0007] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/vl_ol_0008.c b/app/online/vl_ol_0008.c new file mode 100644 index 0000000..be436f0 --- /dev/null +++ b/app/online/vl_ol_0008.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/vl_ol_0008.pgc" +/* @tier easy @module vl @transform validation-online */ +/* + * vl_ol_0008.pgc - 정합성 온라인 서비스 (VL_OL_0008) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 vl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "vl_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/vl_ol_0008.pgc" + + +TX_SERVICE(VL_OL_0008, ctx) +{ + vl_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[VL_OL_0008] 정합성 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[VL_OL_0008] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = vl_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[VL_OL_0008] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[VL_OL_0008] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/vl_ol_0008.pgc b/app/online/vl_ol_0008.pgc new file mode 100644 index 0000000..36f011e --- /dev/null +++ b/app/online/vl_ol_0008.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module vl @transform validation-online */ +/* + * vl_ol_0008.pgc - 정합성 온라인 서비스 (VL_OL_0008) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 vl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "vl_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(VL_OL_0008, ctx) +{ + vl_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[VL_OL_0008] 정합성 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[VL_OL_0008] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = vl_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[VL_OL_0008] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[VL_OL_0008] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/vl_ol_0009.c b/app/online/vl_ol_0009.c new file mode 100644 index 0000000..c08321d --- /dev/null +++ b/app/online/vl_ol_0009.c @@ -0,0 +1,148 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/vl_ol_0009.pgc" +/* @tier medium @module vl @transform validation-online */ +/* + * vl_ol_0009.pgc - 정합성 온라인 서비스 (VL_OL_0009) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 vl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "vl_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/vl_ol_0009.pgc" + + +TX_SERVICE(VL_OL_0009, ctx) +{ + vl_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[VL_OL_0009] 정합성 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[VL_OL_0009] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[VL_OL_0009] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[VL_OL_0009] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, VL_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = vl_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[VL_OL_0009] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = vl_rec_count(bizdate, VL_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[VL_OL_0009] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/vl_ol_0009.pgc b/app/online/vl_ol_0009.pgc new file mode 100644 index 0000000..208b06a --- /dev/null +++ b/app/online/vl_ol_0009.pgc @@ -0,0 +1,70 @@ +/* @tier medium @module vl @transform validation-online */ +/* + * vl_ol_0009.pgc - 정합성 온라인 서비스 (VL_OL_0009) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 vl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "vl_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(VL_OL_0009, ctx) +{ + vl_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[VL_OL_0009] 정합성 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[VL_OL_0009] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[VL_OL_0009] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[VL_OL_0009] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, VL_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = vl_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[VL_OL_0009] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = vl_rec_count(bizdate, VL_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[VL_OL_0009] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/vl_ol_0010.c b/app/online/vl_ol_0010.c new file mode 100644 index 0000000..6f9e309 --- /dev/null +++ b/app/online/vl_ol_0010.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/vl_ol_0010.pgc" +/* @tier easy @module vl @transform validation-online */ +/* + * vl_ol_0010.pgc - 정합성 온라인 서비스 (VL_OL_0010) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 vl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "vl_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/vl_ol_0010.pgc" + + +TX_SERVICE(VL_OL_0010, ctx) +{ + vl_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[VL_OL_0010] 정합성 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[VL_OL_0010] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = vl_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[VL_OL_0010] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[VL_OL_0010] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/vl_ol_0010.pgc b/app/online/vl_ol_0010.pgc new file mode 100644 index 0000000..aa8c5a9 --- /dev/null +++ b/app/online/vl_ol_0010.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module vl @transform validation-online */ +/* + * vl_ol_0010.pgc - 정합성 온라인 서비스 (VL_OL_0010) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 vl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "vl_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(VL_OL_0010, ctx) +{ + vl_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[VL_OL_0010] 정합성 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[VL_OL_0010] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = vl_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[VL_OL_0010] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[VL_OL_0010] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/vl_ol_0011.c b/app/online/vl_ol_0011.c new file mode 100644 index 0000000..c3fa365 --- /dev/null +++ b/app/online/vl_ol_0011.c @@ -0,0 +1,148 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/vl_ol_0011.pgc" +/* @tier medium @module vl @transform validation-online */ +/* + * vl_ol_0011.pgc - 정합성 온라인 서비스 (VL_OL_0011) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 vl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "vl_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/vl_ol_0011.pgc" + + +TX_SERVICE(VL_OL_0011, ctx) +{ + vl_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[VL_OL_0011] 정합성 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[VL_OL_0011] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[VL_OL_0011] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[VL_OL_0011] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, VL_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = vl_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[VL_OL_0011] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = vl_rec_count(bizdate, VL_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[VL_OL_0011] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/vl_ol_0011.pgc b/app/online/vl_ol_0011.pgc new file mode 100644 index 0000000..0d09b04 --- /dev/null +++ b/app/online/vl_ol_0011.pgc @@ -0,0 +1,70 @@ +/* @tier medium @module vl @transform validation-online */ +/* + * vl_ol_0011.pgc - 정합성 온라인 서비스 (VL_OL_0011) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 vl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "vl_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(VL_OL_0011, ctx) +{ + vl_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[VL_OL_0011] 정합성 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[VL_OL_0011] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[VL_OL_0011] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[VL_OL_0011] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, VL_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = vl_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[VL_OL_0011] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = vl_rec_count(bizdate, VL_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[VL_OL_0011] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/vl_ol_0012.c b/app/online/vl_ol_0012.c new file mode 100644 index 0000000..a7ca898 --- /dev/null +++ b/app/online/vl_ol_0012.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/vl_ol_0012.pgc" +/* @tier easy @module vl @transform validation-online */ +/* + * vl_ol_0012.pgc - 정합성 온라인 서비스 (VL_OL_0012) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 vl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "vl_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/vl_ol_0012.pgc" + + +TX_SERVICE(VL_OL_0012, ctx) +{ + vl_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[VL_OL_0012] 정합성 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[VL_OL_0012] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = vl_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[VL_OL_0012] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[VL_OL_0012] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/vl_ol_0012.pgc b/app/online/vl_ol_0012.pgc new file mode 100644 index 0000000..992de83 --- /dev/null +++ b/app/online/vl_ol_0012.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module vl @transform validation-online */ +/* + * vl_ol_0012.pgc - 정합성 온라인 서비스 (VL_OL_0012) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 vl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "vl_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(VL_OL_0012, ctx) +{ + vl_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[VL_OL_0012] 정합성 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[VL_OL_0012] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = vl_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[VL_OL_0012] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[VL_OL_0012] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/vl_ol_0013.c b/app/online/vl_ol_0013.c new file mode 100644 index 0000000..0c263bf --- /dev/null +++ b/app/online/vl_ol_0013.c @@ -0,0 +1,148 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/vl_ol_0013.pgc" +/* @tier medium @module vl @transform validation-online */ +/* + * vl_ol_0013.pgc - 정합성 온라인 서비스 (VL_OL_0013) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 vl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "vl_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/vl_ol_0013.pgc" + + +TX_SERVICE(VL_OL_0013, ctx) +{ + vl_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[VL_OL_0013] 정합성 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[VL_OL_0013] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[VL_OL_0013] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[VL_OL_0013] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, VL_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = vl_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[VL_OL_0013] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = vl_rec_count(bizdate, VL_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[VL_OL_0013] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/vl_ol_0013.pgc b/app/online/vl_ol_0013.pgc new file mode 100644 index 0000000..48f7b83 --- /dev/null +++ b/app/online/vl_ol_0013.pgc @@ -0,0 +1,70 @@ +/* @tier medium @module vl @transform validation-online */ +/* + * vl_ol_0013.pgc - 정합성 온라인 서비스 (VL_OL_0013) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 vl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "vl_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(VL_OL_0013, ctx) +{ + vl_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[VL_OL_0013] 정합성 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[VL_OL_0013] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[VL_OL_0013] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[VL_OL_0013] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, VL_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = vl_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[VL_OL_0013] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = vl_rec_count(bizdate, VL_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[VL_OL_0013] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/vl_ol_0014.c b/app/online/vl_ol_0014.c new file mode 100644 index 0000000..e18a9d9 --- /dev/null +++ b/app/online/vl_ol_0014.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/vl_ol_0014.pgc" +/* @tier easy @module vl @transform validation-online */ +/* + * vl_ol_0014.pgc - 정합성 온라인 서비스 (VL_OL_0014) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 vl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "vl_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/vl_ol_0014.pgc" + + +TX_SERVICE(VL_OL_0014, ctx) +{ + vl_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[VL_OL_0014] 정합성 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[VL_OL_0014] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = vl_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[VL_OL_0014] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[VL_OL_0014] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/vl_ol_0014.pgc b/app/online/vl_ol_0014.pgc new file mode 100644 index 0000000..5288f97 --- /dev/null +++ b/app/online/vl_ol_0014.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module vl @transform validation-online */ +/* + * vl_ol_0014.pgc - 정합성 온라인 서비스 (VL_OL_0014) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 vl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "vl_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(VL_OL_0014, ctx) +{ + vl_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[VL_OL_0014] 정합성 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[VL_OL_0014] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = vl_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[VL_OL_0014] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[VL_OL_0014] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/vl_ol_0015.c b/app/online/vl_ol_0015.c new file mode 100644 index 0000000..58294fc --- /dev/null +++ b/app/online/vl_ol_0015.c @@ -0,0 +1,176 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/vl_ol_0015.pgc" +/* @tier hard @module vl @transform validation-online */ +/* + * vl_ol_0015.pgc - 정합성 온라인 서비스 (VL_OL_0015) [tier=hard] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 vl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "vl_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/vl_ol_0015.pgc" + + +TX_SERVICE(VL_OL_0015, ctx) +{ + vl_rec_t rec; + char key[16], merch[16], bizdate[16], nextbiz[9]; + long amount = 0, daysum = 0; + int rc; + TXBUF *sub_in; + TXBUF *sub_out; + + tx_log(TX_LOG_INFO, "[VL_OL_0015] 정합성 트랜잭션 오케스트레이션 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[VL_OL_0015] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + if (!amount_is_valid(amount) || !date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[VL_OL_0015] 입력 검증 실패 amount=%ld date=%s", + amount, bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + /* 트랜잭션 시작 → 원장 반영 → 후속 서비스 연계 → 커밋 */ + if (tx_begin() != TX_OK) { + tx_return(ctx, TX_FAIL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, VL_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; + + rc = vl_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[VL_OL_0015] 원장반영 실패 rc=%d", rc); + tx_abort(); + tx_return(ctx, rc, ctx->out); + return; + } + + /* 정산 영업일 = 거래일의 다음 영업일 */ + if (date_next_business(bizdate, nextbiz) != 0) { + memcpy(nextbiz, bizdate, 8); + nextbiz[8] = '\0'; + } + + /* 후속 정산집계 서비스 연계 (레지스트리 문자열 디스패치) */ + sub_in = tx_buf_alloc(); + sub_out = tx_buf_alloc(); + if (sub_in && sub_out) { + tx_buf_sets(sub_in, "MERCHID", merch); + tx_buf_sets(sub_in, "BIZDATE", nextbiz); + tx_buf_setlong(sub_in, "AMOUNT", amount); + rc = tx_call("VL_POST", sub_in, sub_out); + if (rc != TX_OK) + tx_log(TX_LOG_WARN, "[VL_OL_0015] 후속연계 경고 rc=%d", rc); + } + tx_buf_free(sub_in); + tx_buf_free(sub_out); + + /* 교차 검증: 당일 합계 재계산 */ + if (vl_rec_sum(bizdate, &daysum) != TX_OK) + daysum = 0; + + tx_commit(); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYSUM", daysum); + tx_log(TX_LOG_INFO, "[VL_OL_0015] 완료 key=%s 당일합계=%ld", key, daysum); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/vl_ol_0015.pgc b/app/online/vl_ol_0015.pgc new file mode 100644 index 0000000..5d94ada --- /dev/null +++ b/app/online/vl_ol_0015.pgc @@ -0,0 +1,98 @@ +/* @tier hard @module vl @transform validation-online */ +/* + * vl_ol_0015.pgc - 정합성 온라인 서비스 (VL_OL_0015) [tier=hard] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 vl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "vl_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(VL_OL_0015, ctx) +{ + vl_rec_t rec; + char key[16], merch[16], bizdate[16], nextbiz[9]; + long amount = 0, daysum = 0; + int rc; + TXBUF *sub_in; + TXBUF *sub_out; + + tx_log(TX_LOG_INFO, "[VL_OL_0015] 정합성 트랜잭션 오케스트레이션 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[VL_OL_0015] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + if (!amount_is_valid(amount) || !date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[VL_OL_0015] 입력 검증 실패 amount=%ld date=%s", + amount, bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + /* 트랜잭션 시작 → 원장 반영 → 후속 서비스 연계 → 커밋 */ + if (tx_begin() != TX_OK) { + tx_return(ctx, TX_FAIL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, VL_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; + + rc = vl_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[VL_OL_0015] 원장반영 실패 rc=%d", rc); + tx_abort(); + tx_return(ctx, rc, ctx->out); + return; + } + + /* 정산 영업일 = 거래일의 다음 영업일 */ + if (date_next_business(bizdate, nextbiz) != 0) { + memcpy(nextbiz, bizdate, 8); + nextbiz[8] = '\0'; + } + + /* 후속 정산집계 서비스 연계 (레지스트리 문자열 디스패치) */ + sub_in = tx_buf_alloc(); + sub_out = tx_buf_alloc(); + if (sub_in && sub_out) { + tx_buf_sets(sub_in, "MERCHID", merch); + tx_buf_sets(sub_in, "BIZDATE", nextbiz); + tx_buf_setlong(sub_in, "AMOUNT", amount); + rc = tx_call("VL_POST", sub_in, sub_out); + if (rc != TX_OK) + tx_log(TX_LOG_WARN, "[VL_OL_0015] 후속연계 경고 rc=%d", rc); + } + tx_buf_free(sub_in); + tx_buf_free(sub_out); + + /* 교차 검증: 당일 합계 재계산 */ + if (vl_rec_sum(bizdate, &daysum) != TX_OK) + daysum = 0; + + tx_commit(); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYSUM", daysum); + tx_log(TX_LOG_INFO, "[VL_OL_0015] 완료 key=%s 당일합계=%ld", key, daysum); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/vl_ol_0016.c b/app/online/vl_ol_0016.c new file mode 100644 index 0000000..835480e --- /dev/null +++ b/app/online/vl_ol_0016.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/vl_ol_0016.pgc" +/* @tier easy @module vl @transform validation-online */ +/* + * vl_ol_0016.pgc - 정합성 온라인 서비스 (VL_OL_0016) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 vl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "vl_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/vl_ol_0016.pgc" + + +TX_SERVICE(VL_OL_0016, ctx) +{ + vl_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[VL_OL_0016] 정합성 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[VL_OL_0016] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = vl_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[VL_OL_0016] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[VL_OL_0016] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/vl_ol_0016.pgc b/app/online/vl_ol_0016.pgc new file mode 100644 index 0000000..5ff1e72 --- /dev/null +++ b/app/online/vl_ol_0016.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module vl @transform validation-online */ +/* + * vl_ol_0016.pgc - 정합성 온라인 서비스 (VL_OL_0016) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 vl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "vl_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(VL_OL_0016, ctx) +{ + vl_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[VL_OL_0016] 정합성 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[VL_OL_0016] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = vl_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[VL_OL_0016] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[VL_OL_0016] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/vl_ol_0017.c b/app/online/vl_ol_0017.c new file mode 100644 index 0000000..a41c3ad --- /dev/null +++ b/app/online/vl_ol_0017.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/vl_ol_0017.pgc" +/* @tier easy @module vl @transform validation-online */ +/* + * vl_ol_0017.pgc - 정합성 온라인 서비스 (VL_OL_0017) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 vl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "vl_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/vl_ol_0017.pgc" + + +TX_SERVICE(VL_OL_0017, ctx) +{ + vl_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[VL_OL_0017] 정합성 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[VL_OL_0017] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = vl_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[VL_OL_0017] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[VL_OL_0017] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/vl_ol_0017.pgc b/app/online/vl_ol_0017.pgc new file mode 100644 index 0000000..c74b906 --- /dev/null +++ b/app/online/vl_ol_0017.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module vl @transform validation-online */ +/* + * vl_ol_0017.pgc - 정합성 온라인 서비스 (VL_OL_0017) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 vl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "vl_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(VL_OL_0017, ctx) +{ + vl_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[VL_OL_0017] 정합성 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[VL_OL_0017] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = vl_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[VL_OL_0017] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[VL_OL_0017] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/vl_ol_0018.c b/app/online/vl_ol_0018.c new file mode 100644 index 0000000..c51a817 --- /dev/null +++ b/app/online/vl_ol_0018.c @@ -0,0 +1,148 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/vl_ol_0018.pgc" +/* @tier medium @module vl @transform validation-online */ +/* + * vl_ol_0018.pgc - 정합성 온라인 서비스 (VL_OL_0018) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 vl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "vl_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/vl_ol_0018.pgc" + + +TX_SERVICE(VL_OL_0018, ctx) +{ + vl_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[VL_OL_0018] 정합성 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[VL_OL_0018] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[VL_OL_0018] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[VL_OL_0018] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, VL_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = vl_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[VL_OL_0018] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = vl_rec_count(bizdate, VL_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[VL_OL_0018] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/vl_ol_0018.pgc b/app/online/vl_ol_0018.pgc new file mode 100644 index 0000000..1f87d94 --- /dev/null +++ b/app/online/vl_ol_0018.pgc @@ -0,0 +1,70 @@ +/* @tier medium @module vl @transform validation-online */ +/* + * vl_ol_0018.pgc - 정합성 온라인 서비스 (VL_OL_0018) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 vl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "vl_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(VL_OL_0018, ctx) +{ + vl_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[VL_OL_0018] 정합성 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[VL_OL_0018] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[VL_OL_0018] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[VL_OL_0018] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, VL_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = vl_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[VL_OL_0018] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = vl_rec_count(bizdate, VL_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[VL_OL_0018] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/vl_ol_0019.c b/app/online/vl_ol_0019.c new file mode 100644 index 0000000..58efe20 --- /dev/null +++ b/app/online/vl_ol_0019.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/vl_ol_0019.pgc" +/* @tier easy @module vl @transform validation-online */ +/* + * vl_ol_0019.pgc - 정합성 온라인 서비스 (VL_OL_0019) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 vl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "vl_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/vl_ol_0019.pgc" + + +TX_SERVICE(VL_OL_0019, ctx) +{ + vl_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[VL_OL_0019] 정합성 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[VL_OL_0019] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = vl_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[VL_OL_0019] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[VL_OL_0019] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/vl_ol_0019.pgc b/app/online/vl_ol_0019.pgc new file mode 100644 index 0000000..e23beb3 --- /dev/null +++ b/app/online/vl_ol_0019.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module vl @transform validation-online */ +/* + * vl_ol_0019.pgc - 정합성 온라인 서비스 (VL_OL_0019) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 vl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "vl_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(VL_OL_0019, ctx) +{ + vl_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[VL_OL_0019] 정합성 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[VL_OL_0019] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = vl_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[VL_OL_0019] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[VL_OL_0019] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/vl_ol_0020.c b/app/online/vl_ol_0020.c new file mode 100644 index 0000000..b35cf36 --- /dev/null +++ b/app/online/vl_ol_0020.c @@ -0,0 +1,148 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/vl_ol_0020.pgc" +/* @tier medium @module vl @transform validation-online */ +/* + * vl_ol_0020.pgc - 정합성 온라인 서비스 (VL_OL_0020) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 vl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "vl_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/vl_ol_0020.pgc" + + +TX_SERVICE(VL_OL_0020, ctx) +{ + vl_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[VL_OL_0020] 정합성 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[VL_OL_0020] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[VL_OL_0020] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[VL_OL_0020] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, VL_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = vl_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[VL_OL_0020] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = vl_rec_count(bizdate, VL_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[VL_OL_0020] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/vl_ol_0020.pgc b/app/online/vl_ol_0020.pgc new file mode 100644 index 0000000..b7ff39b --- /dev/null +++ b/app/online/vl_ol_0020.pgc @@ -0,0 +1,70 @@ +/* @tier medium @module vl @transform validation-online */ +/* + * vl_ol_0020.pgc - 정합성 온라인 서비스 (VL_OL_0020) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 vl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "vl_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(VL_OL_0020, ctx) +{ + vl_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[VL_OL_0020] 정합성 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[VL_OL_0020] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[VL_OL_0020] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[VL_OL_0020] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, VL_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = vl_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[VL_OL_0020] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = vl_rec_count(bizdate, VL_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[VL_OL_0020] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/vl_ol_0021.c b/app/online/vl_ol_0021.c new file mode 100644 index 0000000..c627ffa --- /dev/null +++ b/app/online/vl_ol_0021.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/vl_ol_0021.pgc" +/* @tier easy @module vl @transform validation-online */ +/* + * vl_ol_0021.pgc - 정합성 온라인 서비스 (VL_OL_0021) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 vl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "vl_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/vl_ol_0021.pgc" + + +TX_SERVICE(VL_OL_0021, ctx) +{ + vl_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[VL_OL_0021] 정합성 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[VL_OL_0021] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = vl_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[VL_OL_0021] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[VL_OL_0021] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/vl_ol_0021.pgc b/app/online/vl_ol_0021.pgc new file mode 100644 index 0000000..6fdff25 --- /dev/null +++ b/app/online/vl_ol_0021.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module vl @transform validation-online */ +/* + * vl_ol_0021.pgc - 정합성 온라인 서비스 (VL_OL_0021) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 vl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "vl_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(VL_OL_0021, ctx) +{ + vl_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[VL_OL_0021] 정합성 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[VL_OL_0021] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = vl_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[VL_OL_0021] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[VL_OL_0021] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/vl_ol_0022.c b/app/online/vl_ol_0022.c new file mode 100644 index 0000000..66b8255 --- /dev/null +++ b/app/online/vl_ol_0022.c @@ -0,0 +1,148 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/vl_ol_0022.pgc" +/* @tier medium @module vl @transform validation-online */ +/* + * vl_ol_0022.pgc - 정합성 온라인 서비스 (VL_OL_0022) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 vl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "vl_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/vl_ol_0022.pgc" + + +TX_SERVICE(VL_OL_0022, ctx) +{ + vl_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[VL_OL_0022] 정합성 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[VL_OL_0022] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[VL_OL_0022] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[VL_OL_0022] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, VL_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = vl_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[VL_OL_0022] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = vl_rec_count(bizdate, VL_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[VL_OL_0022] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/vl_ol_0022.pgc b/app/online/vl_ol_0022.pgc new file mode 100644 index 0000000..ab09259 --- /dev/null +++ b/app/online/vl_ol_0022.pgc @@ -0,0 +1,70 @@ +/* @tier medium @module vl @transform validation-online */ +/* + * vl_ol_0022.pgc - 정합성 온라인 서비스 (VL_OL_0022) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 vl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "vl_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(VL_OL_0022, ctx) +{ + vl_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[VL_OL_0022] 정합성 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[VL_OL_0022] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[VL_OL_0022] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[VL_OL_0022] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, VL_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = vl_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[VL_OL_0022] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = vl_rec_count(bizdate, VL_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[VL_OL_0022] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/vl_ol_0023.c b/app/online/vl_ol_0023.c new file mode 100644 index 0000000..f9898d5 --- /dev/null +++ b/app/online/vl_ol_0023.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/vl_ol_0023.pgc" +/* @tier easy @module vl @transform validation-online */ +/* + * vl_ol_0023.pgc - 정합성 온라인 서비스 (VL_OL_0023) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 vl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "vl_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/vl_ol_0023.pgc" + + +TX_SERVICE(VL_OL_0023, ctx) +{ + vl_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[VL_OL_0023] 정합성 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[VL_OL_0023] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = vl_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[VL_OL_0023] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[VL_OL_0023] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/vl_ol_0023.pgc b/app/online/vl_ol_0023.pgc new file mode 100644 index 0000000..7b95fe4 --- /dev/null +++ b/app/online/vl_ol_0023.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module vl @transform validation-online */ +/* + * vl_ol_0023.pgc - 정합성 온라인 서비스 (VL_OL_0023) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 vl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "vl_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(VL_OL_0023, ctx) +{ + vl_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[VL_OL_0023] 정합성 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[VL_OL_0023] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = vl_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[VL_OL_0023] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[VL_OL_0023] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/vl_ol_0024.c b/app/online/vl_ol_0024.c new file mode 100644 index 0000000..2c91470 --- /dev/null +++ b/app/online/vl_ol_0024.c @@ -0,0 +1,176 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/vl_ol_0024.pgc" +/* @tier hard @module vl @transform validation-online */ +/* + * vl_ol_0024.pgc - 정합성 온라인 서비스 (VL_OL_0024) [tier=hard] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 vl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "vl_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/vl_ol_0024.pgc" + + +TX_SERVICE(VL_OL_0024, ctx) +{ + vl_rec_t rec; + char key[16], merch[16], bizdate[16], nextbiz[9]; + long amount = 0, daysum = 0; + int rc; + TXBUF *sub_in; + TXBUF *sub_out; + + tx_log(TX_LOG_INFO, "[VL_OL_0024] 정합성 트랜잭션 오케스트레이션 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[VL_OL_0024] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + if (!amount_is_valid(amount) || !date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[VL_OL_0024] 입력 검증 실패 amount=%ld date=%s", + amount, bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + /* 트랜잭션 시작 → 원장 반영 → 후속 서비스 연계 → 커밋 */ + if (tx_begin() != TX_OK) { + tx_return(ctx, TX_FAIL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, VL_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; + + rc = vl_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[VL_OL_0024] 원장반영 실패 rc=%d", rc); + tx_abort(); + tx_return(ctx, rc, ctx->out); + return; + } + + /* 정산 영업일 = 거래일의 다음 영업일 */ + if (date_next_business(bizdate, nextbiz) != 0) { + memcpy(nextbiz, bizdate, 8); + nextbiz[8] = '\0'; + } + + /* 후속 정산집계 서비스 연계 (레지스트리 문자열 디스패치) */ + sub_in = tx_buf_alloc(); + sub_out = tx_buf_alloc(); + if (sub_in && sub_out) { + tx_buf_sets(sub_in, "MERCHID", merch); + tx_buf_sets(sub_in, "BIZDATE", nextbiz); + tx_buf_setlong(sub_in, "AMOUNT", amount); + rc = tx_call("VL_POST", sub_in, sub_out); + if (rc != TX_OK) + tx_log(TX_LOG_WARN, "[VL_OL_0024] 후속연계 경고 rc=%d", rc); + } + tx_buf_free(sub_in); + tx_buf_free(sub_out); + + /* 교차 검증: 당일 합계 재계산 */ + if (vl_rec_sum(bizdate, &daysum) != TX_OK) + daysum = 0; + + tx_commit(); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYSUM", daysum); + tx_log(TX_LOG_INFO, "[VL_OL_0024] 완료 key=%s 당일합계=%ld", key, daysum); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/vl_ol_0024.pgc b/app/online/vl_ol_0024.pgc new file mode 100644 index 0000000..5b3059f --- /dev/null +++ b/app/online/vl_ol_0024.pgc @@ -0,0 +1,98 @@ +/* @tier hard @module vl @transform validation-online */ +/* + * vl_ol_0024.pgc - 정합성 온라인 서비스 (VL_OL_0024) [tier=hard] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 vl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "vl_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(VL_OL_0024, ctx) +{ + vl_rec_t rec; + char key[16], merch[16], bizdate[16], nextbiz[9]; + long amount = 0, daysum = 0; + int rc; + TXBUF *sub_in; + TXBUF *sub_out; + + tx_log(TX_LOG_INFO, "[VL_OL_0024] 정합성 트랜잭션 오케스트레이션 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[VL_OL_0024] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + if (!amount_is_valid(amount) || !date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[VL_OL_0024] 입력 검증 실패 amount=%ld date=%s", + amount, bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + /* 트랜잭션 시작 → 원장 반영 → 후속 서비스 연계 → 커밋 */ + if (tx_begin() != TX_OK) { + tx_return(ctx, TX_FAIL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, VL_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; + + rc = vl_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[VL_OL_0024] 원장반영 실패 rc=%d", rc); + tx_abort(); + tx_return(ctx, rc, ctx->out); + return; + } + + /* 정산 영업일 = 거래일의 다음 영업일 */ + if (date_next_business(bizdate, nextbiz) != 0) { + memcpy(nextbiz, bizdate, 8); + nextbiz[8] = '\0'; + } + + /* 후속 정산집계 서비스 연계 (레지스트리 문자열 디스패치) */ + sub_in = tx_buf_alloc(); + sub_out = tx_buf_alloc(); + if (sub_in && sub_out) { + tx_buf_sets(sub_in, "MERCHID", merch); + tx_buf_sets(sub_in, "BIZDATE", nextbiz); + tx_buf_setlong(sub_in, "AMOUNT", amount); + rc = tx_call("VL_POST", sub_in, sub_out); + if (rc != TX_OK) + tx_log(TX_LOG_WARN, "[VL_OL_0024] 후속연계 경고 rc=%d", rc); + } + tx_buf_free(sub_in); + tx_buf_free(sub_out); + + /* 교차 검증: 당일 합계 재계산 */ + if (vl_rec_sum(bizdate, &daysum) != TX_OK) + daysum = 0; + + tx_commit(); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYSUM", daysum); + tx_log(TX_LOG_INFO, "[VL_OL_0024] 완료 key=%s 당일합계=%ld", key, daysum); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/vl_ol_0025.c b/app/online/vl_ol_0025.c new file mode 100644 index 0000000..9b7b072 --- /dev/null +++ b/app/online/vl_ol_0025.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/vl_ol_0025.pgc" +/* @tier easy @module vl @transform validation-online */ +/* + * vl_ol_0025.pgc - 정합성 온라인 서비스 (VL_OL_0025) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 vl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "vl_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/vl_ol_0025.pgc" + + +TX_SERVICE(VL_OL_0025, ctx) +{ + vl_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[VL_OL_0025] 정합성 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[VL_OL_0025] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = vl_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[VL_OL_0025] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[VL_OL_0025] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/vl_ol_0025.pgc b/app/online/vl_ol_0025.pgc new file mode 100644 index 0000000..1c7808c --- /dev/null +++ b/app/online/vl_ol_0025.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module vl @transform validation-online */ +/* + * vl_ol_0025.pgc - 정합성 온라인 서비스 (VL_OL_0025) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 vl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "vl_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(VL_OL_0025, ctx) +{ + vl_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[VL_OL_0025] 정합성 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[VL_OL_0025] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = vl_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[VL_OL_0025] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[VL_OL_0025] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/vl_ol_0026.c b/app/online/vl_ol_0026.c new file mode 100644 index 0000000..661d0d4 --- /dev/null +++ b/app/online/vl_ol_0026.c @@ -0,0 +1,176 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/vl_ol_0026.pgc" +/* @tier hard @module vl @transform validation-online */ +/* + * vl_ol_0026.pgc - 정합성 온라인 서비스 (VL_OL_0026) [tier=hard] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 vl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "vl_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/vl_ol_0026.pgc" + + +TX_SERVICE(VL_OL_0026, ctx) +{ + vl_rec_t rec; + char key[16], merch[16], bizdate[16], nextbiz[9]; + long amount = 0, daysum = 0; + int rc; + TXBUF *sub_in; + TXBUF *sub_out; + + tx_log(TX_LOG_INFO, "[VL_OL_0026] 정합성 트랜잭션 오케스트레이션 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[VL_OL_0026] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + if (!amount_is_valid(amount) || !date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[VL_OL_0026] 입력 검증 실패 amount=%ld date=%s", + amount, bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + /* 트랜잭션 시작 → 원장 반영 → 후속 서비스 연계 → 커밋 */ + if (tx_begin() != TX_OK) { + tx_return(ctx, TX_FAIL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, VL_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; + + rc = vl_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[VL_OL_0026] 원장반영 실패 rc=%d", rc); + tx_abort(); + tx_return(ctx, rc, ctx->out); + return; + } + + /* 정산 영업일 = 거래일의 다음 영업일 */ + if (date_next_business(bizdate, nextbiz) != 0) { + memcpy(nextbiz, bizdate, 8); + nextbiz[8] = '\0'; + } + + /* 후속 정산집계 서비스 연계 (레지스트리 문자열 디스패치) */ + sub_in = tx_buf_alloc(); + sub_out = tx_buf_alloc(); + if (sub_in && sub_out) { + tx_buf_sets(sub_in, "MERCHID", merch); + tx_buf_sets(sub_in, "BIZDATE", nextbiz); + tx_buf_setlong(sub_in, "AMOUNT", amount); + rc = tx_call("VL_POST", sub_in, sub_out); + if (rc != TX_OK) + tx_log(TX_LOG_WARN, "[VL_OL_0026] 후속연계 경고 rc=%d", rc); + } + tx_buf_free(sub_in); + tx_buf_free(sub_out); + + /* 교차 검증: 당일 합계 재계산 */ + if (vl_rec_sum(bizdate, &daysum) != TX_OK) + daysum = 0; + + tx_commit(); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYSUM", daysum); + tx_log(TX_LOG_INFO, "[VL_OL_0026] 완료 key=%s 당일합계=%ld", key, daysum); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/vl_ol_0026.pgc b/app/online/vl_ol_0026.pgc new file mode 100644 index 0000000..e9eb220 --- /dev/null +++ b/app/online/vl_ol_0026.pgc @@ -0,0 +1,98 @@ +/* @tier hard @module vl @transform validation-online */ +/* + * vl_ol_0026.pgc - 정합성 온라인 서비스 (VL_OL_0026) [tier=hard] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 vl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "vl_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(VL_OL_0026, ctx) +{ + vl_rec_t rec; + char key[16], merch[16], bizdate[16], nextbiz[9]; + long amount = 0, daysum = 0; + int rc; + TXBUF *sub_in; + TXBUF *sub_out; + + tx_log(TX_LOG_INFO, "[VL_OL_0026] 정합성 트랜잭션 오케스트레이션 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[VL_OL_0026] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + if (!amount_is_valid(amount) || !date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[VL_OL_0026] 입력 검증 실패 amount=%ld date=%s", + amount, bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + /* 트랜잭션 시작 → 원장 반영 → 후속 서비스 연계 → 커밋 */ + if (tx_begin() != TX_OK) { + tx_return(ctx, TX_FAIL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, VL_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; + + rc = vl_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[VL_OL_0026] 원장반영 실패 rc=%d", rc); + tx_abort(); + tx_return(ctx, rc, ctx->out); + return; + } + + /* 정산 영업일 = 거래일의 다음 영업일 */ + if (date_next_business(bizdate, nextbiz) != 0) { + memcpy(nextbiz, bizdate, 8); + nextbiz[8] = '\0'; + } + + /* 후속 정산집계 서비스 연계 (레지스트리 문자열 디스패치) */ + sub_in = tx_buf_alloc(); + sub_out = tx_buf_alloc(); + if (sub_in && sub_out) { + tx_buf_sets(sub_in, "MERCHID", merch); + tx_buf_sets(sub_in, "BIZDATE", nextbiz); + tx_buf_setlong(sub_in, "AMOUNT", amount); + rc = tx_call("VL_POST", sub_in, sub_out); + if (rc != TX_OK) + tx_log(TX_LOG_WARN, "[VL_OL_0026] 후속연계 경고 rc=%d", rc); + } + tx_buf_free(sub_in); + tx_buf_free(sub_out); + + /* 교차 검증: 당일 합계 재계산 */ + if (vl_rec_sum(bizdate, &daysum) != TX_OK) + daysum = 0; + + tx_commit(); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYSUM", daysum); + tx_log(TX_LOG_INFO, "[VL_OL_0026] 완료 key=%s 당일합계=%ld", key, daysum); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/vl_ol_0027.c b/app/online/vl_ol_0027.c new file mode 100644 index 0000000..e2ee163 --- /dev/null +++ b/app/online/vl_ol_0027.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/vl_ol_0027.pgc" +/* @tier easy @module vl @transform validation-online */ +/* + * vl_ol_0027.pgc - 정합성 온라인 서비스 (VL_OL_0027) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 vl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "vl_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/vl_ol_0027.pgc" + + +TX_SERVICE(VL_OL_0027, ctx) +{ + vl_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[VL_OL_0027] 정합성 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[VL_OL_0027] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = vl_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[VL_OL_0027] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[VL_OL_0027] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/vl_ol_0027.pgc b/app/online/vl_ol_0027.pgc new file mode 100644 index 0000000..e53e952 --- /dev/null +++ b/app/online/vl_ol_0027.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module vl @transform validation-online */ +/* + * vl_ol_0027.pgc - 정합성 온라인 서비스 (VL_OL_0027) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 vl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "vl_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(VL_OL_0027, ctx) +{ + vl_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[VL_OL_0027] 정합성 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[VL_OL_0027] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = vl_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[VL_OL_0027] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[VL_OL_0027] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/vl_ol_0028.c b/app/online/vl_ol_0028.c new file mode 100644 index 0000000..ab7b876 --- /dev/null +++ b/app/online/vl_ol_0028.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/vl_ol_0028.pgc" +/* @tier easy @module vl @transform validation-online */ +/* + * vl_ol_0028.pgc - 정합성 온라인 서비스 (VL_OL_0028) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 vl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "vl_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/vl_ol_0028.pgc" + + +TX_SERVICE(VL_OL_0028, ctx) +{ + vl_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[VL_OL_0028] 정합성 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[VL_OL_0028] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = vl_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[VL_OL_0028] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[VL_OL_0028] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/vl_ol_0028.pgc b/app/online/vl_ol_0028.pgc new file mode 100644 index 0000000..47db6e8 --- /dev/null +++ b/app/online/vl_ol_0028.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module vl @transform validation-online */ +/* + * vl_ol_0028.pgc - 정합성 온라인 서비스 (VL_OL_0028) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 vl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "vl_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(VL_OL_0028, ctx) +{ + vl_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[VL_OL_0028] 정합성 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[VL_OL_0028] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = vl_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[VL_OL_0028] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[VL_OL_0028] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/vl_ol_0029.c b/app/online/vl_ol_0029.c new file mode 100644 index 0000000..213a404 --- /dev/null +++ b/app/online/vl_ol_0029.c @@ -0,0 +1,148 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/vl_ol_0029.pgc" +/* @tier medium @module vl @transform validation-online */ +/* + * vl_ol_0029.pgc - 정합성 온라인 서비스 (VL_OL_0029) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 vl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "vl_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/vl_ol_0029.pgc" + + +TX_SERVICE(VL_OL_0029, ctx) +{ + vl_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[VL_OL_0029] 정합성 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[VL_OL_0029] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[VL_OL_0029] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[VL_OL_0029] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, VL_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = vl_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[VL_OL_0029] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = vl_rec_count(bizdate, VL_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[VL_OL_0029] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/vl_ol_0029.pgc b/app/online/vl_ol_0029.pgc new file mode 100644 index 0000000..9e89703 --- /dev/null +++ b/app/online/vl_ol_0029.pgc @@ -0,0 +1,70 @@ +/* @tier medium @module vl @transform validation-online */ +/* + * vl_ol_0029.pgc - 정합성 온라인 서비스 (VL_OL_0029) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 vl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "vl_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(VL_OL_0029, ctx) +{ + vl_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[VL_OL_0029] 정합성 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[VL_OL_0029] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[VL_OL_0029] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[VL_OL_0029] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, VL_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = vl_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[VL_OL_0029] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = vl_rec_count(bizdate, VL_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[VL_OL_0029] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/vl_ol_0030.c b/app/online/vl_ol_0030.c new file mode 100644 index 0000000..954b189 --- /dev/null +++ b/app/online/vl_ol_0030.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/vl_ol_0030.pgc" +/* @tier easy @module vl @transform validation-online */ +/* + * vl_ol_0030.pgc - 정합성 온라인 서비스 (VL_OL_0030) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 vl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "vl_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/vl_ol_0030.pgc" + + +TX_SERVICE(VL_OL_0030, ctx) +{ + vl_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[VL_OL_0030] 정합성 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[VL_OL_0030] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = vl_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[VL_OL_0030] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[VL_OL_0030] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/vl_ol_0030.pgc b/app/online/vl_ol_0030.pgc new file mode 100644 index 0000000..d0d07f7 --- /dev/null +++ b/app/online/vl_ol_0030.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module vl @transform validation-online */ +/* + * vl_ol_0030.pgc - 정합성 온라인 서비스 (VL_OL_0030) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 vl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "vl_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(VL_OL_0030, ctx) +{ + vl_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[VL_OL_0030] 정합성 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[VL_OL_0030] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = vl_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[VL_OL_0030] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[VL_OL_0030] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/vl_ol_0031.c b/app/online/vl_ol_0031.c new file mode 100644 index 0000000..db6cdd3 --- /dev/null +++ b/app/online/vl_ol_0031.c @@ -0,0 +1,148 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/vl_ol_0031.pgc" +/* @tier medium @module vl @transform validation-online */ +/* + * vl_ol_0031.pgc - 정합성 온라인 서비스 (VL_OL_0031) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 vl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "vl_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/vl_ol_0031.pgc" + + +TX_SERVICE(VL_OL_0031, ctx) +{ + vl_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[VL_OL_0031] 정합성 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[VL_OL_0031] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[VL_OL_0031] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[VL_OL_0031] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, VL_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = vl_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[VL_OL_0031] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = vl_rec_count(bizdate, VL_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[VL_OL_0031] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/vl_ol_0031.pgc b/app/online/vl_ol_0031.pgc new file mode 100644 index 0000000..2e1481b --- /dev/null +++ b/app/online/vl_ol_0031.pgc @@ -0,0 +1,70 @@ +/* @tier medium @module vl @transform validation-online */ +/* + * vl_ol_0031.pgc - 정합성 온라인 서비스 (VL_OL_0031) [tier=medium] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 vl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "vl_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(VL_OL_0031, ctx) +{ + vl_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[VL_OL_0031] 정합성 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[VL_OL_0031] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[VL_OL_0031] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[VL_OL_0031] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, VL_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = vl_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[VL_OL_0031] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = vl_rec_count(bizdate, VL_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[VL_OL_0031] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/vl_ol_0032.c b/app/online/vl_ol_0032.c new file mode 100644 index 0000000..ae29e61 --- /dev/null +++ b/app/online/vl_ol_0032.c @@ -0,0 +1,125 @@ +/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */ +/* These include files are added by the preprocessor */ +#include +#include +#include +/* End of automatic include section */ + +#line 1 "app/online/vl_ol_0032.pgc" +/* @tier easy @module vl @transform validation-online */ +/* + * vl_ol_0032.pgc - 정합성 온라인 서비스 (VL_OL_0032) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 vl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "vl_core.h" + + +#line 1 "/usr/include/postgresql/sqlca.h" +#ifndef POSTGRES_SQLCA_H +#define POSTGRES_SQLCA_H + +#ifndef PGDLLIMPORT +#if defined(WIN32) || defined(__CYGWIN__) +#define PGDLLIMPORT __declspec (dllimport) +#else +#define PGDLLIMPORT +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ + +#define SQLERRMC_LEN 150 + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct sqlca_t +{ + char sqlcaid[8]; + long sqlabc; + long sqlcode; + struct + { + int sqlerrml; + char sqlerrmc[SQLERRMC_LEN]; + } sqlerrm; + char sqlerrp[8]; + long sqlerrd[6]; + /* Element 0: empty */ + /* 1: OID of processed tuple if applicable */ + /* 2: number of rows processed */ + /* after an INSERT, UPDATE or */ + /* DELETE statement */ + /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + char sqlwarn[8]; + /* Element 0: set to 'W' if at least one other is 'W' */ + /* 1: if 'W' at least one character string */ + /* value was truncated when it was */ + /* stored into a host variable. */ + + /* + * 2: if 'W' a (hopefully) non-fatal notice occurred + */ /* 3: empty */ + /* 4: empty */ + /* 5: empty */ + /* 6: empty */ + /* 7: empty */ + + char sqlstate[5]; +}; + +struct sqlca_t *ECPGget_sqlca(void); + +#ifndef POSTGRES_ECPG_INTERNAL +#define sqlca (*ECPGget_sqlca()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#line 15 "app/online/vl_ol_0032.pgc" + + +TX_SERVICE(VL_OL_0032, ctx) +{ + vl_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[VL_OL_0032] 정합성 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[VL_OL_0032] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = vl_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[VL_OL_0032] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[VL_OL_0032] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/online/vl_ol_0032.pgc b/app/online/vl_ol_0032.pgc new file mode 100644 index 0000000..b35016a --- /dev/null +++ b/app/online/vl_ol_0032.pgc @@ -0,0 +1,47 @@ +/* @tier easy @module vl @transform validation-online */ +/* + * vl_ol_0032.pgc - 정합성 온라인 서비스 (VL_OL_0032) [tier=easy] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 vl 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "vl_core.h" + +EXEC SQL INCLUDE sqlca; + +TX_SERVICE(VL_OL_0032, ctx) +{ + vl_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[VL_OL_0032] 정합성 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[VL_OL_0032] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = vl_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[VL_OL_0032] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[VL_OL_0032] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} diff --git a/app/shared/common/util_amount.c b/app/shared/common/util_amount.c new file mode 100644 index 0000000..7f07ccd --- /dev/null +++ b/app/shared/common/util_amount.c @@ -0,0 +1,68 @@ +/* + * util_amount.c - 금액/통화 유틸리티 (plain C, 공유) + */ +#include "acq_util.h" + +#include +#include +#include + +#define AMOUNT_MAX 100000000L + +long amount_parse(const char *field, int len) +{ + long v = 0; + int i; + if (!field || len <= 0) + return -1; + for (i = 0; i < len; i++) { + char c = field[i]; + if (c == ' ') + continue; + if (!isdigit((unsigned char)c)) + return -1; + v = v * 10 + (c - '0'); + } + return v; +} + +int amount_format(long amount, char *out, int len) +{ + char tmp[32]; + int n; + if (!out || len <= 0 || amount < 0) + return -1; + n = snprintf(tmp, sizeof(tmp), "%0*ld", len, amount); + if (n < 0 || n > len) + return -1; + memcpy(out, tmp, len); + return 0; +} + +void amount_format_won(long amount, char *out, int outlen) +{ + char raw[32]; + int n, i, j, digits, first; + if (!out || outlen <= 0) + return; + n = snprintf(raw, sizeof(raw), "%ld", amount); + if (n < 0) { out[0] = '\0'; return; } + first = (raw[0] == '-') ? 1 : 0; + digits = n - first; + j = 0; + if (first && j < outlen - 1) + out[j++] = '-'; + for (i = first; i < n && j < outlen - 1; i++) { + int pos = i - first; + if (pos > 0 && (digits - pos) % 3 == 0) + if (j < outlen - 1) + out[j++] = ','; + out[j++] = raw[i]; + } + out[j] = '\0'; +} + +int amount_is_valid(long amount) +{ + return (amount >= 1 && amount <= AMOUNT_MAX) ? 1 : 0; +} diff --git a/app/shared/common/util_date.c b/app/shared/common/util_date.c new file mode 100644 index 0000000..72889f3 --- /dev/null +++ b/app/shared/common/util_date.c @@ -0,0 +1,113 @@ +/* + * util_date.c - 일자/영업일 유틸리티 (plain C, 공유) + */ +#include "acq_util.h" + +#include +#include +#include +#include + +static int is_all_digit(const char *s, int len) +{ + int i; + for (i = 0; i < len; i++) + if (!isdigit((unsigned char)s[i])) + return 0; + return 1; +} + +static int to_int(const char *s, int len) +{ + int i, v = 0; + for (i = 0; i < len; i++) + v = v * 10 + (s[i] - '0'); + return v; +} + +static int days_in_month(int y, int m) +{ + static const int d[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; + if (m < 1 || m > 12) + return 0; + if (m == 2) { + int leap = (y % 4 == 0 && y % 100 != 0) || (y % 400 == 0); + return leap ? 29 : 28; + } + return d[m - 1]; +} + +int date_is_valid(const char *yyyymmdd) +{ + int y, m, d; + if (!yyyymmdd || strlen(yyyymmdd) < 8) + return 0; + if (!is_all_digit(yyyymmdd, 8)) + return 0; + y = to_int(yyyymmdd, 4); + m = to_int(yyyymmdd + 4, 2); + d = to_int(yyyymmdd + 6, 2); + if (y < 1900 || y > 2999) return 0; + if (m < 1 || m > 12) return 0; + if (d < 1 || d > days_in_month(y, m)) return 0; + return 1; +} + +int date_weekday(const char *yyyymmdd) +{ + static const int t[] = { 0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4 }; + int y, m, d; + if (!date_is_valid(yyyymmdd)) + return -1; + y = to_int(yyyymmdd, 4); + m = to_int(yyyymmdd + 4, 2); + d = to_int(yyyymmdd + 6, 2); + if (m < 3) + y -= 1; + return (y + y / 4 - y / 100 + y / 400 + t[m - 1] + d) % 7; +} + +int date_is_weekend(const char *yyyymmdd) +{ + int w = date_weekday(yyyymmdd); + return (w == 0 || w == 6) ? 1 : 0; +} + +static void add_one_day(const char *in, char *out) +{ + int y = to_int(in, 4); + int m = to_int(in + 4, 2); + int d = to_int(in + 6, 2); + d++; + if (d > days_in_month(y, m)) { + d = 1; m++; + if (m > 12) { m = 1; y++; } + } + snprintf(out, 9, "%04d%02d%02d", y, m, d); +} + +int date_next_business(const char *yyyymmdd, char *out) +{ + char cur[9]; + int guard = 0; + if (!date_is_valid(yyyymmdd) || !out) + return -1; + memcpy(cur, yyyymmdd, 8); + cur[8] = '\0'; + do { + add_one_day(cur, cur); + if (++guard > 14) + return -1; + } while (date_is_weekend(cur)); + memcpy(out, cur, 8); + out[8] = '\0'; + return 0; +} + +void date_today(char *out) +{ + time_t now = time(NULL); + struct tm tmv; + localtime_r(&now, &tmv); + strftime(out, 9, "%Y%m%d", &tmv); +} diff --git a/app/shared/common/util_msg.c b/app/shared/common/util_msg.c new file mode 100644 index 0000000..77c50a4 --- /dev/null +++ b/app/shared/common/util_msg.c @@ -0,0 +1,88 @@ +/* + * util_msg.c - 고정길이 전문 pack/unpack 유틸리티 (plain C, 공유) + */ +#include "acq_util.h" + +#include +#include + +void msg_field_copy(char *out, const char *field, int len) +{ + int end; + if (!out || !field || len < 0) + return; + end = len; + while (end > 0 && (field[end - 1] == ' ' || field[end - 1] == '\0')) + end--; + memcpy(out, field, end); + out[end] = '\0'; +} + +void msg_field_set(char *field, const char *src, int len) +{ + int slen, i; + if (!field || len < 0) + return; + slen = src ? (int)strlen(src) : 0; + if (slen > len) + slen = len; + memcpy(field, src, slen); + for (i = slen; i < len; i++) + field[i] = ' '; +} + +void msg_field_set_num(char *field, const char *src, int len) +{ + int slen, pad, i; + if (!field || len < 0) + return; + slen = src ? (int)strlen(src) : 0; + if (slen > len) + slen = len; + pad = len - slen; + for (i = 0; i < pad; i++) + field[i] = '0'; + if (src) + memcpy(field + pad, src, slen); +} + +int msg_unpack(acq_msg_t *msg, const char *raw, int rawlen) +{ + if (!msg || !raw) + return -1; + if (rawlen < MSG_ACQ_LEN) + return -1; + memcpy(msg, raw, MSG_ACQ_LEN); + return 0; +} + +int msg_pack(const acq_msg_t *msg, char *raw, int rawlen) +{ + if (!msg || !raw) + return -1; + if (rawlen < MSG_ACQ_LEN) + return -1; + memcpy(raw, msg, MSG_ACQ_LEN); + return 0; +} + +static int field_blank(const char *field, int len) +{ + int i; + for (i = 0; i < len; i++) + if (field[i] != ' ' && field[i] != '\0') + return 0; + return 1; +} + +int msg_validate(const acq_msg_t *msg) +{ + if (!msg) + return -1; + if (field_blank(msg->msg_type, FLD_MSG_TYPE_LEN)) return -1; + if (field_blank(msg->merch_id, FLD_MERCH_ID_LEN)) return -1; + if (field_blank(msg->card_no, FLD_CARD_NO_LEN)) return -1; + if (field_blank(msg->amount, FLD_AMOUNT_LEN)) return -1; + if (field_blank(msg->txn_date, FLD_TXN_DATE_LEN)) return -1; + return 0; +} diff --git a/app/shared/include/acq_util.h b/app/shared/include/acq_util.h new file mode 100644 index 0000000..b3df6eb --- /dev/null +++ b/app/shared/include/acq_util.h @@ -0,0 +1,27 @@ +/* + * acq_util.h - 공통 유틸리티 (일자/금액/전문) 선언 (공유) + */ +#ifndef ACQ_UTIL_H +#define ACQ_UTIL_H + +#include "msg_layout.h" + +int date_is_valid(const char *yyyymmdd); +int date_weekday(const char *yyyymmdd); +int date_is_weekend(const char *yyyymmdd); +int date_next_business(const char *yyyymmdd, char *out); +void date_today(char *out); + +long amount_parse(const char *field, int len); +int amount_format(long amount, char *out, int len); +void amount_format_won(long amount, char *out, int outlen); +int amount_is_valid(long amount); + +void msg_field_copy(char *out, const char *field, int len); +void msg_field_set(char *field, const char *src, int len); +void msg_field_set_num(char *field, const char *src, int len); +int msg_unpack(acq_msg_t *msg, const char *raw, int rawlen); +int msg_pack(const acq_msg_t *msg, char *raw, int rawlen); +int msg_validate(const acq_msg_t *msg); + +#endif /* ACQ_UTIL_H */ diff --git a/app/shared/include/msg_layout.h b/app/shared/include/msg_layout.h new file mode 100644 index 0000000..dfcf63e --- /dev/null +++ b/app/shared/include/msg_layout.h @@ -0,0 +1,43 @@ +/* + * msg_layout.h - 카드 매입 전문(電文) 고정길이 레이아웃 (공유) + */ +#ifndef MSG_LAYOUT_H +#define MSG_LAYOUT_H + +#define MSG_TYPE_RECV "0200" +#define MSG_TYPE_RESP "0210" +#define MSG_TYPE_RECON "0500" + +#define RESP_OK "0000" +#define RESP_INVALID "9001" +#define RESP_NOMERCH "9002" +#define RESP_SYSERR "9999" + +typedef struct { + char msg_type[4]; + char trans_code[6]; + char merch_id[15]; + char card_no[16]; + char approval_no[9]; + char amount[12]; + char txn_date[8]; + char txn_time[6]; + char inst_month[2]; + char resp_code[4]; + char filler[18]; +} acq_msg_t; + +#define MSG_ACQ_LEN ((int)sizeof(acq_msg_t)) + +#define FLD_MSG_TYPE_LEN 4 +#define FLD_TRANS_CODE_LEN 6 +#define FLD_MERCH_ID_LEN 15 +#define FLD_CARD_NO_LEN 16 +#define FLD_APPROVAL_LEN 9 +#define FLD_AMOUNT_LEN 12 +#define FLD_TXN_DATE_LEN 8 +#define FLD_TXN_TIME_LEN 6 +#define FLD_INST_LEN 2 +#define FLD_RESP_LEN 4 + +#endif /* MSG_LAYOUT_H */ diff --git a/config/ac_cfg_0001.dat b/config/ac_cfg_0001.dat new file mode 100644 index 0000000..3418a61 --- /dev/null +++ b/config/ac_cfg_0001.dat @@ -0,0 +1,6 @@ +# ac_cfg_0001.dat - 매입 코드 매핑 데이터 (파이프 구분) +# code|label|value +01|매입 접수|R +02|매입 완료|M +03|매입 불일치|U +04|매입 정산|S diff --git a/config/ac_cfg_0002.cfg b/config/ac_cfg_0002.cfg new file mode 100644 index 0000000..73ff09b --- /dev/null +++ b/config/ac_cfg_0002.cfg @@ -0,0 +1,15 @@ +# ac_cfg_0002.cfg - @KMOD@ 런타임 설정 (medium) +[general] +module = ac +transform = acquire +tier = medium + +[db] +dsn = acquire@localhost +schema = public +fetch_size = 1000 + +[limits] +daily_cap = 100000000 +single_cap = 50000000 +fee_rate_bp = 250 diff --git a/config/ac_cfg_0003.ubb b/config/ac_cfg_0003.ubb new file mode 100644 index 0000000..c465ade --- /dev/null +++ b/config/ac_cfg_0003.ubb @@ -0,0 +1,22 @@ +# +# ac_cfg_0003.ubb - 매입 TP 도메인 구성 (Tuxedo UBBCONFIG 형식, 참고) +# +*RESOURCES + IPCKEY 70024 + MASTER SITE1 + MODEL SHM + LDBAL Y + +*MACHINES + "acqhost" LMID=SITE1 + APPDIR="/app/acquire-core" + TUXCONFIG="/app/acquire-core/tuxconfig" + +*GROUPS + GRP_AC LMID=SITE1 GRPNO=25 + +*SERVERS + AC_SVR SRVGRP=GRP_AC SRVID=25 CLOPT="-A" + +*SERVICES + AC_SVC LOAD=50 PRIO=50 diff --git a/config/ac_cfg_0004.dat b/config/ac_cfg_0004.dat new file mode 100644 index 0000000..7634a8e --- /dev/null +++ b/config/ac_cfg_0004.dat @@ -0,0 +1,6 @@ +# ac_cfg_0004.dat - 매입 코드 매핑 데이터 (파이프 구분) +# code|label|value +01|매입 접수|R +02|매입 완료|M +03|매입 불일치|U +04|매입 정산|S diff --git a/config/ac_cfg_0005.cfg b/config/ac_cfg_0005.cfg new file mode 100644 index 0000000..42e1f94 --- /dev/null +++ b/config/ac_cfg_0005.cfg @@ -0,0 +1,15 @@ +# ac_cfg_0005.cfg - @KMOD@ 런타임 설정 (easy) +[general] +module = ac +transform = acquire +tier = easy + +[db] +dsn = acquire@localhost +schema = public +fetch_size = 1000 + +[limits] +daily_cap = 100000000 +single_cap = 50000000 +fee_rate_bp = 250 diff --git a/config/ac_cfg_0006.ubb b/config/ac_cfg_0006.ubb new file mode 100644 index 0000000..e773f79 --- /dev/null +++ b/config/ac_cfg_0006.ubb @@ -0,0 +1,22 @@ +# +# ac_cfg_0006.ubb - 매입 TP 도메인 구성 (Tuxedo UBBCONFIG 형식, 참고) +# +*RESOURCES + IPCKEY 70057 + MASTER SITE1 + MODEL SHM + LDBAL Y + +*MACHINES + "acqhost" LMID=SITE1 + APPDIR="/app/acquire-core" + TUXCONFIG="/app/acquire-core/tuxconfig" + +*GROUPS + GRP_AC LMID=SITE1 GRPNO=28 + +*SERVERS + AC_SVR SRVGRP=GRP_AC SRVID=28 CLOPT="-A" + +*SERVICES + AC_SVC LOAD=50 PRIO=50 diff --git a/config/au_cfg_0001.cfg b/config/au_cfg_0001.cfg new file mode 100644 index 0000000..5dba65c --- /dev/null +++ b/config/au_cfg_0001.cfg @@ -0,0 +1,15 @@ +# au_cfg_0001.cfg - @KMOD@ 런타임 설정 (easy) +[general] +module = au +transform = authorization +tier = easy + +[db] +dsn = acquire@localhost +schema = public +fetch_size = 1000 + +[limits] +daily_cap = 100000000 +single_cap = 50000000 +fee_rate_bp = 250 diff --git a/config/au_cfg_0002.ubb b/config/au_cfg_0002.ubb new file mode 100644 index 0000000..a7a12d9 --- /dev/null +++ b/config/au_cfg_0002.ubb @@ -0,0 +1,22 @@ +# +# au_cfg_0002.ubb - 승인한도 TP 도메인 구성 (Tuxedo UBBCONFIG 형식, 참고) +# +*RESOURCES + IPCKEY 70012 + MASTER SITE1 + MODEL SHM + LDBAL Y + +*MACHINES + "acqhost" LMID=SITE1 + APPDIR="/app/acquire-core" + TUXCONFIG="/app/acquire-core/tuxconfig" + +*GROUPS + GRP_AU LMID=SITE1 GRPNO=13 + +*SERVERS + AU_SVR SRVGRP=GRP_AU SRVID=13 CLOPT="-A" + +*SERVICES + AU_SVC LOAD=50 PRIO=50 diff --git a/config/au_cfg_0003.dat b/config/au_cfg_0003.dat new file mode 100644 index 0000000..82714c3 --- /dev/null +++ b/config/au_cfg_0003.dat @@ -0,0 +1,6 @@ +# au_cfg_0003.dat - 승인한도 코드 매핑 데이터 (파이프 구분) +# code|label|value +01|승인한도 접수|R +02|승인한도 완료|M +03|승인한도 불일치|U +04|승인한도 정산|S diff --git a/config/au_cfg_0004.cfg b/config/au_cfg_0004.cfg new file mode 100644 index 0000000..3c0b0c2 --- /dev/null +++ b/config/au_cfg_0004.cfg @@ -0,0 +1,15 @@ +# au_cfg_0004.cfg - @KMOD@ 런타임 설정 (medium) +[general] +module = au +transform = authorization +tier = medium + +[db] +dsn = acquire@localhost +schema = public +fetch_size = 1000 + +[limits] +daily_cap = 100000000 +single_cap = 50000000 +fee_rate_bp = 250 diff --git a/config/au_cfg_0005.ubb b/config/au_cfg_0005.ubb new file mode 100644 index 0000000..604fac7 --- /dev/null +++ b/config/au_cfg_0005.ubb @@ -0,0 +1,22 @@ +# +# au_cfg_0005.ubb - 승인한도 TP 도메인 구성 (Tuxedo UBBCONFIG 형식, 참고) +# +*RESOURCES + IPCKEY 70045 + MASTER SITE1 + MODEL SHM + LDBAL Y + +*MACHINES + "acqhost" LMID=SITE1 + APPDIR="/app/acquire-core" + TUXCONFIG="/app/acquire-core/tuxconfig" + +*GROUPS + GRP_AU LMID=SITE1 GRPNO=16 + +*SERVERS + AU_SVR SRVGRP=GRP_AU SRVID=16 CLOPT="-A" + +*SERVICES + AU_SVC LOAD=50 PRIO=50 diff --git a/config/au_cfg_0006.dat b/config/au_cfg_0006.dat new file mode 100644 index 0000000..3aebca5 --- /dev/null +++ b/config/au_cfg_0006.dat @@ -0,0 +1,6 @@ +# au_cfg_0006.dat - 승인한도 코드 매핑 데이터 (파이프 구분) +# code|label|value +01|승인한도 접수|R +02|승인한도 완료|M +03|승인한도 불일치|U +04|승인한도 정산|S diff --git a/config/cl_cfg_0001.cfg b/config/cl_cfg_0001.cfg new file mode 100644 index 0000000..8cc1904 --- /dev/null +++ b/config/cl_cfg_0001.cfg @@ -0,0 +1,15 @@ +# cl_cfg_0001.cfg - @KMOD@ 런타임 설정 (easy) +[general] +module = cl +transform = closing +tier = easy + +[db] +dsn = acquire@localhost +schema = public +fetch_size = 1000 + +[limits] +daily_cap = 100000000 +single_cap = 50000000 +fee_rate_bp = 250 diff --git a/config/cl_cfg_0002.ubb b/config/cl_cfg_0002.ubb new file mode 100644 index 0000000..0be0527 --- /dev/null +++ b/config/cl_cfg_0002.ubb @@ -0,0 +1,22 @@ +# +# cl_cfg_0002.ubb - 마감 TP 도메인 구성 (Tuxedo UBBCONFIG 형식, 참고) +# +*RESOURCES + IPCKEY 70021 + MASTER SITE1 + MODEL SHM + LDBAL Y + +*MACHINES + "acqhost" LMID=SITE1 + APPDIR="/app/acquire-core" + TUXCONFIG="/app/acquire-core/tuxconfig" + +*GROUPS + GRP_CL LMID=SITE1 GRPNO=22 + +*SERVERS + CL_SVR SRVGRP=GRP_CL SRVID=22 CLOPT="-A" + +*SERVICES + CL_SVC LOAD=50 PRIO=50 diff --git a/config/cl_cfg_0003.dat b/config/cl_cfg_0003.dat new file mode 100644 index 0000000..7e0c30d --- /dev/null +++ b/config/cl_cfg_0003.dat @@ -0,0 +1,6 @@ +# cl_cfg_0003.dat - 마감 코드 매핑 데이터 (파이프 구분) +# code|label|value +01|마감 접수|R +02|마감 완료|M +03|마감 불일치|U +04|마감 정산|S diff --git a/config/cl_cfg_0004.cfg b/config/cl_cfg_0004.cfg new file mode 100644 index 0000000..2cd9f27 --- /dev/null +++ b/config/cl_cfg_0004.cfg @@ -0,0 +1,15 @@ +# cl_cfg_0004.cfg - @KMOD@ 런타임 설정 (easy) +[general] +module = cl +transform = closing +tier = easy + +[db] +dsn = acquire@localhost +schema = public +fetch_size = 1000 + +[limits] +daily_cap = 100000000 +single_cap = 50000000 +fee_rate_bp = 250 diff --git a/config/cl_cfg_0005.ubb b/config/cl_cfg_0005.ubb new file mode 100644 index 0000000..2c14fa3 --- /dev/null +++ b/config/cl_cfg_0005.ubb @@ -0,0 +1,22 @@ +# +# cl_cfg_0005.ubb - 마감 TP 도메인 구성 (Tuxedo UBBCONFIG 형식, 참고) +# +*RESOURCES + IPCKEY 70054 + MASTER SITE1 + MODEL SHM + LDBAL Y + +*MACHINES + "acqhost" LMID=SITE1 + APPDIR="/app/acquire-core" + TUXCONFIG="/app/acquire-core/tuxconfig" + +*GROUPS + GRP_CL LMID=SITE1 GRPNO=25 + +*SERVERS + CL_SVR SRVGRP=GRP_CL SRVID=25 CLOPT="-A" + +*SERVICES + CL_SVC LOAD=50 PRIO=50 diff --git a/config/cm_cfg_0001.ubb b/config/cm_cfg_0001.ubb new file mode 100644 index 0000000..efebdb1 --- /dev/null +++ b/config/cm_cfg_0001.ubb @@ -0,0 +1,22 @@ +# +# cm_cfg_0001.ubb - 공통 TP 도메인 구성 (Tuxedo UBBCONFIG 형식, 참고) +# +*RESOURCES + IPCKEY 70009 + MASTER SITE1 + MODEL SHM + LDBAL Y + +*MACHINES + "acqhost" LMID=SITE1 + APPDIR="/app/acquire-core" + TUXCONFIG="/app/acquire-core/tuxconfig" + +*GROUPS + GRP_CM LMID=SITE1 GRPNO=10 + +*SERVERS + CM_SVR SRVGRP=GRP_CM SRVID=10 CLOPT="-A" + +*SERVICES + CM_SVC LOAD=50 PRIO=50 diff --git a/config/cm_cfg_0002.dat b/config/cm_cfg_0002.dat new file mode 100644 index 0000000..91f56b3 --- /dev/null +++ b/config/cm_cfg_0002.dat @@ -0,0 +1,6 @@ +# cm_cfg_0002.dat - 공통 코드 매핑 데이터 (파이프 구분) +# code|label|value +01|공통 접수|R +02|공통 완료|M +03|공통 불일치|U +04|공통 정산|S diff --git a/config/cm_cfg_0003.cfg b/config/cm_cfg_0003.cfg new file mode 100644 index 0000000..b10e410 --- /dev/null +++ b/config/cm_cfg_0003.cfg @@ -0,0 +1,15 @@ +# cm_cfg_0003.cfg - @KMOD@ 런타임 설정 (medium) +[general] +module = cm +transform = common +tier = medium + +[db] +dsn = acquire@localhost +schema = public +fetch_size = 1000 + +[limits] +daily_cap = 100000000 +single_cap = 50000000 +fee_rate_bp = 250 diff --git a/config/cm_cfg_0004.ubb b/config/cm_cfg_0004.ubb new file mode 100644 index 0000000..5d523f2 --- /dev/null +++ b/config/cm_cfg_0004.ubb @@ -0,0 +1,22 @@ +# +# cm_cfg_0004.ubb - 공통 TP 도메인 구성 (Tuxedo UBBCONFIG 형식, 참고) +# +*RESOURCES + IPCKEY 70042 + MASTER SITE1 + MODEL SHM + LDBAL Y + +*MACHINES + "acqhost" LMID=SITE1 + APPDIR="/app/acquire-core" + TUXCONFIG="/app/acquire-core/tuxconfig" + +*GROUPS + GRP_CM LMID=SITE1 GRPNO=13 + +*SERVERS + CM_SVR SRVGRP=GRP_CM SRVID=13 CLOPT="-A" + +*SERVICES + CM_SVC LOAD=50 PRIO=50 diff --git a/config/cm_cfg_0005.dat b/config/cm_cfg_0005.dat new file mode 100644 index 0000000..e215c1c --- /dev/null +++ b/config/cm_cfg_0005.dat @@ -0,0 +1,6 @@ +# cm_cfg_0005.dat - 공통 코드 매핑 데이터 (파이프 구분) +# code|label|value +01|공통 접수|R +02|공통 완료|M +03|공통 불일치|U +04|공통 정산|S diff --git a/config/lg_cfg_0001.cfg b/config/lg_cfg_0001.cfg new file mode 100644 index 0000000..c249b69 --- /dev/null +++ b/config/lg_cfg_0001.cfg @@ -0,0 +1,15 @@ +# lg_cfg_0001.cfg - @KMOD@ 런타임 설정 (easy) +[general] +module = lg +transform = ledger +tier = easy + +[db] +dsn = acquire@localhost +schema = public +fetch_size = 1000 + +[limits] +daily_cap = 100000000 +single_cap = 50000000 +fee_rate_bp = 250 diff --git a/config/lg_cfg_0002.ubb b/config/lg_cfg_0002.ubb new file mode 100644 index 0000000..a4d6630 --- /dev/null +++ b/config/lg_cfg_0002.ubb @@ -0,0 +1,22 @@ +# +# lg_cfg_0002.ubb - 원장 TP 도메인 구성 (Tuxedo UBBCONFIG 형식, 참고) +# +*RESOURCES + IPCKEY 70018 + MASTER SITE1 + MODEL SHM + LDBAL Y + +*MACHINES + "acqhost" LMID=SITE1 + APPDIR="/app/acquire-core" + TUXCONFIG="/app/acquire-core/tuxconfig" + +*GROUPS + GRP_LG LMID=SITE1 GRPNO=19 + +*SERVERS + LG_SVR SRVGRP=GRP_LG SRVID=19 CLOPT="-A" + +*SERVICES + LG_SVC LOAD=50 PRIO=50 diff --git a/config/lg_cfg_0003.dat b/config/lg_cfg_0003.dat new file mode 100644 index 0000000..76731b5 --- /dev/null +++ b/config/lg_cfg_0003.dat @@ -0,0 +1,6 @@ +# lg_cfg_0003.dat - 원장 코드 매핑 데이터 (파이프 구분) +# code|label|value +01|원장 접수|R +02|원장 완료|M +03|원장 불일치|U +04|원장 정산|S diff --git a/config/lg_cfg_0004.cfg b/config/lg_cfg_0004.cfg new file mode 100644 index 0000000..3a7bf23 --- /dev/null +++ b/config/lg_cfg_0004.cfg @@ -0,0 +1,15 @@ +# lg_cfg_0004.cfg - @KMOD@ 런타임 설정 (easy) +[general] +module = lg +transform = ledger +tier = easy + +[db] +dsn = acquire@localhost +schema = public +fetch_size = 1000 + +[limits] +daily_cap = 100000000 +single_cap = 50000000 +fee_rate_bp = 250 diff --git a/config/lg_cfg_0005.ubb b/config/lg_cfg_0005.ubb new file mode 100644 index 0000000..ce580be --- /dev/null +++ b/config/lg_cfg_0005.ubb @@ -0,0 +1,22 @@ +# +# lg_cfg_0005.ubb - 원장 TP 도메인 구성 (Tuxedo UBBCONFIG 형식, 참고) +# +*RESOURCES + IPCKEY 70051 + MASTER SITE1 + MODEL SHM + LDBAL Y + +*MACHINES + "acqhost" LMID=SITE1 + APPDIR="/app/acquire-core" + TUXCONFIG="/app/acquire-core/tuxconfig" + +*GROUPS + GRP_LG LMID=SITE1 GRPNO=22 + +*SERVERS + LG_SVR SRVGRP=GRP_LG SRVID=22 CLOPT="-A" + +*SERVICES + LG_SVC LOAD=50 PRIO=50 diff --git a/config/mg_cfg_0001.ubb b/config/mg_cfg_0001.ubb new file mode 100644 index 0000000..28b3495 --- /dev/null +++ b/config/mg_cfg_0001.ubb @@ -0,0 +1,22 @@ +# +# mg_cfg_0001.ubb - 전문게이트웨이 TP 도메인 구성 (Tuxedo UBBCONFIG 형식, 참고) +# +*RESOURCES + IPCKEY 70000 + MASTER SITE1 + MODEL SHM + LDBAL Y + +*MACHINES + "acqhost" LMID=SITE1 + APPDIR="/app/acquire-core" + TUXCONFIG="/app/acquire-core/tuxconfig" + +*GROUPS + GRP_MG LMID=SITE1 GRPNO=1 + +*SERVERS + MG_SVR SRVGRP=GRP_MG SRVID=1 CLOPT="-A" + +*SERVICES + MG_SVC LOAD=50 PRIO=50 diff --git a/config/mg_cfg_0002.dat b/config/mg_cfg_0002.dat new file mode 100644 index 0000000..de0c0c4 --- /dev/null +++ b/config/mg_cfg_0002.dat @@ -0,0 +1,6 @@ +# mg_cfg_0002.dat - 전문게이트웨이 코드 매핑 데이터 (파이프 구분) +# code|label|value +01|전문게이트웨이 접수|R +02|전문게이트웨이 완료|M +03|전문게이트웨이 불일치|U +04|전문게이트웨이 정산|S diff --git a/config/mg_cfg_0003.cfg b/config/mg_cfg_0003.cfg new file mode 100644 index 0000000..608a750 --- /dev/null +++ b/config/mg_cfg_0003.cfg @@ -0,0 +1,15 @@ +# mg_cfg_0003.cfg - @KMOD@ 런타임 설정 (easy) +[general] +module = mg +transform = msg-gateway +tier = easy + +[db] +dsn = acquire@localhost +schema = public +fetch_size = 1000 + +[limits] +daily_cap = 100000000 +single_cap = 50000000 +fee_rate_bp = 250 diff --git a/config/mg_cfg_0004.ubb b/config/mg_cfg_0004.ubb new file mode 100644 index 0000000..18dcd3e --- /dev/null +++ b/config/mg_cfg_0004.ubb @@ -0,0 +1,22 @@ +# +# mg_cfg_0004.ubb - 전문게이트웨이 TP 도메인 구성 (Tuxedo UBBCONFIG 형식, 참고) +# +*RESOURCES + IPCKEY 70033 + MASTER SITE1 + MODEL SHM + LDBAL Y + +*MACHINES + "acqhost" LMID=SITE1 + APPDIR="/app/acquire-core" + TUXCONFIG="/app/acquire-core/tuxconfig" + +*GROUPS + GRP_MG LMID=SITE1 GRPNO=4 + +*SERVERS + MG_SVR SRVGRP=GRP_MG SRVID=4 CLOPT="-A" + +*SERVICES + MG_SVC LOAD=50 PRIO=50 diff --git a/config/mg_cfg_0005.dat b/config/mg_cfg_0005.dat new file mode 100644 index 0000000..6785216 --- /dev/null +++ b/config/mg_cfg_0005.dat @@ -0,0 +1,6 @@ +# mg_cfg_0005.dat - 전문게이트웨이 코드 매핑 데이터 (파이프 구분) +# code|label|value +01|전문게이트웨이 접수|R +02|전문게이트웨이 완료|M +03|전문게이트웨이 불일치|U +04|전문게이트웨이 정산|S diff --git a/config/mg_cfg_0006.cfg b/config/mg_cfg_0006.cfg new file mode 100644 index 0000000..14c2f66 --- /dev/null +++ b/config/mg_cfg_0006.cfg @@ -0,0 +1,15 @@ +# mg_cfg_0006.cfg - @KMOD@ 런타임 설정 (medium) +[general] +module = mg +transform = msg-gateway +tier = medium + +[db] +dsn = acquire@localhost +schema = public +fetch_size = 1000 + +[limits] +daily_cap = 100000000 +single_cap = 50000000 +fee_rate_bp = 250 diff --git a/config/mm_cfg_0001.dat b/config/mm_cfg_0001.dat new file mode 100644 index 0000000..f8838d2 --- /dev/null +++ b/config/mm_cfg_0001.dat @@ -0,0 +1,6 @@ +# mm_cfg_0001.dat - 마스터 코드 매핑 데이터 (파이프 구분) +# code|label|value +01|마스터 접수|R +02|마스터 완료|M +03|마스터 불일치|U +04|마스터 정산|S diff --git a/config/mm_cfg_0002.cfg b/config/mm_cfg_0002.cfg new file mode 100644 index 0000000..45e4fc3 --- /dev/null +++ b/config/mm_cfg_0002.cfg @@ -0,0 +1,15 @@ +# mm_cfg_0002.cfg - @KMOD@ 런타임 설정 (hard) +[general] +module = mm +transform = master +tier = hard + +[db] +dsn = acquire@localhost +schema = public +fetch_size = 1000 + +[limits] +daily_cap = 100000000 +single_cap = 50000000 +fee_rate_bp = 250 diff --git a/config/mm_cfg_0003.ubb b/config/mm_cfg_0003.ubb new file mode 100644 index 0000000..a2306ec --- /dev/null +++ b/config/mm_cfg_0003.ubb @@ -0,0 +1,22 @@ +# +# mm_cfg_0003.ubb - 마스터 TP 도메인 구성 (Tuxedo UBBCONFIG 형식, 참고) +# +*RESOURCES + IPCKEY 70030 + MASTER SITE1 + MODEL SHM + LDBAL Y + +*MACHINES + "acqhost" LMID=SITE1 + APPDIR="/app/acquire-core" + TUXCONFIG="/app/acquire-core/tuxconfig" + +*GROUPS + GRP_MM LMID=SITE1 GRPNO=1 + +*SERVERS + MM_SVR SRVGRP=GRP_MM SRVID=1 CLOPT="-A" + +*SERVICES + MM_SVC LOAD=50 PRIO=50 diff --git a/config/mm_cfg_0004.dat b/config/mm_cfg_0004.dat new file mode 100644 index 0000000..ad8c019 --- /dev/null +++ b/config/mm_cfg_0004.dat @@ -0,0 +1,6 @@ +# mm_cfg_0004.dat - 마스터 코드 매핑 데이터 (파이프 구분) +# code|label|value +01|마스터 접수|R +02|마스터 완료|M +03|마스터 불일치|U +04|마스터 정산|S diff --git a/config/mm_cfg_0005.cfg b/config/mm_cfg_0005.cfg new file mode 100644 index 0000000..11e3eeb --- /dev/null +++ b/config/mm_cfg_0005.cfg @@ -0,0 +1,15 @@ +# mm_cfg_0005.cfg - @KMOD@ 런타임 설정 (medium) +[general] +module = mm +transform = master +tier = medium + +[db] +dsn = acquire@localhost +schema = public +fetch_size = 1000 + +[limits] +daily_cap = 100000000 +single_cap = 50000000 +fee_rate_bp = 250 diff --git a/config/py_cfg_0001.ubb b/config/py_cfg_0001.ubb new file mode 100644 index 0000000..0edfc04 --- /dev/null +++ b/config/py_cfg_0001.ubb @@ -0,0 +1,22 @@ +# +# py_cfg_0001.ubb - 지급 TP 도메인 구성 (Tuxedo UBBCONFIG 형식, 참고) +# +*RESOURCES + IPCKEY 70006 + MASTER SITE1 + MODEL SHM + LDBAL Y + +*MACHINES + "acqhost" LMID=SITE1 + APPDIR="/app/acquire-core" + TUXCONFIG="/app/acquire-core/tuxconfig" + +*GROUPS + GRP_PY LMID=SITE1 GRPNO=7 + +*SERVERS + PY_SVR SRVGRP=GRP_PY SRVID=7 CLOPT="-A" + +*SERVICES + PY_SVC LOAD=50 PRIO=50 diff --git a/config/py_cfg_0002.dat b/config/py_cfg_0002.dat new file mode 100644 index 0000000..ec4ee71 --- /dev/null +++ b/config/py_cfg_0002.dat @@ -0,0 +1,6 @@ +# py_cfg_0002.dat - 지급 코드 매핑 데이터 (파이프 구분) +# code|label|value +01|지급 접수|R +02|지급 완료|M +03|지급 불일치|U +04|지급 정산|S diff --git a/config/py_cfg_0003.cfg b/config/py_cfg_0003.cfg new file mode 100644 index 0000000..2cdd3c8 --- /dev/null +++ b/config/py_cfg_0003.cfg @@ -0,0 +1,15 @@ +# py_cfg_0003.cfg - @KMOD@ 런타임 설정 (easy) +[general] +module = py +transform = payment +tier = easy + +[db] +dsn = acquire@localhost +schema = public +fetch_size = 1000 + +[limits] +daily_cap = 100000000 +single_cap = 50000000 +fee_rate_bp = 250 diff --git a/config/py_cfg_0004.ubb b/config/py_cfg_0004.ubb new file mode 100644 index 0000000..8955468 --- /dev/null +++ b/config/py_cfg_0004.ubb @@ -0,0 +1,22 @@ +# +# py_cfg_0004.ubb - 지급 TP 도메인 구성 (Tuxedo UBBCONFIG 형식, 참고) +# +*RESOURCES + IPCKEY 70039 + MASTER SITE1 + MODEL SHM + LDBAL Y + +*MACHINES + "acqhost" LMID=SITE1 + APPDIR="/app/acquire-core" + TUXCONFIG="/app/acquire-core/tuxconfig" + +*GROUPS + GRP_PY LMID=SITE1 GRPNO=10 + +*SERVERS + PY_SVR SRVGRP=GRP_PY SRVID=10 CLOPT="-A" + +*SERVICES + PY_SVC LOAD=50 PRIO=50 diff --git a/config/py_cfg_0005.dat b/config/py_cfg_0005.dat new file mode 100644 index 0000000..a9202f7 --- /dev/null +++ b/config/py_cfg_0005.dat @@ -0,0 +1,6 @@ +# py_cfg_0005.dat - 지급 코드 매핑 데이터 (파이프 구분) +# code|label|value +01|지급 접수|R +02|지급 완료|M +03|지급 불일치|U +04|지급 정산|S diff --git a/config/rc_cfg_0001.ubb b/config/rc_cfg_0001.ubb new file mode 100644 index 0000000..073b885 --- /dev/null +++ b/config/rc_cfg_0001.ubb @@ -0,0 +1,22 @@ +# +# rc_cfg_0001.ubb - 대사 TP 도메인 구성 (Tuxedo UBBCONFIG 형식, 참고) +# +*RESOURCES + IPCKEY 70003 + MASTER SITE1 + MODEL SHM + LDBAL Y + +*MACHINES + "acqhost" LMID=SITE1 + APPDIR="/app/acquire-core" + TUXCONFIG="/app/acquire-core/tuxconfig" + +*GROUPS + GRP_RC LMID=SITE1 GRPNO=4 + +*SERVERS + RC_SVR SRVGRP=GRP_RC SRVID=4 CLOPT="-A" + +*SERVICES + RC_SVC LOAD=50 PRIO=50 diff --git a/config/rc_cfg_0002.dat b/config/rc_cfg_0002.dat new file mode 100644 index 0000000..38feda9 --- /dev/null +++ b/config/rc_cfg_0002.dat @@ -0,0 +1,6 @@ +# rc_cfg_0002.dat - 대사 코드 매핑 데이터 (파이프 구분) +# code|label|value +01|대사 접수|R +02|대사 완료|M +03|대사 불일치|U +04|대사 정산|S diff --git a/config/rc_cfg_0003.cfg b/config/rc_cfg_0003.cfg new file mode 100644 index 0000000..bf09d2f --- /dev/null +++ b/config/rc_cfg_0003.cfg @@ -0,0 +1,15 @@ +# rc_cfg_0003.cfg - @KMOD@ 런타임 설정 (easy) +[general] +module = rc +transform = reconciliation +tier = easy + +[db] +dsn = acquire@localhost +schema = public +fetch_size = 1000 + +[limits] +daily_cap = 100000000 +single_cap = 50000000 +fee_rate_bp = 250 diff --git a/config/rc_cfg_0004.ubb b/config/rc_cfg_0004.ubb new file mode 100644 index 0000000..35a83a0 --- /dev/null +++ b/config/rc_cfg_0004.ubb @@ -0,0 +1,22 @@ +# +# rc_cfg_0004.ubb - 대사 TP 도메인 구성 (Tuxedo UBBCONFIG 형식, 참고) +# +*RESOURCES + IPCKEY 70036 + MASTER SITE1 + MODEL SHM + LDBAL Y + +*MACHINES + "acqhost" LMID=SITE1 + APPDIR="/app/acquire-core" + TUXCONFIG="/app/acquire-core/tuxconfig" + +*GROUPS + GRP_RC LMID=SITE1 GRPNO=7 + +*SERVERS + RC_SVR SRVGRP=GRP_RC SRVID=7 CLOPT="-A" + +*SERVICES + RC_SVC LOAD=50 PRIO=50 diff --git a/config/rc_cfg_0005.dat b/config/rc_cfg_0005.dat new file mode 100644 index 0000000..650c76c --- /dev/null +++ b/config/rc_cfg_0005.dat @@ -0,0 +1,6 @@ +# rc_cfg_0005.dat - 대사 코드 매핑 데이터 (파이프 구분) +# code|label|value +01|대사 접수|R +02|대사 완료|M +03|대사 불일치|U +04|대사 정산|S diff --git a/config/rc_cfg_0006.cfg b/config/rc_cfg_0006.cfg new file mode 100644 index 0000000..53e50fa --- /dev/null +++ b/config/rc_cfg_0006.cfg @@ -0,0 +1,15 @@ +# rc_cfg_0006.cfg - @KMOD@ 런타임 설정 (hard) +[general] +module = rc +transform = reconciliation +tier = hard + +[db] +dsn = acquire@localhost +schema = public +fetch_size = 1000 + +[limits] +daily_cap = 100000000 +single_cap = 50000000 +fee_rate_bp = 250 diff --git a/config/st_cfg_0001.dat b/config/st_cfg_0001.dat new file mode 100644 index 0000000..fcf1b0b --- /dev/null +++ b/config/st_cfg_0001.dat @@ -0,0 +1,6 @@ +# st_cfg_0001.dat - 정산수수료 코드 매핑 데이터 (파이프 구분) +# code|label|value +01|정산수수료 접수|R +02|정산수수료 완료|M +03|정산수수료 불일치|U +04|정산수수료 정산|S diff --git a/config/st_cfg_0002.cfg b/config/st_cfg_0002.cfg new file mode 100644 index 0000000..172fb57 --- /dev/null +++ b/config/st_cfg_0002.cfg @@ -0,0 +1,15 @@ +# st_cfg_0002.cfg - @KMOD@ 런타임 설정 (medium) +[general] +module = st +transform = settlement +tier = medium + +[db] +dsn = acquire@localhost +schema = public +fetch_size = 1000 + +[limits] +daily_cap = 100000000 +single_cap = 50000000 +fee_rate_bp = 250 diff --git a/config/st_cfg_0003.ubb b/config/st_cfg_0003.ubb new file mode 100644 index 0000000..3571150 --- /dev/null +++ b/config/st_cfg_0003.ubb @@ -0,0 +1,22 @@ +# +# st_cfg_0003.ubb - 정산수수료 TP 도메인 구성 (Tuxedo UBBCONFIG 형식, 참고) +# +*RESOURCES + IPCKEY 70027 + MASTER SITE1 + MODEL SHM + LDBAL Y + +*MACHINES + "acqhost" LMID=SITE1 + APPDIR="/app/acquire-core" + TUXCONFIG="/app/acquire-core/tuxconfig" + +*GROUPS + GRP_ST LMID=SITE1 GRPNO=28 + +*SERVERS + ST_SVR SRVGRP=GRP_ST SRVID=28 CLOPT="-A" + +*SERVICES + ST_SVC LOAD=50 PRIO=50 diff --git a/config/st_cfg_0004.dat b/config/st_cfg_0004.dat new file mode 100644 index 0000000..9e8fe24 --- /dev/null +++ b/config/st_cfg_0004.dat @@ -0,0 +1,6 @@ +# st_cfg_0004.dat - 정산수수료 코드 매핑 데이터 (파이프 구분) +# code|label|value +01|정산수수료 접수|R +02|정산수수료 완료|M +03|정산수수료 불일치|U +04|정산수수료 정산|S diff --git a/config/st_cfg_0005.cfg b/config/st_cfg_0005.cfg new file mode 100644 index 0000000..285a5cc --- /dev/null +++ b/config/st_cfg_0005.cfg @@ -0,0 +1,15 @@ +# st_cfg_0005.cfg - @KMOD@ 런타임 설정 (easy) +[general] +module = st +transform = settlement +tier = easy + +[db] +dsn = acquire@localhost +schema = public +fetch_size = 1000 + +[limits] +daily_cap = 100000000 +single_cap = 50000000 +fee_rate_bp = 250 diff --git a/config/vl_cfg_0001.cfg b/config/vl_cfg_0001.cfg new file mode 100644 index 0000000..c8c0b21 --- /dev/null +++ b/config/vl_cfg_0001.cfg @@ -0,0 +1,15 @@ +# vl_cfg_0001.cfg - @KMOD@ 런타임 설정 (easy) +[general] +module = vl +transform = validation +tier = easy + +[db] +dsn = acquire@localhost +schema = public +fetch_size = 1000 + +[limits] +daily_cap = 100000000 +single_cap = 50000000 +fee_rate_bp = 250 diff --git a/config/vl_cfg_0002.ubb b/config/vl_cfg_0002.ubb new file mode 100644 index 0000000..5553bcd --- /dev/null +++ b/config/vl_cfg_0002.ubb @@ -0,0 +1,22 @@ +# +# vl_cfg_0002.ubb - 정합성 TP 도메인 구성 (Tuxedo UBBCONFIG 형식, 참고) +# +*RESOURCES + IPCKEY 70015 + MASTER SITE1 + MODEL SHM + LDBAL Y + +*MACHINES + "acqhost" LMID=SITE1 + APPDIR="/app/acquire-core" + TUXCONFIG="/app/acquire-core/tuxconfig" + +*GROUPS + GRP_VL LMID=SITE1 GRPNO=16 + +*SERVERS + VL_SVR SRVGRP=GRP_VL SRVID=16 CLOPT="-A" + +*SERVICES + VL_SVC LOAD=50 PRIO=50 diff --git a/config/vl_cfg_0003.dat b/config/vl_cfg_0003.dat new file mode 100644 index 0000000..55cf0a3 --- /dev/null +++ b/config/vl_cfg_0003.dat @@ -0,0 +1,6 @@ +# vl_cfg_0003.dat - 정합성 코드 매핑 데이터 (파이프 구분) +# code|label|value +01|정합성 접수|R +02|정합성 완료|M +03|정합성 불일치|U +04|정합성 정산|S diff --git a/config/vl_cfg_0004.cfg b/config/vl_cfg_0004.cfg new file mode 100644 index 0000000..7a7f578 --- /dev/null +++ b/config/vl_cfg_0004.cfg @@ -0,0 +1,15 @@ +# vl_cfg_0004.cfg - @KMOD@ 런타임 설정 (hard) +[general] +module = vl +transform = validation +tier = hard + +[db] +dsn = acquire@localhost +schema = public +fetch_size = 1000 + +[limits] +daily_cap = 100000000 +single_cap = 50000000 +fee_rate_bp = 250 diff --git a/config/vl_cfg_0005.ubb b/config/vl_cfg_0005.ubb new file mode 100644 index 0000000..8fe7988 --- /dev/null +++ b/config/vl_cfg_0005.ubb @@ -0,0 +1,22 @@ +# +# vl_cfg_0005.ubb - 정합성 TP 도메인 구성 (Tuxedo UBBCONFIG 형식, 참고) +# +*RESOURCES + IPCKEY 70048 + MASTER SITE1 + MODEL SHM + LDBAL Y + +*MACHINES + "acqhost" LMID=SITE1 + APPDIR="/app/acquire-core" + TUXCONFIG="/app/acquire-core/tuxconfig" + +*GROUPS + GRP_VL LMID=SITE1 GRPNO=19 + +*SERVERS + VL_SVR SRVGRP=GRP_VL SRVID=19 CLOPT="-A" + +*SERVICES + VL_SVC LOAD=50 PRIO=50 diff --git a/config/vl_cfg_0006.dat b/config/vl_cfg_0006.dat new file mode 100644 index 0000000..d902498 --- /dev/null +++ b/config/vl_cfg_0006.dat @@ -0,0 +1,6 @@ +# vl_cfg_0006.dat - 정합성 코드 매핑 데이터 (파이프 구분) +# code|label|value +01|정합성 접수|R +02|정합성 완료|M +03|정합성 불일치|U +04|정합성 정산|S diff --git a/db/ac_ddl_0001.sql b/db/ac_ddl_0001.sql new file mode 100644 index 0000000..197df3f --- /dev/null +++ b/db/ac_ddl_0001.sql @@ -0,0 +1,23 @@ +-- ac_ddl_0001.sql - 매입 DBIO 스키마/뷰 정의 (easy) +-- 런타임 PostgreSQL 에 적용. 컴파일에는 불필요. + +CREATE TABLE IF NOT EXISTS ac_ledger ( + key VARCHAR(15) NOT NULL, + merch_id VARCHAR(15) NOT NULL, + card_no VARCHAR(19) NOT NULL, + amount BIGINT NOT NULL DEFAULT 0, + biz_date CHAR(8) NOT NULL, + status CHAR(1) NOT NULL DEFAULT 'R', + fee BIGINT NOT NULL DEFAULT 0, + reg_ts TIMESTAMP NOT NULL DEFAULT now(), + upd_ts TIMESTAMP, + CONSTRAINT pk_ac_ledger PRIMARY KEY (key) +); + +CREATE INDEX IF NOT EXISTS ix_ac_ddl_0001_date_status + ON ac_ledger (biz_date, status); + +CREATE OR REPLACE VIEW ac_ddl_0001_daily_v AS + SELECT biz_date, status, count(*) AS cnt, sum(amount) AS total + FROM ac_ledger + GROUP BY biz_date, status; diff --git a/db/ac_ddl_0002.sql b/db/ac_ddl_0002.sql new file mode 100644 index 0000000..ee0b678 --- /dev/null +++ b/db/ac_ddl_0002.sql @@ -0,0 +1,23 @@ +-- ac_ddl_0002.sql - 매입 DBIO 스키마/뷰 정의 (medium) +-- 런타임 PostgreSQL 에 적용. 컴파일에는 불필요. + +CREATE TABLE IF NOT EXISTS ac_ledger ( + key VARCHAR(15) NOT NULL, + merch_id VARCHAR(15) NOT NULL, + card_no VARCHAR(19) NOT NULL, + amount BIGINT NOT NULL DEFAULT 0, + biz_date CHAR(8) NOT NULL, + status CHAR(1) NOT NULL DEFAULT 'R', + fee BIGINT NOT NULL DEFAULT 0, + reg_ts TIMESTAMP NOT NULL DEFAULT now(), + upd_ts TIMESTAMP, + CONSTRAINT pk_ac_ledger PRIMARY KEY (key) +); + +CREATE INDEX IF NOT EXISTS ix_ac_ddl_0002_date_status + ON ac_ledger (biz_date, status); + +CREATE OR REPLACE VIEW ac_ddl_0002_daily_v AS + SELECT biz_date, status, count(*) AS cnt, sum(amount) AS total + FROM ac_ledger + GROUP BY biz_date, status; diff --git a/db/ac_ddl_0003.sql b/db/ac_ddl_0003.sql new file mode 100644 index 0000000..76c8879 --- /dev/null +++ b/db/ac_ddl_0003.sql @@ -0,0 +1,23 @@ +-- ac_ddl_0003.sql - 매입 DBIO 스키마/뷰 정의 (easy) +-- 런타임 PostgreSQL 에 적용. 컴파일에는 불필요. + +CREATE TABLE IF NOT EXISTS ac_ledger ( + key VARCHAR(15) NOT NULL, + merch_id VARCHAR(15) NOT NULL, + card_no VARCHAR(19) NOT NULL, + amount BIGINT NOT NULL DEFAULT 0, + biz_date CHAR(8) NOT NULL, + status CHAR(1) NOT NULL DEFAULT 'R', + fee BIGINT NOT NULL DEFAULT 0, + reg_ts TIMESTAMP NOT NULL DEFAULT now(), + upd_ts TIMESTAMP, + CONSTRAINT pk_ac_ledger PRIMARY KEY (key) +); + +CREATE INDEX IF NOT EXISTS ix_ac_ddl_0003_date_status + ON ac_ledger (biz_date, status); + +CREATE OR REPLACE VIEW ac_ddl_0003_daily_v AS + SELECT biz_date, status, count(*) AS cnt, sum(amount) AS total + FROM ac_ledger + GROUP BY biz_date, status; diff --git a/db/ac_ddl_0004.sql b/db/ac_ddl_0004.sql new file mode 100644 index 0000000..bdb4413 --- /dev/null +++ b/db/ac_ddl_0004.sql @@ -0,0 +1,23 @@ +-- ac_ddl_0004.sql - 매입 DBIO 스키마/뷰 정의 (medium) +-- 런타임 PostgreSQL 에 적용. 컴파일에는 불필요. + +CREATE TABLE IF NOT EXISTS ac_ledger ( + key VARCHAR(15) NOT NULL, + merch_id VARCHAR(15) NOT NULL, + card_no VARCHAR(19) NOT NULL, + amount BIGINT NOT NULL DEFAULT 0, + biz_date CHAR(8) NOT NULL, + status CHAR(1) NOT NULL DEFAULT 'R', + fee BIGINT NOT NULL DEFAULT 0, + reg_ts TIMESTAMP NOT NULL DEFAULT now(), + upd_ts TIMESTAMP, + CONSTRAINT pk_ac_ledger PRIMARY KEY (key) +); + +CREATE INDEX IF NOT EXISTS ix_ac_ddl_0004_date_status + ON ac_ledger (biz_date, status); + +CREATE OR REPLACE VIEW ac_ddl_0004_daily_v AS + SELECT biz_date, status, count(*) AS cnt, sum(amount) AS total + FROM ac_ledger + GROUP BY biz_date, status; diff --git a/db/ac_ddl_0005.sql b/db/ac_ddl_0005.sql new file mode 100644 index 0000000..6b831c1 --- /dev/null +++ b/db/ac_ddl_0005.sql @@ -0,0 +1,23 @@ +-- ac_ddl_0005.sql - 매입 DBIO 스키마/뷰 정의 (easy) +-- 런타임 PostgreSQL 에 적용. 컴파일에는 불필요. + +CREATE TABLE IF NOT EXISTS ac_ledger ( + key VARCHAR(15) NOT NULL, + merch_id VARCHAR(15) NOT NULL, + card_no VARCHAR(19) NOT NULL, + amount BIGINT NOT NULL DEFAULT 0, + biz_date CHAR(8) NOT NULL, + status CHAR(1) NOT NULL DEFAULT 'R', + fee BIGINT NOT NULL DEFAULT 0, + reg_ts TIMESTAMP NOT NULL DEFAULT now(), + upd_ts TIMESTAMP, + CONSTRAINT pk_ac_ledger PRIMARY KEY (key) +); + +CREATE INDEX IF NOT EXISTS ix_ac_ddl_0005_date_status + ON ac_ledger (biz_date, status); + +CREATE OR REPLACE VIEW ac_ddl_0005_daily_v AS + SELECT biz_date, status, count(*) AS cnt, sum(amount) AS total + FROM ac_ledger + GROUP BY biz_date, status; diff --git a/db/au_ddl_0001.sql b/db/au_ddl_0001.sql new file mode 100644 index 0000000..d7f3a04 --- /dev/null +++ b/db/au_ddl_0001.sql @@ -0,0 +1,23 @@ +-- au_ddl_0001.sql - 승인한도 DBIO 스키마/뷰 정의 (easy) +-- 런타임 PostgreSQL 에 적용. 컴파일에는 불필요. + +CREATE TABLE IF NOT EXISTS au_ledger ( + key VARCHAR(15) NOT NULL, + merch_id VARCHAR(15) NOT NULL, + card_no VARCHAR(19) NOT NULL, + amount BIGINT NOT NULL DEFAULT 0, + biz_date CHAR(8) NOT NULL, + status CHAR(1) NOT NULL DEFAULT 'R', + fee BIGINT NOT NULL DEFAULT 0, + reg_ts TIMESTAMP NOT NULL DEFAULT now(), + upd_ts TIMESTAMP, + CONSTRAINT pk_au_ledger PRIMARY KEY (key) +); + +CREATE INDEX IF NOT EXISTS ix_au_ddl_0001_date_status + ON au_ledger (biz_date, status); + +CREATE OR REPLACE VIEW au_ddl_0001_daily_v AS + SELECT biz_date, status, count(*) AS cnt, sum(amount) AS total + FROM au_ledger + GROUP BY biz_date, status; diff --git a/db/au_ddl_0002.sql b/db/au_ddl_0002.sql new file mode 100644 index 0000000..e346e7d --- /dev/null +++ b/db/au_ddl_0002.sql @@ -0,0 +1,23 @@ +-- au_ddl_0002.sql - 승인한도 DBIO 스키마/뷰 정의 (medium) +-- 런타임 PostgreSQL 에 적용. 컴파일에는 불필요. + +CREATE TABLE IF NOT EXISTS au_ledger ( + key VARCHAR(15) NOT NULL, + merch_id VARCHAR(15) NOT NULL, + card_no VARCHAR(19) NOT NULL, + amount BIGINT NOT NULL DEFAULT 0, + biz_date CHAR(8) NOT NULL, + status CHAR(1) NOT NULL DEFAULT 'R', + fee BIGINT NOT NULL DEFAULT 0, + reg_ts TIMESTAMP NOT NULL DEFAULT now(), + upd_ts TIMESTAMP, + CONSTRAINT pk_au_ledger PRIMARY KEY (key) +); + +CREATE INDEX IF NOT EXISTS ix_au_ddl_0002_date_status + ON au_ledger (biz_date, status); + +CREATE OR REPLACE VIEW au_ddl_0002_daily_v AS + SELECT biz_date, status, count(*) AS cnt, sum(amount) AS total + FROM au_ledger + GROUP BY biz_date, status; diff --git a/db/au_ddl_0003.sql b/db/au_ddl_0003.sql new file mode 100644 index 0000000..825311e --- /dev/null +++ b/db/au_ddl_0003.sql @@ -0,0 +1,23 @@ +-- au_ddl_0003.sql - 승인한도 DBIO 스키마/뷰 정의 (easy) +-- 런타임 PostgreSQL 에 적용. 컴파일에는 불필요. + +CREATE TABLE IF NOT EXISTS au_ledger ( + key VARCHAR(15) NOT NULL, + merch_id VARCHAR(15) NOT NULL, + card_no VARCHAR(19) NOT NULL, + amount BIGINT NOT NULL DEFAULT 0, + biz_date CHAR(8) NOT NULL, + status CHAR(1) NOT NULL DEFAULT 'R', + fee BIGINT NOT NULL DEFAULT 0, + reg_ts TIMESTAMP NOT NULL DEFAULT now(), + upd_ts TIMESTAMP, + CONSTRAINT pk_au_ledger PRIMARY KEY (key) +); + +CREATE INDEX IF NOT EXISTS ix_au_ddl_0003_date_status + ON au_ledger (biz_date, status); + +CREATE OR REPLACE VIEW au_ddl_0003_daily_v AS + SELECT biz_date, status, count(*) AS cnt, sum(amount) AS total + FROM au_ledger + GROUP BY biz_date, status; diff --git a/db/au_ddl_0004.sql b/db/au_ddl_0004.sql new file mode 100644 index 0000000..5652aaf --- /dev/null +++ b/db/au_ddl_0004.sql @@ -0,0 +1,23 @@ +-- au_ddl_0004.sql - 승인한도 DBIO 스키마/뷰 정의 (medium) +-- 런타임 PostgreSQL 에 적용. 컴파일에는 불필요. + +CREATE TABLE IF NOT EXISTS au_ledger ( + key VARCHAR(15) NOT NULL, + merch_id VARCHAR(15) NOT NULL, + card_no VARCHAR(19) NOT NULL, + amount BIGINT NOT NULL DEFAULT 0, + biz_date CHAR(8) NOT NULL, + status CHAR(1) NOT NULL DEFAULT 'R', + fee BIGINT NOT NULL DEFAULT 0, + reg_ts TIMESTAMP NOT NULL DEFAULT now(), + upd_ts TIMESTAMP, + CONSTRAINT pk_au_ledger PRIMARY KEY (key) +); + +CREATE INDEX IF NOT EXISTS ix_au_ddl_0004_date_status + ON au_ledger (biz_date, status); + +CREATE OR REPLACE VIEW au_ddl_0004_daily_v AS + SELECT biz_date, status, count(*) AS cnt, sum(amount) AS total + FROM au_ledger + GROUP BY biz_date, status; diff --git a/db/au_ddl_0005.sql b/db/au_ddl_0005.sql new file mode 100644 index 0000000..3d39207 --- /dev/null +++ b/db/au_ddl_0005.sql @@ -0,0 +1,23 @@ +-- au_ddl_0005.sql - 승인한도 DBIO 스키마/뷰 정의 (easy) +-- 런타임 PostgreSQL 에 적용. 컴파일에는 불필요. + +CREATE TABLE IF NOT EXISTS au_ledger ( + key VARCHAR(15) NOT NULL, + merch_id VARCHAR(15) NOT NULL, + card_no VARCHAR(19) NOT NULL, + amount BIGINT NOT NULL DEFAULT 0, + biz_date CHAR(8) NOT NULL, + status CHAR(1) NOT NULL DEFAULT 'R', + fee BIGINT NOT NULL DEFAULT 0, + reg_ts TIMESTAMP NOT NULL DEFAULT now(), + upd_ts TIMESTAMP, + CONSTRAINT pk_au_ledger PRIMARY KEY (key) +); + +CREATE INDEX IF NOT EXISTS ix_au_ddl_0005_date_status + ON au_ledger (biz_date, status); + +CREATE OR REPLACE VIEW au_ddl_0005_daily_v AS + SELECT biz_date, status, count(*) AS cnt, sum(amount) AS total + FROM au_ledger + GROUP BY biz_date, status; diff --git a/db/cl_ddl_0001.sql b/db/cl_ddl_0001.sql new file mode 100644 index 0000000..aa696fc --- /dev/null +++ b/db/cl_ddl_0001.sql @@ -0,0 +1,23 @@ +-- cl_ddl_0001.sql - 마감 DBIO 스키마/뷰 정의 (easy) +-- 런타임 PostgreSQL 에 적용. 컴파일에는 불필요. + +CREATE TABLE IF NOT EXISTS cl_ledger ( + key VARCHAR(15) NOT NULL, + merch_id VARCHAR(15) NOT NULL, + card_no VARCHAR(19) NOT NULL, + amount BIGINT NOT NULL DEFAULT 0, + biz_date CHAR(8) NOT NULL, + status CHAR(1) NOT NULL DEFAULT 'R', + fee BIGINT NOT NULL DEFAULT 0, + reg_ts TIMESTAMP NOT NULL DEFAULT now(), + upd_ts TIMESTAMP, + CONSTRAINT pk_cl_ledger PRIMARY KEY (key) +); + +CREATE INDEX IF NOT EXISTS ix_cl_ddl_0001_date_status + ON cl_ledger (biz_date, status); + +CREATE OR REPLACE VIEW cl_ddl_0001_daily_v AS + SELECT biz_date, status, count(*) AS cnt, sum(amount) AS total + FROM cl_ledger + GROUP BY biz_date, status; diff --git a/db/cl_ddl_0002.sql b/db/cl_ddl_0002.sql new file mode 100644 index 0000000..361fc37 --- /dev/null +++ b/db/cl_ddl_0002.sql @@ -0,0 +1,23 @@ +-- cl_ddl_0002.sql - 마감 DBIO 스키마/뷰 정의 (easy) +-- 런타임 PostgreSQL 에 적용. 컴파일에는 불필요. + +CREATE TABLE IF NOT EXISTS cl_ledger ( + key VARCHAR(15) NOT NULL, + merch_id VARCHAR(15) NOT NULL, + card_no VARCHAR(19) NOT NULL, + amount BIGINT NOT NULL DEFAULT 0, + biz_date CHAR(8) NOT NULL, + status CHAR(1) NOT NULL DEFAULT 'R', + fee BIGINT NOT NULL DEFAULT 0, + reg_ts TIMESTAMP NOT NULL DEFAULT now(), + upd_ts TIMESTAMP, + CONSTRAINT pk_cl_ledger PRIMARY KEY (key) +); + +CREATE INDEX IF NOT EXISTS ix_cl_ddl_0002_date_status + ON cl_ledger (biz_date, status); + +CREATE OR REPLACE VIEW cl_ddl_0002_daily_v AS + SELECT biz_date, status, count(*) AS cnt, sum(amount) AS total + FROM cl_ledger + GROUP BY biz_date, status; diff --git a/db/cl_ddl_0003.sql b/db/cl_ddl_0003.sql new file mode 100644 index 0000000..a876389 --- /dev/null +++ b/db/cl_ddl_0003.sql @@ -0,0 +1,23 @@ +-- cl_ddl_0003.sql - 마감 DBIO 스키마/뷰 정의 (medium) +-- 런타임 PostgreSQL 에 적용. 컴파일에는 불필요. + +CREATE TABLE IF NOT EXISTS cl_ledger ( + key VARCHAR(15) NOT NULL, + merch_id VARCHAR(15) NOT NULL, + card_no VARCHAR(19) NOT NULL, + amount BIGINT NOT NULL DEFAULT 0, + biz_date CHAR(8) NOT NULL, + status CHAR(1) NOT NULL DEFAULT 'R', + fee BIGINT NOT NULL DEFAULT 0, + reg_ts TIMESTAMP NOT NULL DEFAULT now(), + upd_ts TIMESTAMP, + CONSTRAINT pk_cl_ledger PRIMARY KEY (key) +); + +CREATE INDEX IF NOT EXISTS ix_cl_ddl_0003_date_status + ON cl_ledger (biz_date, status); + +CREATE OR REPLACE VIEW cl_ddl_0003_daily_v AS + SELECT biz_date, status, count(*) AS cnt, sum(amount) AS total + FROM cl_ledger + GROUP BY biz_date, status; diff --git a/db/cl_ddl_0004.sql b/db/cl_ddl_0004.sql new file mode 100644 index 0000000..777787c --- /dev/null +++ b/db/cl_ddl_0004.sql @@ -0,0 +1,23 @@ +-- cl_ddl_0004.sql - 마감 DBIO 스키마/뷰 정의 (easy) +-- 런타임 PostgreSQL 에 적용. 컴파일에는 불필요. + +CREATE TABLE IF NOT EXISTS cl_ledger ( + key VARCHAR(15) NOT NULL, + merch_id VARCHAR(15) NOT NULL, + card_no VARCHAR(19) NOT NULL, + amount BIGINT NOT NULL DEFAULT 0, + biz_date CHAR(8) NOT NULL, + status CHAR(1) NOT NULL DEFAULT 'R', + fee BIGINT NOT NULL DEFAULT 0, + reg_ts TIMESTAMP NOT NULL DEFAULT now(), + upd_ts TIMESTAMP, + CONSTRAINT pk_cl_ledger PRIMARY KEY (key) +); + +CREATE INDEX IF NOT EXISTS ix_cl_ddl_0004_date_status + ON cl_ledger (biz_date, status); + +CREATE OR REPLACE VIEW cl_ddl_0004_daily_v AS + SELECT biz_date, status, count(*) AS cnt, sum(amount) AS total + FROM cl_ledger + GROUP BY biz_date, status; diff --git a/db/cm_ddl_0001.sql b/db/cm_ddl_0001.sql new file mode 100644 index 0000000..f1e5cac --- /dev/null +++ b/db/cm_ddl_0001.sql @@ -0,0 +1,23 @@ +-- cm_ddl_0001.sql - 공통 DBIO 스키마/뷰 정의 (easy) +-- 런타임 PostgreSQL 에 적용. 컴파일에는 불필요. + +CREATE TABLE IF NOT EXISTS cm_ledger ( + key VARCHAR(15) NOT NULL, + merch_id VARCHAR(15) NOT NULL, + card_no VARCHAR(19) NOT NULL, + amount BIGINT NOT NULL DEFAULT 0, + biz_date CHAR(8) NOT NULL, + status CHAR(1) NOT NULL DEFAULT 'R', + fee BIGINT NOT NULL DEFAULT 0, + reg_ts TIMESTAMP NOT NULL DEFAULT now(), + upd_ts TIMESTAMP, + CONSTRAINT pk_cm_ledger PRIMARY KEY (key) +); + +CREATE INDEX IF NOT EXISTS ix_cm_ddl_0001_date_status + ON cm_ledger (biz_date, status); + +CREATE OR REPLACE VIEW cm_ddl_0001_daily_v AS + SELECT biz_date, status, count(*) AS cnt, sum(amount) AS total + FROM cm_ledger + GROUP BY biz_date, status; diff --git a/db/cm_ddl_0002.sql b/db/cm_ddl_0002.sql new file mode 100644 index 0000000..324954e --- /dev/null +++ b/db/cm_ddl_0002.sql @@ -0,0 +1,23 @@ +-- cm_ddl_0002.sql - 공통 DBIO 스키마/뷰 정의 (easy) +-- 런타임 PostgreSQL 에 적용. 컴파일에는 불필요. + +CREATE TABLE IF NOT EXISTS cm_ledger ( + key VARCHAR(15) NOT NULL, + merch_id VARCHAR(15) NOT NULL, + card_no VARCHAR(19) NOT NULL, + amount BIGINT NOT NULL DEFAULT 0, + biz_date CHAR(8) NOT NULL, + status CHAR(1) NOT NULL DEFAULT 'R', + fee BIGINT NOT NULL DEFAULT 0, + reg_ts TIMESTAMP NOT NULL DEFAULT now(), + upd_ts TIMESTAMP, + CONSTRAINT pk_cm_ledger PRIMARY KEY (key) +); + +CREATE INDEX IF NOT EXISTS ix_cm_ddl_0002_date_status + ON cm_ledger (biz_date, status); + +CREATE OR REPLACE VIEW cm_ddl_0002_daily_v AS + SELECT biz_date, status, count(*) AS cnt, sum(amount) AS total + FROM cm_ledger + GROUP BY biz_date, status; diff --git a/db/cm_ddl_0003.sql b/db/cm_ddl_0003.sql new file mode 100644 index 0000000..5fc3502 --- /dev/null +++ b/db/cm_ddl_0003.sql @@ -0,0 +1,23 @@ +-- cm_ddl_0003.sql - 공통 DBIO 스키마/뷰 정의 (medium) +-- 런타임 PostgreSQL 에 적용. 컴파일에는 불필요. + +CREATE TABLE IF NOT EXISTS cm_ledger ( + key VARCHAR(15) NOT NULL, + merch_id VARCHAR(15) NOT NULL, + card_no VARCHAR(19) NOT NULL, + amount BIGINT NOT NULL DEFAULT 0, + biz_date CHAR(8) NOT NULL, + status CHAR(1) NOT NULL DEFAULT 'R', + fee BIGINT NOT NULL DEFAULT 0, + reg_ts TIMESTAMP NOT NULL DEFAULT now(), + upd_ts TIMESTAMP, + CONSTRAINT pk_cm_ledger PRIMARY KEY (key) +); + +CREATE INDEX IF NOT EXISTS ix_cm_ddl_0003_date_status + ON cm_ledger (biz_date, status); + +CREATE OR REPLACE VIEW cm_ddl_0003_daily_v AS + SELECT biz_date, status, count(*) AS cnt, sum(amount) AS total + FROM cm_ledger + GROUP BY biz_date, status; diff --git a/db/cm_ddl_0004.sql b/db/cm_ddl_0004.sql new file mode 100644 index 0000000..3c9abad --- /dev/null +++ b/db/cm_ddl_0004.sql @@ -0,0 +1,23 @@ +-- cm_ddl_0004.sql - 공통 DBIO 스키마/뷰 정의 (easy) +-- 런타임 PostgreSQL 에 적용. 컴파일에는 불필요. + +CREATE TABLE IF NOT EXISTS cm_ledger ( + key VARCHAR(15) NOT NULL, + merch_id VARCHAR(15) NOT NULL, + card_no VARCHAR(19) NOT NULL, + amount BIGINT NOT NULL DEFAULT 0, + biz_date CHAR(8) NOT NULL, + status CHAR(1) NOT NULL DEFAULT 'R', + fee BIGINT NOT NULL DEFAULT 0, + reg_ts TIMESTAMP NOT NULL DEFAULT now(), + upd_ts TIMESTAMP, + CONSTRAINT pk_cm_ledger PRIMARY KEY (key) +); + +CREATE INDEX IF NOT EXISTS ix_cm_ddl_0004_date_status + ON cm_ledger (biz_date, status); + +CREATE OR REPLACE VIEW cm_ddl_0004_daily_v AS + SELECT biz_date, status, count(*) AS cnt, sum(amount) AS total + FROM cm_ledger + GROUP BY biz_date, status; diff --git a/db/lg_ddl_0001.sql b/db/lg_ddl_0001.sql new file mode 100644 index 0000000..d378a8e --- /dev/null +++ b/db/lg_ddl_0001.sql @@ -0,0 +1,23 @@ +-- lg_ddl_0001.sql - 원장 DBIO 스키마/뷰 정의 (easy) +-- 런타임 PostgreSQL 에 적용. 컴파일에는 불필요. + +CREATE TABLE IF NOT EXISTS lg_ledger ( + key VARCHAR(15) NOT NULL, + merch_id VARCHAR(15) NOT NULL, + card_no VARCHAR(19) NOT NULL, + amount BIGINT NOT NULL DEFAULT 0, + biz_date CHAR(8) NOT NULL, + status CHAR(1) NOT NULL DEFAULT 'R', + fee BIGINT NOT NULL DEFAULT 0, + reg_ts TIMESTAMP NOT NULL DEFAULT now(), + upd_ts TIMESTAMP, + CONSTRAINT pk_lg_ledger PRIMARY KEY (key) +); + +CREATE INDEX IF NOT EXISTS ix_lg_ddl_0001_date_status + ON lg_ledger (biz_date, status); + +CREATE OR REPLACE VIEW lg_ddl_0001_daily_v AS + SELECT biz_date, status, count(*) AS cnt, sum(amount) AS total + FROM lg_ledger + GROUP BY biz_date, status; diff --git a/db/lg_ddl_0002.sql b/db/lg_ddl_0002.sql new file mode 100644 index 0000000..e70b091 --- /dev/null +++ b/db/lg_ddl_0002.sql @@ -0,0 +1,23 @@ +-- lg_ddl_0002.sql - 원장 DBIO 스키마/뷰 정의 (hard) +-- 런타임 PostgreSQL 에 적용. 컴파일에는 불필요. + +CREATE TABLE IF NOT EXISTS lg_ledger ( + key VARCHAR(15) NOT NULL, + merch_id VARCHAR(15) NOT NULL, + card_no VARCHAR(19) NOT NULL, + amount BIGINT NOT NULL DEFAULT 0, + biz_date CHAR(8) NOT NULL, + status CHAR(1) NOT NULL DEFAULT 'R', + fee BIGINT NOT NULL DEFAULT 0, + reg_ts TIMESTAMP NOT NULL DEFAULT now(), + upd_ts TIMESTAMP, + CONSTRAINT pk_lg_ledger PRIMARY KEY (key) +); + +CREATE INDEX IF NOT EXISTS ix_lg_ddl_0002_date_status + ON lg_ledger (biz_date, status); + +CREATE OR REPLACE VIEW lg_ddl_0002_daily_v AS + SELECT biz_date, status, count(*) AS cnt, sum(amount) AS total + FROM lg_ledger + GROUP BY biz_date, status; diff --git a/db/lg_ddl_0003.sql b/db/lg_ddl_0003.sql new file mode 100644 index 0000000..c60f341 --- /dev/null +++ b/db/lg_ddl_0003.sql @@ -0,0 +1,23 @@ +-- lg_ddl_0003.sql - 원장 DBIO 스키마/뷰 정의 (easy) +-- 런타임 PostgreSQL 에 적용. 컴파일에는 불필요. + +CREATE TABLE IF NOT EXISTS lg_ledger ( + key VARCHAR(15) NOT NULL, + merch_id VARCHAR(15) NOT NULL, + card_no VARCHAR(19) NOT NULL, + amount BIGINT NOT NULL DEFAULT 0, + biz_date CHAR(8) NOT NULL, + status CHAR(1) NOT NULL DEFAULT 'R', + fee BIGINT NOT NULL DEFAULT 0, + reg_ts TIMESTAMP NOT NULL DEFAULT now(), + upd_ts TIMESTAMP, + CONSTRAINT pk_lg_ledger PRIMARY KEY (key) +); + +CREATE INDEX IF NOT EXISTS ix_lg_ddl_0003_date_status + ON lg_ledger (biz_date, status); + +CREATE OR REPLACE VIEW lg_ddl_0003_daily_v AS + SELECT biz_date, status, count(*) AS cnt, sum(amount) AS total + FROM lg_ledger + GROUP BY biz_date, status; diff --git a/db/lg_ddl_0004.sql b/db/lg_ddl_0004.sql new file mode 100644 index 0000000..2179141 --- /dev/null +++ b/db/lg_ddl_0004.sql @@ -0,0 +1,23 @@ +-- lg_ddl_0004.sql - 원장 DBIO 스키마/뷰 정의 (easy) +-- 런타임 PostgreSQL 에 적용. 컴파일에는 불필요. + +CREATE TABLE IF NOT EXISTS lg_ledger ( + key VARCHAR(15) NOT NULL, + merch_id VARCHAR(15) NOT NULL, + card_no VARCHAR(19) NOT NULL, + amount BIGINT NOT NULL DEFAULT 0, + biz_date CHAR(8) NOT NULL, + status CHAR(1) NOT NULL DEFAULT 'R', + fee BIGINT NOT NULL DEFAULT 0, + reg_ts TIMESTAMP NOT NULL DEFAULT now(), + upd_ts TIMESTAMP, + CONSTRAINT pk_lg_ledger PRIMARY KEY (key) +); + +CREATE INDEX IF NOT EXISTS ix_lg_ddl_0004_date_status + ON lg_ledger (biz_date, status); + +CREATE OR REPLACE VIEW lg_ddl_0004_daily_v AS + SELECT biz_date, status, count(*) AS cnt, sum(amount) AS total + FROM lg_ledger + GROUP BY biz_date, status; diff --git a/db/mg_ddl_0001.sql b/db/mg_ddl_0001.sql new file mode 100644 index 0000000..42b19aa --- /dev/null +++ b/db/mg_ddl_0001.sql @@ -0,0 +1,23 @@ +-- mg_ddl_0001.sql - 전문게이트웨이 DBIO 스키마/뷰 정의 (easy) +-- 런타임 PostgreSQL 에 적용. 컴파일에는 불필요. + +CREATE TABLE IF NOT EXISTS mg_ledger ( + key VARCHAR(15) NOT NULL, + merch_id VARCHAR(15) NOT NULL, + card_no VARCHAR(19) NOT NULL, + amount BIGINT NOT NULL DEFAULT 0, + biz_date CHAR(8) NOT NULL, + status CHAR(1) NOT NULL DEFAULT 'R', + fee BIGINT NOT NULL DEFAULT 0, + reg_ts TIMESTAMP NOT NULL DEFAULT now(), + upd_ts TIMESTAMP, + CONSTRAINT pk_mg_ledger PRIMARY KEY (key) +); + +CREATE INDEX IF NOT EXISTS ix_mg_ddl_0001_date_status + ON mg_ledger (biz_date, status); + +CREATE OR REPLACE VIEW mg_ddl_0001_daily_v AS + SELECT biz_date, status, count(*) AS cnt, sum(amount) AS total + FROM mg_ledger + GROUP BY biz_date, status; diff --git a/db/mg_ddl_0002.sql b/db/mg_ddl_0002.sql new file mode 100644 index 0000000..466633d --- /dev/null +++ b/db/mg_ddl_0002.sql @@ -0,0 +1,23 @@ +-- mg_ddl_0002.sql - 전문게이트웨이 DBIO 스키마/뷰 정의 (medium) +-- 런타임 PostgreSQL 에 적용. 컴파일에는 불필요. + +CREATE TABLE IF NOT EXISTS mg_ledger ( + key VARCHAR(15) NOT NULL, + merch_id VARCHAR(15) NOT NULL, + card_no VARCHAR(19) NOT NULL, + amount BIGINT NOT NULL DEFAULT 0, + biz_date CHAR(8) NOT NULL, + status CHAR(1) NOT NULL DEFAULT 'R', + fee BIGINT NOT NULL DEFAULT 0, + reg_ts TIMESTAMP NOT NULL DEFAULT now(), + upd_ts TIMESTAMP, + CONSTRAINT pk_mg_ledger PRIMARY KEY (key) +); + +CREATE INDEX IF NOT EXISTS ix_mg_ddl_0002_date_status + ON mg_ledger (biz_date, status); + +CREATE OR REPLACE VIEW mg_ddl_0002_daily_v AS + SELECT biz_date, status, count(*) AS cnt, sum(amount) AS total + FROM mg_ledger + GROUP BY biz_date, status; diff --git a/db/mg_ddl_0003.sql b/db/mg_ddl_0003.sql new file mode 100644 index 0000000..10c35b2 --- /dev/null +++ b/db/mg_ddl_0003.sql @@ -0,0 +1,23 @@ +-- mg_ddl_0003.sql - 전문게이트웨이 DBIO 스키마/뷰 정의 (easy) +-- 런타임 PostgreSQL 에 적용. 컴파일에는 불필요. + +CREATE TABLE IF NOT EXISTS mg_ledger ( + key VARCHAR(15) NOT NULL, + merch_id VARCHAR(15) NOT NULL, + card_no VARCHAR(19) NOT NULL, + amount BIGINT NOT NULL DEFAULT 0, + biz_date CHAR(8) NOT NULL, + status CHAR(1) NOT NULL DEFAULT 'R', + fee BIGINT NOT NULL DEFAULT 0, + reg_ts TIMESTAMP NOT NULL DEFAULT now(), + upd_ts TIMESTAMP, + CONSTRAINT pk_mg_ledger PRIMARY KEY (key) +); + +CREATE INDEX IF NOT EXISTS ix_mg_ddl_0003_date_status + ON mg_ledger (biz_date, status); + +CREATE OR REPLACE VIEW mg_ddl_0003_daily_v AS + SELECT biz_date, status, count(*) AS cnt, sum(amount) AS total + FROM mg_ledger + GROUP BY biz_date, status; diff --git a/db/mg_ddl_0004.sql b/db/mg_ddl_0004.sql new file mode 100644 index 0000000..29da7ff --- /dev/null +++ b/db/mg_ddl_0004.sql @@ -0,0 +1,23 @@ +-- mg_ddl_0004.sql - 전문게이트웨이 DBIO 스키마/뷰 정의 (medium) +-- 런타임 PostgreSQL 에 적용. 컴파일에는 불필요. + +CREATE TABLE IF NOT EXISTS mg_ledger ( + key VARCHAR(15) NOT NULL, + merch_id VARCHAR(15) NOT NULL, + card_no VARCHAR(19) NOT NULL, + amount BIGINT NOT NULL DEFAULT 0, + biz_date CHAR(8) NOT NULL, + status CHAR(1) NOT NULL DEFAULT 'R', + fee BIGINT NOT NULL DEFAULT 0, + reg_ts TIMESTAMP NOT NULL DEFAULT now(), + upd_ts TIMESTAMP, + CONSTRAINT pk_mg_ledger PRIMARY KEY (key) +); + +CREATE INDEX IF NOT EXISTS ix_mg_ddl_0004_date_status + ON mg_ledger (biz_date, status); + +CREATE OR REPLACE VIEW mg_ddl_0004_daily_v AS + SELECT biz_date, status, count(*) AS cnt, sum(amount) AS total + FROM mg_ledger + GROUP BY biz_date, status; diff --git a/db/mg_ddl_0005.sql b/db/mg_ddl_0005.sql new file mode 100644 index 0000000..5b6c81e --- /dev/null +++ b/db/mg_ddl_0005.sql @@ -0,0 +1,23 @@ +-- mg_ddl_0005.sql - 전문게이트웨이 DBIO 스키마/뷰 정의 (easy) +-- 런타임 PostgreSQL 에 적용. 컴파일에는 불필요. + +CREATE TABLE IF NOT EXISTS mg_ledger ( + key VARCHAR(15) NOT NULL, + merch_id VARCHAR(15) NOT NULL, + card_no VARCHAR(19) NOT NULL, + amount BIGINT NOT NULL DEFAULT 0, + biz_date CHAR(8) NOT NULL, + status CHAR(1) NOT NULL DEFAULT 'R', + fee BIGINT NOT NULL DEFAULT 0, + reg_ts TIMESTAMP NOT NULL DEFAULT now(), + upd_ts TIMESTAMP, + CONSTRAINT pk_mg_ledger PRIMARY KEY (key) +); + +CREATE INDEX IF NOT EXISTS ix_mg_ddl_0005_date_status + ON mg_ledger (biz_date, status); + +CREATE OR REPLACE VIEW mg_ddl_0005_daily_v AS + SELECT biz_date, status, count(*) AS cnt, sum(amount) AS total + FROM mg_ledger + GROUP BY biz_date, status; diff --git a/db/mm_ddl_0001.sql b/db/mm_ddl_0001.sql new file mode 100644 index 0000000..d952b98 --- /dev/null +++ b/db/mm_ddl_0001.sql @@ -0,0 +1,23 @@ +-- mm_ddl_0001.sql - 마스터 DBIO 스키마/뷰 정의 (easy) +-- 런타임 PostgreSQL 에 적용. 컴파일에는 불필요. + +CREATE TABLE IF NOT EXISTS mm_ledger ( + key VARCHAR(15) NOT NULL, + merch_id VARCHAR(15) NOT NULL, + card_no VARCHAR(19) NOT NULL, + amount BIGINT NOT NULL DEFAULT 0, + biz_date CHAR(8) NOT NULL, + status CHAR(1) NOT NULL DEFAULT 'R', + fee BIGINT NOT NULL DEFAULT 0, + reg_ts TIMESTAMP NOT NULL DEFAULT now(), + upd_ts TIMESTAMP, + CONSTRAINT pk_mm_ledger PRIMARY KEY (key) +); + +CREATE INDEX IF NOT EXISTS ix_mm_ddl_0001_date_status + ON mm_ledger (biz_date, status); + +CREATE OR REPLACE VIEW mm_ddl_0001_daily_v AS + SELECT biz_date, status, count(*) AS cnt, sum(amount) AS total + FROM mm_ledger + GROUP BY biz_date, status; diff --git a/db/mm_ddl_0002.sql b/db/mm_ddl_0002.sql new file mode 100644 index 0000000..9982dc5 --- /dev/null +++ b/db/mm_ddl_0002.sql @@ -0,0 +1,23 @@ +-- mm_ddl_0002.sql - 마스터 DBIO 스키마/뷰 정의 (hard) +-- 런타임 PostgreSQL 에 적용. 컴파일에는 불필요. + +CREATE TABLE IF NOT EXISTS mm_ledger ( + key VARCHAR(15) NOT NULL, + merch_id VARCHAR(15) NOT NULL, + card_no VARCHAR(19) NOT NULL, + amount BIGINT NOT NULL DEFAULT 0, + biz_date CHAR(8) NOT NULL, + status CHAR(1) NOT NULL DEFAULT 'R', + fee BIGINT NOT NULL DEFAULT 0, + reg_ts TIMESTAMP NOT NULL DEFAULT now(), + upd_ts TIMESTAMP, + CONSTRAINT pk_mm_ledger PRIMARY KEY (key) +); + +CREATE INDEX IF NOT EXISTS ix_mm_ddl_0002_date_status + ON mm_ledger (biz_date, status); + +CREATE OR REPLACE VIEW mm_ddl_0002_daily_v AS + SELECT biz_date, status, count(*) AS cnt, sum(amount) AS total + FROM mm_ledger + GROUP BY biz_date, status; diff --git a/db/mm_ddl_0003.sql b/db/mm_ddl_0003.sql new file mode 100644 index 0000000..2050230 --- /dev/null +++ b/db/mm_ddl_0003.sql @@ -0,0 +1,23 @@ +-- mm_ddl_0003.sql - 마스터 DBIO 스키마/뷰 정의 (easy) +-- 런타임 PostgreSQL 에 적용. 컴파일에는 불필요. + +CREATE TABLE IF NOT EXISTS mm_ledger ( + key VARCHAR(15) NOT NULL, + merch_id VARCHAR(15) NOT NULL, + card_no VARCHAR(19) NOT NULL, + amount BIGINT NOT NULL DEFAULT 0, + biz_date CHAR(8) NOT NULL, + status CHAR(1) NOT NULL DEFAULT 'R', + fee BIGINT NOT NULL DEFAULT 0, + reg_ts TIMESTAMP NOT NULL DEFAULT now(), + upd_ts TIMESTAMP, + CONSTRAINT pk_mm_ledger PRIMARY KEY (key) +); + +CREATE INDEX IF NOT EXISTS ix_mm_ddl_0003_date_status + ON mm_ledger (biz_date, status); + +CREATE OR REPLACE VIEW mm_ddl_0003_daily_v AS + SELECT biz_date, status, count(*) AS cnt, sum(amount) AS total + FROM mm_ledger + GROUP BY biz_date, status; diff --git a/db/mm_ddl_0004.sql b/db/mm_ddl_0004.sql new file mode 100644 index 0000000..4204980 --- /dev/null +++ b/db/mm_ddl_0004.sql @@ -0,0 +1,23 @@ +-- mm_ddl_0004.sql - 마스터 DBIO 스키마/뷰 정의 (easy) +-- 런타임 PostgreSQL 에 적용. 컴파일에는 불필요. + +CREATE TABLE IF NOT EXISTS mm_ledger ( + key VARCHAR(15) NOT NULL, + merch_id VARCHAR(15) NOT NULL, + card_no VARCHAR(19) NOT NULL, + amount BIGINT NOT NULL DEFAULT 0, + biz_date CHAR(8) NOT NULL, + status CHAR(1) NOT NULL DEFAULT 'R', + fee BIGINT NOT NULL DEFAULT 0, + reg_ts TIMESTAMP NOT NULL DEFAULT now(), + upd_ts TIMESTAMP, + CONSTRAINT pk_mm_ledger PRIMARY KEY (key) +); + +CREATE INDEX IF NOT EXISTS ix_mm_ddl_0004_date_status + ON mm_ledger (biz_date, status); + +CREATE OR REPLACE VIEW mm_ddl_0004_daily_v AS + SELECT biz_date, status, count(*) AS cnt, sum(amount) AS total + FROM mm_ledger + GROUP BY biz_date, status; diff --git a/db/py_ddl_0001.sql b/db/py_ddl_0001.sql new file mode 100644 index 0000000..eb090ba --- /dev/null +++ b/db/py_ddl_0001.sql @@ -0,0 +1,23 @@ +-- py_ddl_0001.sql - 지급 DBIO 스키마/뷰 정의 (easy) +-- 런타임 PostgreSQL 에 적용. 컴파일에는 불필요. + +CREATE TABLE IF NOT EXISTS py_ledger ( + key VARCHAR(15) NOT NULL, + merch_id VARCHAR(15) NOT NULL, + card_no VARCHAR(19) NOT NULL, + amount BIGINT NOT NULL DEFAULT 0, + biz_date CHAR(8) NOT NULL, + status CHAR(1) NOT NULL DEFAULT 'R', + fee BIGINT NOT NULL DEFAULT 0, + reg_ts TIMESTAMP NOT NULL DEFAULT now(), + upd_ts TIMESTAMP, + CONSTRAINT pk_py_ledger PRIMARY KEY (key) +); + +CREATE INDEX IF NOT EXISTS ix_py_ddl_0001_date_status + ON py_ledger (biz_date, status); + +CREATE OR REPLACE VIEW py_ddl_0001_daily_v AS + SELECT biz_date, status, count(*) AS cnt, sum(amount) AS total + FROM py_ledger + GROUP BY biz_date, status; diff --git a/db/py_ddl_0002.sql b/db/py_ddl_0002.sql new file mode 100644 index 0000000..62f5905 --- /dev/null +++ b/db/py_ddl_0002.sql @@ -0,0 +1,23 @@ +-- py_ddl_0002.sql - 지급 DBIO 스키마/뷰 정의 (hard) +-- 런타임 PostgreSQL 에 적용. 컴파일에는 불필요. + +CREATE TABLE IF NOT EXISTS py_ledger ( + key VARCHAR(15) NOT NULL, + merch_id VARCHAR(15) NOT NULL, + card_no VARCHAR(19) NOT NULL, + amount BIGINT NOT NULL DEFAULT 0, + biz_date CHAR(8) NOT NULL, + status CHAR(1) NOT NULL DEFAULT 'R', + fee BIGINT NOT NULL DEFAULT 0, + reg_ts TIMESTAMP NOT NULL DEFAULT now(), + upd_ts TIMESTAMP, + CONSTRAINT pk_py_ledger PRIMARY KEY (key) +); + +CREATE INDEX IF NOT EXISTS ix_py_ddl_0002_date_status + ON py_ledger (biz_date, status); + +CREATE OR REPLACE VIEW py_ddl_0002_daily_v AS + SELECT biz_date, status, count(*) AS cnt, sum(amount) AS total + FROM py_ledger + GROUP BY biz_date, status; diff --git a/db/py_ddl_0003.sql b/db/py_ddl_0003.sql new file mode 100644 index 0000000..106ce68 --- /dev/null +++ b/db/py_ddl_0003.sql @@ -0,0 +1,23 @@ +-- py_ddl_0003.sql - 지급 DBIO 스키마/뷰 정의 (easy) +-- 런타임 PostgreSQL 에 적용. 컴파일에는 불필요. + +CREATE TABLE IF NOT EXISTS py_ledger ( + key VARCHAR(15) NOT NULL, + merch_id VARCHAR(15) NOT NULL, + card_no VARCHAR(19) NOT NULL, + amount BIGINT NOT NULL DEFAULT 0, + biz_date CHAR(8) NOT NULL, + status CHAR(1) NOT NULL DEFAULT 'R', + fee BIGINT NOT NULL DEFAULT 0, + reg_ts TIMESTAMP NOT NULL DEFAULT now(), + upd_ts TIMESTAMP, + CONSTRAINT pk_py_ledger PRIMARY KEY (key) +); + +CREATE INDEX IF NOT EXISTS ix_py_ddl_0003_date_status + ON py_ledger (biz_date, status); + +CREATE OR REPLACE VIEW py_ddl_0003_daily_v AS + SELECT biz_date, status, count(*) AS cnt, sum(amount) AS total + FROM py_ledger + GROUP BY biz_date, status; diff --git a/db/py_ddl_0004.sql b/db/py_ddl_0004.sql new file mode 100644 index 0000000..cbda228 --- /dev/null +++ b/db/py_ddl_0004.sql @@ -0,0 +1,23 @@ +-- py_ddl_0004.sql - 지급 DBIO 스키마/뷰 정의 (hard) +-- 런타임 PostgreSQL 에 적용. 컴파일에는 불필요. + +CREATE TABLE IF NOT EXISTS py_ledger ( + key VARCHAR(15) NOT NULL, + merch_id VARCHAR(15) NOT NULL, + card_no VARCHAR(19) NOT NULL, + amount BIGINT NOT NULL DEFAULT 0, + biz_date CHAR(8) NOT NULL, + status CHAR(1) NOT NULL DEFAULT 'R', + fee BIGINT NOT NULL DEFAULT 0, + reg_ts TIMESTAMP NOT NULL DEFAULT now(), + upd_ts TIMESTAMP, + CONSTRAINT pk_py_ledger PRIMARY KEY (key) +); + +CREATE INDEX IF NOT EXISTS ix_py_ddl_0004_date_status + ON py_ledger (biz_date, status); + +CREATE OR REPLACE VIEW py_ddl_0004_daily_v AS + SELECT biz_date, status, count(*) AS cnt, sum(amount) AS total + FROM py_ledger + GROUP BY biz_date, status; diff --git a/db/rc_ddl_0001.sql b/db/rc_ddl_0001.sql new file mode 100644 index 0000000..5c4571e --- /dev/null +++ b/db/rc_ddl_0001.sql @@ -0,0 +1,23 @@ +-- rc_ddl_0001.sql - 대사 DBIO 스키마/뷰 정의 (easy) +-- 런타임 PostgreSQL 에 적용. 컴파일에는 불필요. + +CREATE TABLE IF NOT EXISTS rc_ledger ( + key VARCHAR(15) NOT NULL, + merch_id VARCHAR(15) NOT NULL, + card_no VARCHAR(19) NOT NULL, + amount BIGINT NOT NULL DEFAULT 0, + biz_date CHAR(8) NOT NULL, + status CHAR(1) NOT NULL DEFAULT 'R', + fee BIGINT NOT NULL DEFAULT 0, + reg_ts TIMESTAMP NOT NULL DEFAULT now(), + upd_ts TIMESTAMP, + CONSTRAINT pk_rc_ledger PRIMARY KEY (key) +); + +CREATE INDEX IF NOT EXISTS ix_rc_ddl_0001_date_status + ON rc_ledger (biz_date, status); + +CREATE OR REPLACE VIEW rc_ddl_0001_daily_v AS + SELECT biz_date, status, count(*) AS cnt, sum(amount) AS total + FROM rc_ledger + GROUP BY biz_date, status; diff --git a/db/rc_ddl_0002.sql b/db/rc_ddl_0002.sql new file mode 100644 index 0000000..0292b91 --- /dev/null +++ b/db/rc_ddl_0002.sql @@ -0,0 +1,23 @@ +-- rc_ddl_0002.sql - 대사 DBIO 스키마/뷰 정의 (medium) +-- 런타임 PostgreSQL 에 적용. 컴파일에는 불필요. + +CREATE TABLE IF NOT EXISTS rc_ledger ( + key VARCHAR(15) NOT NULL, + merch_id VARCHAR(15) NOT NULL, + card_no VARCHAR(19) NOT NULL, + amount BIGINT NOT NULL DEFAULT 0, + biz_date CHAR(8) NOT NULL, + status CHAR(1) NOT NULL DEFAULT 'R', + fee BIGINT NOT NULL DEFAULT 0, + reg_ts TIMESTAMP NOT NULL DEFAULT now(), + upd_ts TIMESTAMP, + CONSTRAINT pk_rc_ledger PRIMARY KEY (key) +); + +CREATE INDEX IF NOT EXISTS ix_rc_ddl_0002_date_status + ON rc_ledger (biz_date, status); + +CREATE OR REPLACE VIEW rc_ddl_0002_daily_v AS + SELECT biz_date, status, count(*) AS cnt, sum(amount) AS total + FROM rc_ledger + GROUP BY biz_date, status; diff --git a/db/rc_ddl_0003.sql b/db/rc_ddl_0003.sql new file mode 100644 index 0000000..52cf34a --- /dev/null +++ b/db/rc_ddl_0003.sql @@ -0,0 +1,23 @@ +-- rc_ddl_0003.sql - 대사 DBIO 스키마/뷰 정의 (easy) +-- 런타임 PostgreSQL 에 적용. 컴파일에는 불필요. + +CREATE TABLE IF NOT EXISTS rc_ledger ( + key VARCHAR(15) NOT NULL, + merch_id VARCHAR(15) NOT NULL, + card_no VARCHAR(19) NOT NULL, + amount BIGINT NOT NULL DEFAULT 0, + biz_date CHAR(8) NOT NULL, + status CHAR(1) NOT NULL DEFAULT 'R', + fee BIGINT NOT NULL DEFAULT 0, + reg_ts TIMESTAMP NOT NULL DEFAULT now(), + upd_ts TIMESTAMP, + CONSTRAINT pk_rc_ledger PRIMARY KEY (key) +); + +CREATE INDEX IF NOT EXISTS ix_rc_ddl_0003_date_status + ON rc_ledger (biz_date, status); + +CREATE OR REPLACE VIEW rc_ddl_0003_daily_v AS + SELECT biz_date, status, count(*) AS cnt, sum(amount) AS total + FROM rc_ledger + GROUP BY biz_date, status; diff --git a/db/rc_ddl_0004.sql b/db/rc_ddl_0004.sql new file mode 100644 index 0000000..77c6c03 --- /dev/null +++ b/db/rc_ddl_0004.sql @@ -0,0 +1,23 @@ +-- rc_ddl_0004.sql - 대사 DBIO 스키마/뷰 정의 (medium) +-- 런타임 PostgreSQL 에 적용. 컴파일에는 불필요. + +CREATE TABLE IF NOT EXISTS rc_ledger ( + key VARCHAR(15) NOT NULL, + merch_id VARCHAR(15) NOT NULL, + card_no VARCHAR(19) NOT NULL, + amount BIGINT NOT NULL DEFAULT 0, + biz_date CHAR(8) NOT NULL, + status CHAR(1) NOT NULL DEFAULT 'R', + fee BIGINT NOT NULL DEFAULT 0, + reg_ts TIMESTAMP NOT NULL DEFAULT now(), + upd_ts TIMESTAMP, + CONSTRAINT pk_rc_ledger PRIMARY KEY (key) +); + +CREATE INDEX IF NOT EXISTS ix_rc_ddl_0004_date_status + ON rc_ledger (biz_date, status); + +CREATE OR REPLACE VIEW rc_ddl_0004_daily_v AS + SELECT biz_date, status, count(*) AS cnt, sum(amount) AS total + FROM rc_ledger + GROUP BY biz_date, status; diff --git a/db/rc_ddl_0005.sql b/db/rc_ddl_0005.sql new file mode 100644 index 0000000..32d39d7 --- /dev/null +++ b/db/rc_ddl_0005.sql @@ -0,0 +1,23 @@ +-- rc_ddl_0005.sql - 대사 DBIO 스키마/뷰 정의 (easy) +-- 런타임 PostgreSQL 에 적용. 컴파일에는 불필요. + +CREATE TABLE IF NOT EXISTS rc_ledger ( + key VARCHAR(15) NOT NULL, + merch_id VARCHAR(15) NOT NULL, + card_no VARCHAR(19) NOT NULL, + amount BIGINT NOT NULL DEFAULT 0, + biz_date CHAR(8) NOT NULL, + status CHAR(1) NOT NULL DEFAULT 'R', + fee BIGINT NOT NULL DEFAULT 0, + reg_ts TIMESTAMP NOT NULL DEFAULT now(), + upd_ts TIMESTAMP, + CONSTRAINT pk_rc_ledger PRIMARY KEY (key) +); + +CREATE INDEX IF NOT EXISTS ix_rc_ddl_0005_date_status + ON rc_ledger (biz_date, status); + +CREATE OR REPLACE VIEW rc_ddl_0005_daily_v AS + SELECT biz_date, status, count(*) AS cnt, sum(amount) AS total + FROM rc_ledger + GROUP BY biz_date, status; diff --git a/db/schema.sql b/db/schema.sql new file mode 100644 index 0000000..c3c5c49 --- /dev/null +++ b/db/schema.sql @@ -0,0 +1,19 @@ +-- schema.sql - acquire-core-full 공통 스키마 루트 +-- 모듈별 원장 테이블은 db/_*.sql 참조. + +CREATE TABLE IF NOT EXISTS merchant ( + merch_id VARCHAR(15) NOT NULL, + merch_name VARCHAR(60) NOT NULL, + biz_no VARCHAR(12), + status CHAR(1) NOT NULL DEFAULT 'A', + CONSTRAINT pk_merchant PRIMARY KEY (merch_id) +); + +CREATE TABLE IF NOT EXISTS approval ( + appr_no VARCHAR(9) NOT NULL, + merch_id VARCHAR(15) NOT NULL, + amount BIGINT NOT NULL, + appr_date CHAR(8) NOT NULL, + status CHAR(1) NOT NULL DEFAULT 'A', + CONSTRAINT pk_approval PRIMARY KEY (appr_no) +); diff --git a/db/st_ddl_0001.sql b/db/st_ddl_0001.sql new file mode 100644 index 0000000..e0b26d7 --- /dev/null +++ b/db/st_ddl_0001.sql @@ -0,0 +1,23 @@ +-- st_ddl_0001.sql - 정산수수료 DBIO 스키마/뷰 정의 (easy) +-- 런타임 PostgreSQL 에 적용. 컴파일에는 불필요. + +CREATE TABLE IF NOT EXISTS st_ledger ( + key VARCHAR(15) NOT NULL, + merch_id VARCHAR(15) NOT NULL, + card_no VARCHAR(19) NOT NULL, + amount BIGINT NOT NULL DEFAULT 0, + biz_date CHAR(8) NOT NULL, + status CHAR(1) NOT NULL DEFAULT 'R', + fee BIGINT NOT NULL DEFAULT 0, + reg_ts TIMESTAMP NOT NULL DEFAULT now(), + upd_ts TIMESTAMP, + CONSTRAINT pk_st_ledger PRIMARY KEY (key) +); + +CREATE INDEX IF NOT EXISTS ix_st_ddl_0001_date_status + ON st_ledger (biz_date, status); + +CREATE OR REPLACE VIEW st_ddl_0001_daily_v AS + SELECT biz_date, status, count(*) AS cnt, sum(amount) AS total + FROM st_ledger + GROUP BY biz_date, status; diff --git a/db/st_ddl_0002.sql b/db/st_ddl_0002.sql new file mode 100644 index 0000000..9d44060 --- /dev/null +++ b/db/st_ddl_0002.sql @@ -0,0 +1,23 @@ +-- st_ddl_0002.sql - 정산수수료 DBIO 스키마/뷰 정의 (medium) +-- 런타임 PostgreSQL 에 적용. 컴파일에는 불필요. + +CREATE TABLE IF NOT EXISTS st_ledger ( + key VARCHAR(15) NOT NULL, + merch_id VARCHAR(15) NOT NULL, + card_no VARCHAR(19) NOT NULL, + amount BIGINT NOT NULL DEFAULT 0, + biz_date CHAR(8) NOT NULL, + status CHAR(1) NOT NULL DEFAULT 'R', + fee BIGINT NOT NULL DEFAULT 0, + reg_ts TIMESTAMP NOT NULL DEFAULT now(), + upd_ts TIMESTAMP, + CONSTRAINT pk_st_ledger PRIMARY KEY (key) +); + +CREATE INDEX IF NOT EXISTS ix_st_ddl_0002_date_status + ON st_ledger (biz_date, status); + +CREATE OR REPLACE VIEW st_ddl_0002_daily_v AS + SELECT biz_date, status, count(*) AS cnt, sum(amount) AS total + FROM st_ledger + GROUP BY biz_date, status; diff --git a/db/st_ddl_0003.sql b/db/st_ddl_0003.sql new file mode 100644 index 0000000..2b1310e --- /dev/null +++ b/db/st_ddl_0003.sql @@ -0,0 +1,23 @@ +-- st_ddl_0003.sql - 정산수수료 DBIO 스키마/뷰 정의 (easy) +-- 런타임 PostgreSQL 에 적용. 컴파일에는 불필요. + +CREATE TABLE IF NOT EXISTS st_ledger ( + key VARCHAR(15) NOT NULL, + merch_id VARCHAR(15) NOT NULL, + card_no VARCHAR(19) NOT NULL, + amount BIGINT NOT NULL DEFAULT 0, + biz_date CHAR(8) NOT NULL, + status CHAR(1) NOT NULL DEFAULT 'R', + fee BIGINT NOT NULL DEFAULT 0, + reg_ts TIMESTAMP NOT NULL DEFAULT now(), + upd_ts TIMESTAMP, + CONSTRAINT pk_st_ledger PRIMARY KEY (key) +); + +CREATE INDEX IF NOT EXISTS ix_st_ddl_0003_date_status + ON st_ledger (biz_date, status); + +CREATE OR REPLACE VIEW st_ddl_0003_daily_v AS + SELECT biz_date, status, count(*) AS cnt, sum(amount) AS total + FROM st_ledger + GROUP BY biz_date, status; diff --git a/db/st_ddl_0004.sql b/db/st_ddl_0004.sql new file mode 100644 index 0000000..2e99eef --- /dev/null +++ b/db/st_ddl_0004.sql @@ -0,0 +1,23 @@ +-- st_ddl_0004.sql - 정산수수료 DBIO 스키마/뷰 정의 (hard) +-- 런타임 PostgreSQL 에 적용. 컴파일에는 불필요. + +CREATE TABLE IF NOT EXISTS st_ledger ( + key VARCHAR(15) NOT NULL, + merch_id VARCHAR(15) NOT NULL, + card_no VARCHAR(19) NOT NULL, + amount BIGINT NOT NULL DEFAULT 0, + biz_date CHAR(8) NOT NULL, + status CHAR(1) NOT NULL DEFAULT 'R', + fee BIGINT NOT NULL DEFAULT 0, + reg_ts TIMESTAMP NOT NULL DEFAULT now(), + upd_ts TIMESTAMP, + CONSTRAINT pk_st_ledger PRIMARY KEY (key) +); + +CREATE INDEX IF NOT EXISTS ix_st_ddl_0004_date_status + ON st_ledger (biz_date, status); + +CREATE OR REPLACE VIEW st_ddl_0004_daily_v AS + SELECT biz_date, status, count(*) AS cnt, sum(amount) AS total + FROM st_ledger + GROUP BY biz_date, status; diff --git a/db/st_ddl_0005.sql b/db/st_ddl_0005.sql new file mode 100644 index 0000000..4409c6a --- /dev/null +++ b/db/st_ddl_0005.sql @@ -0,0 +1,23 @@ +-- st_ddl_0005.sql - 정산수수료 DBIO 스키마/뷰 정의 (easy) +-- 런타임 PostgreSQL 에 적용. 컴파일에는 불필요. + +CREATE TABLE IF NOT EXISTS st_ledger ( + key VARCHAR(15) NOT NULL, + merch_id VARCHAR(15) NOT NULL, + card_no VARCHAR(19) NOT NULL, + amount BIGINT NOT NULL DEFAULT 0, + biz_date CHAR(8) NOT NULL, + status CHAR(1) NOT NULL DEFAULT 'R', + fee BIGINT NOT NULL DEFAULT 0, + reg_ts TIMESTAMP NOT NULL DEFAULT now(), + upd_ts TIMESTAMP, + CONSTRAINT pk_st_ledger PRIMARY KEY (key) +); + +CREATE INDEX IF NOT EXISTS ix_st_ddl_0005_date_status + ON st_ledger (biz_date, status); + +CREATE OR REPLACE VIEW st_ddl_0005_daily_v AS + SELECT biz_date, status, count(*) AS cnt, sum(amount) AS total + FROM st_ledger + GROUP BY biz_date, status; diff --git a/db/vl_ddl_0001.sql b/db/vl_ddl_0001.sql new file mode 100644 index 0000000..f06ebca --- /dev/null +++ b/db/vl_ddl_0001.sql @@ -0,0 +1,23 @@ +-- vl_ddl_0001.sql - 정합성 DBIO 스키마/뷰 정의 (easy) +-- 런타임 PostgreSQL 에 적용. 컴파일에는 불필요. + +CREATE TABLE IF NOT EXISTS vl_ledger ( + key VARCHAR(15) NOT NULL, + merch_id VARCHAR(15) NOT NULL, + card_no VARCHAR(19) NOT NULL, + amount BIGINT NOT NULL DEFAULT 0, + biz_date CHAR(8) NOT NULL, + status CHAR(1) NOT NULL DEFAULT 'R', + fee BIGINT NOT NULL DEFAULT 0, + reg_ts TIMESTAMP NOT NULL DEFAULT now(), + upd_ts TIMESTAMP, + CONSTRAINT pk_vl_ledger PRIMARY KEY (key) +); + +CREATE INDEX IF NOT EXISTS ix_vl_ddl_0001_date_status + ON vl_ledger (biz_date, status); + +CREATE OR REPLACE VIEW vl_ddl_0001_daily_v AS + SELECT biz_date, status, count(*) AS cnt, sum(amount) AS total + FROM vl_ledger + GROUP BY biz_date, status; diff --git a/db/vl_ddl_0002.sql b/db/vl_ddl_0002.sql new file mode 100644 index 0000000..a641b19 --- /dev/null +++ b/db/vl_ddl_0002.sql @@ -0,0 +1,23 @@ +-- vl_ddl_0002.sql - 정합성 DBIO 스키마/뷰 정의 (medium) +-- 런타임 PostgreSQL 에 적용. 컴파일에는 불필요. + +CREATE TABLE IF NOT EXISTS vl_ledger ( + key VARCHAR(15) NOT NULL, + merch_id VARCHAR(15) NOT NULL, + card_no VARCHAR(19) NOT NULL, + amount BIGINT NOT NULL DEFAULT 0, + biz_date CHAR(8) NOT NULL, + status CHAR(1) NOT NULL DEFAULT 'R', + fee BIGINT NOT NULL DEFAULT 0, + reg_ts TIMESTAMP NOT NULL DEFAULT now(), + upd_ts TIMESTAMP, + CONSTRAINT pk_vl_ledger PRIMARY KEY (key) +); + +CREATE INDEX IF NOT EXISTS ix_vl_ddl_0002_date_status + ON vl_ledger (biz_date, status); + +CREATE OR REPLACE VIEW vl_ddl_0002_daily_v AS + SELECT biz_date, status, count(*) AS cnt, sum(amount) AS total + FROM vl_ledger + GROUP BY biz_date, status; diff --git a/db/vl_ddl_0003.sql b/db/vl_ddl_0003.sql new file mode 100644 index 0000000..e791357 --- /dev/null +++ b/db/vl_ddl_0003.sql @@ -0,0 +1,23 @@ +-- vl_ddl_0003.sql - 정합성 DBIO 스키마/뷰 정의 (easy) +-- 런타임 PostgreSQL 에 적용. 컴파일에는 불필요. + +CREATE TABLE IF NOT EXISTS vl_ledger ( + key VARCHAR(15) NOT NULL, + merch_id VARCHAR(15) NOT NULL, + card_no VARCHAR(19) NOT NULL, + amount BIGINT NOT NULL DEFAULT 0, + biz_date CHAR(8) NOT NULL, + status CHAR(1) NOT NULL DEFAULT 'R', + fee BIGINT NOT NULL DEFAULT 0, + reg_ts TIMESTAMP NOT NULL DEFAULT now(), + upd_ts TIMESTAMP, + CONSTRAINT pk_vl_ledger PRIMARY KEY (key) +); + +CREATE INDEX IF NOT EXISTS ix_vl_ddl_0003_date_status + ON vl_ledger (biz_date, status); + +CREATE OR REPLACE VIEW vl_ddl_0003_daily_v AS + SELECT biz_date, status, count(*) AS cnt, sum(amount) AS total + FROM vl_ledger + GROUP BY biz_date, status; diff --git a/db/vl_ddl_0004.sql b/db/vl_ddl_0004.sql new file mode 100644 index 0000000..17eb73e --- /dev/null +++ b/db/vl_ddl_0004.sql @@ -0,0 +1,23 @@ +-- vl_ddl_0004.sql - 정합성 DBIO 스키마/뷰 정의 (hard) +-- 런타임 PostgreSQL 에 적용. 컴파일에는 불필요. + +CREATE TABLE IF NOT EXISTS vl_ledger ( + key VARCHAR(15) NOT NULL, + merch_id VARCHAR(15) NOT NULL, + card_no VARCHAR(19) NOT NULL, + amount BIGINT NOT NULL DEFAULT 0, + biz_date CHAR(8) NOT NULL, + status CHAR(1) NOT NULL DEFAULT 'R', + fee BIGINT NOT NULL DEFAULT 0, + reg_ts TIMESTAMP NOT NULL DEFAULT now(), + upd_ts TIMESTAMP, + CONSTRAINT pk_vl_ledger PRIMARY KEY (key) +); + +CREATE INDEX IF NOT EXISTS ix_vl_ddl_0004_date_status + ON vl_ledger (biz_date, status); + +CREATE OR REPLACE VIEW vl_ddl_0004_daily_v AS + SELECT biz_date, status, count(*) AS cnt, sum(amount) AS total + FROM vl_ledger + GROUP BY biz_date, status; diff --git a/db/vl_ddl_0005.sql b/db/vl_ddl_0005.sql new file mode 100644 index 0000000..ac88d7b --- /dev/null +++ b/db/vl_ddl_0005.sql @@ -0,0 +1,23 @@ +-- vl_ddl_0005.sql - 정합성 DBIO 스키마/뷰 정의 (easy) +-- 런타임 PostgreSQL 에 적용. 컴파일에는 불필요. + +CREATE TABLE IF NOT EXISTS vl_ledger ( + key VARCHAR(15) NOT NULL, + merch_id VARCHAR(15) NOT NULL, + card_no VARCHAR(19) NOT NULL, + amount BIGINT NOT NULL DEFAULT 0, + biz_date CHAR(8) NOT NULL, + status CHAR(1) NOT NULL DEFAULT 'R', + fee BIGINT NOT NULL DEFAULT 0, + reg_ts TIMESTAMP NOT NULL DEFAULT now(), + upd_ts TIMESTAMP, + CONSTRAINT pk_vl_ledger PRIMARY KEY (key) +); + +CREATE INDEX IF NOT EXISTS ix_vl_ddl_0005_date_status + ON vl_ledger (biz_date, status); + +CREATE OR REPLACE VIEW vl_ddl_0005_daily_v AS + SELECT biz_date, status, count(*) AS cnt, sum(amount) AS total + FROM vl_ledger + GROUP BY biz_date, status; diff --git a/fml/ac_fml_0001.fml b/fml/ac_fml_0001.fml new file mode 100644 index 0000000..613cbad --- /dev/null +++ b/fml/ac_fml_0001.fml @@ -0,0 +1,13 @@ +# +# AC_FML_0001.fml - 매입 FML 필드 테이블 (UBF 필드 정의) +# *base 130 +# +# name rel-number type flags comments +AC_FML_0001_KEY 1 string - 처리키 +AC_FML_0001_MERCHID 2 string - 가맹점번호 +AC_FML_0001_CARDNO 3 string - 카드번호(마스킹) +AC_FML_0001_AMOUNT 4 long - 거래금액 +AC_FML_0001_BIZDATE 5 string - 영업일 +AC_FML_0001_STATUS 6 char - 상태코드 +AC_FML_0001_FEE 7 long - 수수료 +AC_FML_0001_RESPCODE 8 string - 응답코드 diff --git a/fml/ac_fml_0002.fml b/fml/ac_fml_0002.fml new file mode 100644 index 0000000..4dc34eb --- /dev/null +++ b/fml/ac_fml_0002.fml @@ -0,0 +1,13 @@ +# +# AC_FML_0002.fml - 매입 FML 필드 테이블 (UBF 필드 정의) +# *base 150 +# +# name rel-number type flags comments +AC_FML_0002_KEY 1 string - 처리키 +AC_FML_0002_MERCHID 2 string - 가맹점번호 +AC_FML_0002_CARDNO 3 string - 카드번호(마스킹) +AC_FML_0002_AMOUNT 4 long - 거래금액 +AC_FML_0002_BIZDATE 5 string - 영업일 +AC_FML_0002_STATUS 6 char - 상태코드 +AC_FML_0002_FEE 7 long - 수수료 +AC_FML_0002_RESPCODE 8 string - 응답코드 diff --git a/fml/ac_fml_0003.fml b/fml/ac_fml_0003.fml new file mode 100644 index 0000000..27ea6ed --- /dev/null +++ b/fml/ac_fml_0003.fml @@ -0,0 +1,13 @@ +# +# AC_FML_0003.fml - 매입 FML 필드 테이블 (UBF 필드 정의) +# *base 170 +# +# name rel-number type flags comments +AC_FML_0003_KEY 1 string - 처리키 +AC_FML_0003_MERCHID 2 string - 가맹점번호 +AC_FML_0003_CARDNO 3 string - 카드번호(마스킹) +AC_FML_0003_AMOUNT 4 long - 거래금액 +AC_FML_0003_BIZDATE 5 string - 영업일 +AC_FML_0003_STATUS 6 char - 상태코드 +AC_FML_0003_FEE 7 long - 수수료 +AC_FML_0003_RESPCODE 8 string - 응답코드 diff --git a/fml/ac_fml_0004.fml b/fml/ac_fml_0004.fml new file mode 100644 index 0000000..2ae7fcf --- /dev/null +++ b/fml/ac_fml_0004.fml @@ -0,0 +1,13 @@ +# +# AC_FML_0004.fml - 매입 FML 필드 테이블 (UBF 필드 정의) +# *base 190 +# +# name rel-number type flags comments +AC_FML_0004_KEY 1 string - 처리키 +AC_FML_0004_MERCHID 2 string - 가맹점번호 +AC_FML_0004_CARDNO 3 string - 카드번호(마스킹) +AC_FML_0004_AMOUNT 4 long - 거래금액 +AC_FML_0004_BIZDATE 5 string - 영업일 +AC_FML_0004_STATUS 6 char - 상태코드 +AC_FML_0004_FEE 7 long - 수수료 +AC_FML_0004_RESPCODE 8 string - 응답코드 diff --git a/fml/ac_fml_0005.fml b/fml/ac_fml_0005.fml new file mode 100644 index 0000000..f52f93b --- /dev/null +++ b/fml/ac_fml_0005.fml @@ -0,0 +1,13 @@ +# +# AC_FML_0005.fml - 매입 FML 필드 테이블 (UBF 필드 정의) +# *base 120 +# +# name rel-number type flags comments +AC_FML_0005_KEY 1 string - 처리키 +AC_FML_0005_MERCHID 2 string - 가맹점번호 +AC_FML_0005_CARDNO 3 string - 카드번호(마스킹) +AC_FML_0005_AMOUNT 4 long - 거래금액 +AC_FML_0005_BIZDATE 5 string - 영업일 +AC_FML_0005_STATUS 6 char - 상태코드 +AC_FML_0005_FEE 7 long - 수수료 +AC_FML_0005_RESPCODE 8 string - 응답코드 diff --git a/fml/ac_fml_0006.fml b/fml/ac_fml_0006.fml new file mode 100644 index 0000000..55a8ce3 --- /dev/null +++ b/fml/ac_fml_0006.fml @@ -0,0 +1,13 @@ +# +# AC_FML_0006.fml - 매입 FML 필드 테이블 (UBF 필드 정의) +# *base 140 +# +# name rel-number type flags comments +AC_FML_0006_KEY 1 string - 처리키 +AC_FML_0006_MERCHID 2 string - 가맹점번호 +AC_FML_0006_CARDNO 3 string - 카드번호(마스킹) +AC_FML_0006_AMOUNT 4 long - 거래금액 +AC_FML_0006_BIZDATE 5 string - 영업일 +AC_FML_0006_STATUS 6 char - 상태코드 +AC_FML_0006_FEE 7 long - 수수료 +AC_FML_0006_RESPCODE 8 string - 응답코드 diff --git a/fml/ac_fml_0007.fml b/fml/ac_fml_0007.fml new file mode 100644 index 0000000..1d4ecdf --- /dev/null +++ b/fml/ac_fml_0007.fml @@ -0,0 +1,13 @@ +# +# AC_FML_0007.fml - 매입 FML 필드 테이블 (UBF 필드 정의) +# *base 160 +# +# name rel-number type flags comments +AC_FML_0007_KEY 1 string - 처리키 +AC_FML_0007_MERCHID 2 string - 가맹점번호 +AC_FML_0007_CARDNO 3 string - 카드번호(마스킹) +AC_FML_0007_AMOUNT 4 long - 거래금액 +AC_FML_0007_BIZDATE 5 string - 영업일 +AC_FML_0007_STATUS 6 char - 상태코드 +AC_FML_0007_FEE 7 long - 수수료 +AC_FML_0007_RESPCODE 8 string - 응답코드 diff --git a/fml/ac_fml_0008.fml b/fml/ac_fml_0008.fml new file mode 100644 index 0000000..d7bb398 --- /dev/null +++ b/fml/ac_fml_0008.fml @@ -0,0 +1,13 @@ +# +# AC_FML_0008.fml - 매입 FML 필드 테이블 (UBF 필드 정의) +# *base 180 +# +# name rel-number type flags comments +AC_FML_0008_KEY 1 string - 처리키 +AC_FML_0008_MERCHID 2 string - 가맹점번호 +AC_FML_0008_CARDNO 3 string - 카드번호(마스킹) +AC_FML_0008_AMOUNT 4 long - 거래금액 +AC_FML_0008_BIZDATE 5 string - 영업일 +AC_FML_0008_STATUS 6 char - 상태코드 +AC_FML_0008_FEE 7 long - 수수료 +AC_FML_0008_RESPCODE 8 string - 응답코드 diff --git a/fml/ac_fml_0009.fml b/fml/ac_fml_0009.fml new file mode 100644 index 0000000..66b411e --- /dev/null +++ b/fml/ac_fml_0009.fml @@ -0,0 +1,13 @@ +# +# AC_FML_0009.fml - 매입 FML 필드 테이블 (UBF 필드 정의) +# *base 110 +# +# name rel-number type flags comments +AC_FML_0009_KEY 1 string - 처리키 +AC_FML_0009_MERCHID 2 string - 가맹점번호 +AC_FML_0009_CARDNO 3 string - 카드번호(마스킹) +AC_FML_0009_AMOUNT 4 long - 거래금액 +AC_FML_0009_BIZDATE 5 string - 영업일 +AC_FML_0009_STATUS 6 char - 상태코드 +AC_FML_0009_FEE 7 long - 수수료 +AC_FML_0009_RESPCODE 8 string - 응답코드 diff --git a/fml/ac_fml_0010.fml b/fml/ac_fml_0010.fml new file mode 100644 index 0000000..1c0ac05 --- /dev/null +++ b/fml/ac_fml_0010.fml @@ -0,0 +1,13 @@ +# +# AC_FML_0010.fml - 매입 FML 필드 테이블 (UBF 필드 정의) +# *base 130 +# +# name rel-number type flags comments +AC_FML_0010_KEY 1 string - 처리키 +AC_FML_0010_MERCHID 2 string - 가맹점번호 +AC_FML_0010_CARDNO 3 string - 카드번호(마스킹) +AC_FML_0010_AMOUNT 4 long - 거래금액 +AC_FML_0010_BIZDATE 5 string - 영업일 +AC_FML_0010_STATUS 6 char - 상태코드 +AC_FML_0010_FEE 7 long - 수수료 +AC_FML_0010_RESPCODE 8 string - 응답코드 diff --git a/fml/ac_fml_0011.fml b/fml/ac_fml_0011.fml new file mode 100644 index 0000000..2ee81a4 --- /dev/null +++ b/fml/ac_fml_0011.fml @@ -0,0 +1,13 @@ +# +# AC_FML_0011.fml - 매입 FML 필드 테이블 (UBF 필드 정의) +# *base 150 +# +# name rel-number type flags comments +AC_FML_0011_KEY 1 string - 처리키 +AC_FML_0011_MERCHID 2 string - 가맹점번호 +AC_FML_0011_CARDNO 3 string - 카드번호(마스킹) +AC_FML_0011_AMOUNT 4 long - 거래금액 +AC_FML_0011_BIZDATE 5 string - 영업일 +AC_FML_0011_STATUS 6 char - 상태코드 +AC_FML_0011_FEE 7 long - 수수료 +AC_FML_0011_RESPCODE 8 string - 응답코드 diff --git a/fml/au_fml_0001.fml b/fml/au_fml_0001.fml new file mode 100644 index 0000000..ad3ecff --- /dev/null +++ b/fml/au_fml_0001.fml @@ -0,0 +1,13 @@ +# +# AU_FML_0001.fml - 승인한도 FML 필드 테이블 (UBF 필드 정의) +# *base 120 +# +# name rel-number type flags comments +AU_FML_0001_KEY 1 string - 처리키 +AU_FML_0001_MERCHID 2 string - 가맹점번호 +AU_FML_0001_CARDNO 3 string - 카드번호(마스킹) +AU_FML_0001_AMOUNT 4 long - 거래금액 +AU_FML_0001_BIZDATE 5 string - 영업일 +AU_FML_0001_STATUS 6 char - 상태코드 +AU_FML_0001_FEE 7 long - 수수료 +AU_FML_0001_RESPCODE 8 string - 응답코드 diff --git a/fml/au_fml_0002.fml b/fml/au_fml_0002.fml new file mode 100644 index 0000000..98dea3a --- /dev/null +++ b/fml/au_fml_0002.fml @@ -0,0 +1,13 @@ +# +# AU_FML_0002.fml - 승인한도 FML 필드 테이블 (UBF 필드 정의) +# *base 140 +# +# name rel-number type flags comments +AU_FML_0002_KEY 1 string - 처리키 +AU_FML_0002_MERCHID 2 string - 가맹점번호 +AU_FML_0002_CARDNO 3 string - 카드번호(마스킹) +AU_FML_0002_AMOUNT 4 long - 거래금액 +AU_FML_0002_BIZDATE 5 string - 영업일 +AU_FML_0002_STATUS 6 char - 상태코드 +AU_FML_0002_FEE 7 long - 수수료 +AU_FML_0002_RESPCODE 8 string - 응답코드 diff --git a/fml/au_fml_0003.fml b/fml/au_fml_0003.fml new file mode 100644 index 0000000..0ef1736 --- /dev/null +++ b/fml/au_fml_0003.fml @@ -0,0 +1,13 @@ +# +# AU_FML_0003.fml - 승인한도 FML 필드 테이블 (UBF 필드 정의) +# *base 160 +# +# name rel-number type flags comments +AU_FML_0003_KEY 1 string - 처리키 +AU_FML_0003_MERCHID 2 string - 가맹점번호 +AU_FML_0003_CARDNO 3 string - 카드번호(마스킹) +AU_FML_0003_AMOUNT 4 long - 거래금액 +AU_FML_0003_BIZDATE 5 string - 영업일 +AU_FML_0003_STATUS 6 char - 상태코드 +AU_FML_0003_FEE 7 long - 수수료 +AU_FML_0003_RESPCODE 8 string - 응답코드 diff --git a/fml/au_fml_0004.fml b/fml/au_fml_0004.fml new file mode 100644 index 0000000..535367f --- /dev/null +++ b/fml/au_fml_0004.fml @@ -0,0 +1,13 @@ +# +# AU_FML_0004.fml - 승인한도 FML 필드 테이블 (UBF 필드 정의) +# *base 180 +# +# name rel-number type flags comments +AU_FML_0004_KEY 1 string - 처리키 +AU_FML_0004_MERCHID 2 string - 가맹점번호 +AU_FML_0004_CARDNO 3 string - 카드번호(마스킹) +AU_FML_0004_AMOUNT 4 long - 거래금액 +AU_FML_0004_BIZDATE 5 string - 영업일 +AU_FML_0004_STATUS 6 char - 상태코드 +AU_FML_0004_FEE 7 long - 수수료 +AU_FML_0004_RESPCODE 8 string - 응답코드 diff --git a/fml/au_fml_0005.fml b/fml/au_fml_0005.fml new file mode 100644 index 0000000..8cad817 --- /dev/null +++ b/fml/au_fml_0005.fml @@ -0,0 +1,13 @@ +# +# AU_FML_0005.fml - 승인한도 FML 필드 테이블 (UBF 필드 정의) +# *base 110 +# +# name rel-number type flags comments +AU_FML_0005_KEY 1 string - 처리키 +AU_FML_0005_MERCHID 2 string - 가맹점번호 +AU_FML_0005_CARDNO 3 string - 카드번호(마스킹) +AU_FML_0005_AMOUNT 4 long - 거래금액 +AU_FML_0005_BIZDATE 5 string - 영업일 +AU_FML_0005_STATUS 6 char - 상태코드 +AU_FML_0005_FEE 7 long - 수수료 +AU_FML_0005_RESPCODE 8 string - 응답코드 diff --git a/fml/au_fml_0006.fml b/fml/au_fml_0006.fml new file mode 100644 index 0000000..887327e --- /dev/null +++ b/fml/au_fml_0006.fml @@ -0,0 +1,13 @@ +# +# AU_FML_0006.fml - 승인한도 FML 필드 테이블 (UBF 필드 정의) +# *base 130 +# +# name rel-number type flags comments +AU_FML_0006_KEY 1 string - 처리키 +AU_FML_0006_MERCHID 2 string - 가맹점번호 +AU_FML_0006_CARDNO 3 string - 카드번호(마스킹) +AU_FML_0006_AMOUNT 4 long - 거래금액 +AU_FML_0006_BIZDATE 5 string - 영업일 +AU_FML_0006_STATUS 6 char - 상태코드 +AU_FML_0006_FEE 7 long - 수수료 +AU_FML_0006_RESPCODE 8 string - 응답코드 diff --git a/fml/au_fml_0007.fml b/fml/au_fml_0007.fml new file mode 100644 index 0000000..ce4f304 --- /dev/null +++ b/fml/au_fml_0007.fml @@ -0,0 +1,13 @@ +# +# AU_FML_0007.fml - 승인한도 FML 필드 테이블 (UBF 필드 정의) +# *base 150 +# +# name rel-number type flags comments +AU_FML_0007_KEY 1 string - 처리키 +AU_FML_0007_MERCHID 2 string - 가맹점번호 +AU_FML_0007_CARDNO 3 string - 카드번호(마스킹) +AU_FML_0007_AMOUNT 4 long - 거래금액 +AU_FML_0007_BIZDATE 5 string - 영업일 +AU_FML_0007_STATUS 6 char - 상태코드 +AU_FML_0007_FEE 7 long - 수수료 +AU_FML_0007_RESPCODE 8 string - 응답코드 diff --git a/fml/au_fml_0008.fml b/fml/au_fml_0008.fml new file mode 100644 index 0000000..43ded77 --- /dev/null +++ b/fml/au_fml_0008.fml @@ -0,0 +1,13 @@ +# +# AU_FML_0008.fml - 승인한도 FML 필드 테이블 (UBF 필드 정의) +# *base 170 +# +# name rel-number type flags comments +AU_FML_0008_KEY 1 string - 처리키 +AU_FML_0008_MERCHID 2 string - 가맹점번호 +AU_FML_0008_CARDNO 3 string - 카드번호(마스킹) +AU_FML_0008_AMOUNT 4 long - 거래금액 +AU_FML_0008_BIZDATE 5 string - 영업일 +AU_FML_0008_STATUS 6 char - 상태코드 +AU_FML_0008_FEE 7 long - 수수료 +AU_FML_0008_RESPCODE 8 string - 응답코드 diff --git a/fml/au_fml_0009.fml b/fml/au_fml_0009.fml new file mode 100644 index 0000000..1a79ee0 --- /dev/null +++ b/fml/au_fml_0009.fml @@ -0,0 +1,13 @@ +# +# AU_FML_0009.fml - 승인한도 FML 필드 테이블 (UBF 필드 정의) +# *base 190 +# +# name rel-number type flags comments +AU_FML_0009_KEY 1 string - 처리키 +AU_FML_0009_MERCHID 2 string - 가맹점번호 +AU_FML_0009_CARDNO 3 string - 카드번호(마스킹) +AU_FML_0009_AMOUNT 4 long - 거래금액 +AU_FML_0009_BIZDATE 5 string - 영업일 +AU_FML_0009_STATUS 6 char - 상태코드 +AU_FML_0009_FEE 7 long - 수수료 +AU_FML_0009_RESPCODE 8 string - 응답코드 diff --git a/fml/au_fml_0010.fml b/fml/au_fml_0010.fml new file mode 100644 index 0000000..cafefec --- /dev/null +++ b/fml/au_fml_0010.fml @@ -0,0 +1,13 @@ +# +# AU_FML_0010.fml - 승인한도 FML 필드 테이블 (UBF 필드 정의) +# *base 120 +# +# name rel-number type flags comments +AU_FML_0010_KEY 1 string - 처리키 +AU_FML_0010_MERCHID 2 string - 가맹점번호 +AU_FML_0010_CARDNO 3 string - 카드번호(마스킹) +AU_FML_0010_AMOUNT 4 long - 거래금액 +AU_FML_0010_BIZDATE 5 string - 영업일 +AU_FML_0010_STATUS 6 char - 상태코드 +AU_FML_0010_FEE 7 long - 수수료 +AU_FML_0010_RESPCODE 8 string - 응답코드 diff --git a/fml/au_fml_0011.fml b/fml/au_fml_0011.fml new file mode 100644 index 0000000..1e8be1c --- /dev/null +++ b/fml/au_fml_0011.fml @@ -0,0 +1,13 @@ +# +# AU_FML_0011.fml - 승인한도 FML 필드 테이블 (UBF 필드 정의) +# *base 140 +# +# name rel-number type flags comments +AU_FML_0011_KEY 1 string - 처리키 +AU_FML_0011_MERCHID 2 string - 가맹점번호 +AU_FML_0011_CARDNO 3 string - 카드번호(마스킹) +AU_FML_0011_AMOUNT 4 long - 거래금액 +AU_FML_0011_BIZDATE 5 string - 영업일 +AU_FML_0011_STATUS 6 char - 상태코드 +AU_FML_0011_FEE 7 long - 수수료 +AU_FML_0011_RESPCODE 8 string - 응답코드 diff --git a/fml/cl_fml_0001.fml b/fml/cl_fml_0001.fml new file mode 100644 index 0000000..8dd4f75 --- /dev/null +++ b/fml/cl_fml_0001.fml @@ -0,0 +1,13 @@ +# +# CL_FML_0001.fml - 마감 FML 필드 테이블 (UBF 필드 정의) +# *base 120 +# +# name rel-number type flags comments +CL_FML_0001_KEY 1 string - 처리키 +CL_FML_0001_MERCHID 2 string - 가맹점번호 +CL_FML_0001_CARDNO 3 string - 카드번호(마스킹) +CL_FML_0001_AMOUNT 4 long - 거래금액 +CL_FML_0001_BIZDATE 5 string - 영업일 +CL_FML_0001_STATUS 6 char - 상태코드 +CL_FML_0001_FEE 7 long - 수수료 +CL_FML_0001_RESPCODE 8 string - 응답코드 diff --git a/fml/cl_fml_0002.fml b/fml/cl_fml_0002.fml new file mode 100644 index 0000000..b1d7ba8 --- /dev/null +++ b/fml/cl_fml_0002.fml @@ -0,0 +1,13 @@ +# +# CL_FML_0002.fml - 마감 FML 필드 테이블 (UBF 필드 정의) +# *base 140 +# +# name rel-number type flags comments +CL_FML_0002_KEY 1 string - 처리키 +CL_FML_0002_MERCHID 2 string - 가맹점번호 +CL_FML_0002_CARDNO 3 string - 카드번호(마스킹) +CL_FML_0002_AMOUNT 4 long - 거래금액 +CL_FML_0002_BIZDATE 5 string - 영업일 +CL_FML_0002_STATUS 6 char - 상태코드 +CL_FML_0002_FEE 7 long - 수수료 +CL_FML_0002_RESPCODE 8 string - 응답코드 diff --git a/fml/cl_fml_0003.fml b/fml/cl_fml_0003.fml new file mode 100644 index 0000000..b052551 --- /dev/null +++ b/fml/cl_fml_0003.fml @@ -0,0 +1,13 @@ +# +# CL_FML_0003.fml - 마감 FML 필드 테이블 (UBF 필드 정의) +# *base 160 +# +# name rel-number type flags comments +CL_FML_0003_KEY 1 string - 처리키 +CL_FML_0003_MERCHID 2 string - 가맹점번호 +CL_FML_0003_CARDNO 3 string - 카드번호(마스킹) +CL_FML_0003_AMOUNT 4 long - 거래금액 +CL_FML_0003_BIZDATE 5 string - 영업일 +CL_FML_0003_STATUS 6 char - 상태코드 +CL_FML_0003_FEE 7 long - 수수료 +CL_FML_0003_RESPCODE 8 string - 응답코드 diff --git a/fml/cl_fml_0004.fml b/fml/cl_fml_0004.fml new file mode 100644 index 0000000..dd160f2 --- /dev/null +++ b/fml/cl_fml_0004.fml @@ -0,0 +1,13 @@ +# +# CL_FML_0004.fml - 마감 FML 필드 테이블 (UBF 필드 정의) +# *base 180 +# +# name rel-number type flags comments +CL_FML_0004_KEY 1 string - 처리키 +CL_FML_0004_MERCHID 2 string - 가맹점번호 +CL_FML_0004_CARDNO 3 string - 카드번호(마스킹) +CL_FML_0004_AMOUNT 4 long - 거래금액 +CL_FML_0004_BIZDATE 5 string - 영업일 +CL_FML_0004_STATUS 6 char - 상태코드 +CL_FML_0004_FEE 7 long - 수수료 +CL_FML_0004_RESPCODE 8 string - 응답코드 diff --git a/fml/cl_fml_0005.fml b/fml/cl_fml_0005.fml new file mode 100644 index 0000000..c13b75a --- /dev/null +++ b/fml/cl_fml_0005.fml @@ -0,0 +1,13 @@ +# +# CL_FML_0005.fml - 마감 FML 필드 테이블 (UBF 필드 정의) +# *base 110 +# +# name rel-number type flags comments +CL_FML_0005_KEY 1 string - 처리키 +CL_FML_0005_MERCHID 2 string - 가맹점번호 +CL_FML_0005_CARDNO 3 string - 카드번호(마스킹) +CL_FML_0005_AMOUNT 4 long - 거래금액 +CL_FML_0005_BIZDATE 5 string - 영업일 +CL_FML_0005_STATUS 6 char - 상태코드 +CL_FML_0005_FEE 7 long - 수수료 +CL_FML_0005_RESPCODE 8 string - 응답코드 diff --git a/fml/cl_fml_0006.fml b/fml/cl_fml_0006.fml new file mode 100644 index 0000000..d9a4e7f --- /dev/null +++ b/fml/cl_fml_0006.fml @@ -0,0 +1,13 @@ +# +# CL_FML_0006.fml - 마감 FML 필드 테이블 (UBF 필드 정의) +# *base 130 +# +# name rel-number type flags comments +CL_FML_0006_KEY 1 string - 처리키 +CL_FML_0006_MERCHID 2 string - 가맹점번호 +CL_FML_0006_CARDNO 3 string - 카드번호(마스킹) +CL_FML_0006_AMOUNT 4 long - 거래금액 +CL_FML_0006_BIZDATE 5 string - 영업일 +CL_FML_0006_STATUS 6 char - 상태코드 +CL_FML_0006_FEE 7 long - 수수료 +CL_FML_0006_RESPCODE 8 string - 응답코드 diff --git a/fml/cl_fml_0007.fml b/fml/cl_fml_0007.fml new file mode 100644 index 0000000..7eb0c32 --- /dev/null +++ b/fml/cl_fml_0007.fml @@ -0,0 +1,13 @@ +# +# CL_FML_0007.fml - 마감 FML 필드 테이블 (UBF 필드 정의) +# *base 150 +# +# name rel-number type flags comments +CL_FML_0007_KEY 1 string - 처리키 +CL_FML_0007_MERCHID 2 string - 가맹점번호 +CL_FML_0007_CARDNO 3 string - 카드번호(마스킹) +CL_FML_0007_AMOUNT 4 long - 거래금액 +CL_FML_0007_BIZDATE 5 string - 영업일 +CL_FML_0007_STATUS 6 char - 상태코드 +CL_FML_0007_FEE 7 long - 수수료 +CL_FML_0007_RESPCODE 8 string - 응답코드 diff --git a/fml/cl_fml_0008.fml b/fml/cl_fml_0008.fml new file mode 100644 index 0000000..c431e53 --- /dev/null +++ b/fml/cl_fml_0008.fml @@ -0,0 +1,13 @@ +# +# CL_FML_0008.fml - 마감 FML 필드 테이블 (UBF 필드 정의) +# *base 170 +# +# name rel-number type flags comments +CL_FML_0008_KEY 1 string - 처리키 +CL_FML_0008_MERCHID 2 string - 가맹점번호 +CL_FML_0008_CARDNO 3 string - 카드번호(마스킹) +CL_FML_0008_AMOUNT 4 long - 거래금액 +CL_FML_0008_BIZDATE 5 string - 영업일 +CL_FML_0008_STATUS 6 char - 상태코드 +CL_FML_0008_FEE 7 long - 수수료 +CL_FML_0008_RESPCODE 8 string - 응답코드 diff --git a/fml/cl_fml_0009.fml b/fml/cl_fml_0009.fml new file mode 100644 index 0000000..4f6eb5d --- /dev/null +++ b/fml/cl_fml_0009.fml @@ -0,0 +1,13 @@ +# +# CL_FML_0009.fml - 마감 FML 필드 테이블 (UBF 필드 정의) +# *base 190 +# +# name rel-number type flags comments +CL_FML_0009_KEY 1 string - 처리키 +CL_FML_0009_MERCHID 2 string - 가맹점번호 +CL_FML_0009_CARDNO 3 string - 카드번호(마스킹) +CL_FML_0009_AMOUNT 4 long - 거래금액 +CL_FML_0009_BIZDATE 5 string - 영업일 +CL_FML_0009_STATUS 6 char - 상태코드 +CL_FML_0009_FEE 7 long - 수수료 +CL_FML_0009_RESPCODE 8 string - 응답코드 diff --git a/fml/cl_fml_0010.fml b/fml/cl_fml_0010.fml new file mode 100644 index 0000000..53e3f48 --- /dev/null +++ b/fml/cl_fml_0010.fml @@ -0,0 +1,13 @@ +# +# CL_FML_0010.fml - 마감 FML 필드 테이블 (UBF 필드 정의) +# *base 120 +# +# name rel-number type flags comments +CL_FML_0010_KEY 1 string - 처리키 +CL_FML_0010_MERCHID 2 string - 가맹점번호 +CL_FML_0010_CARDNO 3 string - 카드번호(마스킹) +CL_FML_0010_AMOUNT 4 long - 거래금액 +CL_FML_0010_BIZDATE 5 string - 영업일 +CL_FML_0010_STATUS 6 char - 상태코드 +CL_FML_0010_FEE 7 long - 수수료 +CL_FML_0010_RESPCODE 8 string - 응답코드 diff --git a/fml/cm_fml_0001.fml b/fml/cm_fml_0001.fml new file mode 100644 index 0000000..0efbc6b --- /dev/null +++ b/fml/cm_fml_0001.fml @@ -0,0 +1,13 @@ +# +# CM_FML_0001.fml - 공통 FML 필드 테이블 (UBF 필드 정의) +# *base 110 +# +# name rel-number type flags comments +CM_FML_0001_KEY 1 string - 처리키 +CM_FML_0001_MERCHID 2 string - 가맹점번호 +CM_FML_0001_CARDNO 3 string - 카드번호(마스킹) +CM_FML_0001_AMOUNT 4 long - 거래금액 +CM_FML_0001_BIZDATE 5 string - 영업일 +CM_FML_0001_STATUS 6 char - 상태코드 +CM_FML_0001_FEE 7 long - 수수료 +CM_FML_0001_RESPCODE 8 string - 응답코드 diff --git a/fml/cm_fml_0002.fml b/fml/cm_fml_0002.fml new file mode 100644 index 0000000..f074f96 --- /dev/null +++ b/fml/cm_fml_0002.fml @@ -0,0 +1,13 @@ +# +# CM_FML_0002.fml - 공통 FML 필드 테이블 (UBF 필드 정의) +# *base 130 +# +# name rel-number type flags comments +CM_FML_0002_KEY 1 string - 처리키 +CM_FML_0002_MERCHID 2 string - 가맹점번호 +CM_FML_0002_CARDNO 3 string - 카드번호(마스킹) +CM_FML_0002_AMOUNT 4 long - 거래금액 +CM_FML_0002_BIZDATE 5 string - 영업일 +CM_FML_0002_STATUS 6 char - 상태코드 +CM_FML_0002_FEE 7 long - 수수료 +CM_FML_0002_RESPCODE 8 string - 응답코드 diff --git a/fml/cm_fml_0003.fml b/fml/cm_fml_0003.fml new file mode 100644 index 0000000..06f5853 --- /dev/null +++ b/fml/cm_fml_0003.fml @@ -0,0 +1,13 @@ +# +# CM_FML_0003.fml - 공통 FML 필드 테이블 (UBF 필드 정의) +# *base 150 +# +# name rel-number type flags comments +CM_FML_0003_KEY 1 string - 처리키 +CM_FML_0003_MERCHID 2 string - 가맹점번호 +CM_FML_0003_CARDNO 3 string - 카드번호(마스킹) +CM_FML_0003_AMOUNT 4 long - 거래금액 +CM_FML_0003_BIZDATE 5 string - 영업일 +CM_FML_0003_STATUS 6 char - 상태코드 +CM_FML_0003_FEE 7 long - 수수료 +CM_FML_0003_RESPCODE 8 string - 응답코드 diff --git a/fml/cm_fml_0004.fml b/fml/cm_fml_0004.fml new file mode 100644 index 0000000..235f0b6 --- /dev/null +++ b/fml/cm_fml_0004.fml @@ -0,0 +1,13 @@ +# +# CM_FML_0004.fml - 공통 FML 필드 테이블 (UBF 필드 정의) +# *base 170 +# +# name rel-number type flags comments +CM_FML_0004_KEY 1 string - 처리키 +CM_FML_0004_MERCHID 2 string - 가맹점번호 +CM_FML_0004_CARDNO 3 string - 카드번호(마스킹) +CM_FML_0004_AMOUNT 4 long - 거래금액 +CM_FML_0004_BIZDATE 5 string - 영업일 +CM_FML_0004_STATUS 6 char - 상태코드 +CM_FML_0004_FEE 7 long - 수수료 +CM_FML_0004_RESPCODE 8 string - 응답코드 diff --git a/fml/cm_fml_0005.fml b/fml/cm_fml_0005.fml new file mode 100644 index 0000000..3c4c446 --- /dev/null +++ b/fml/cm_fml_0005.fml @@ -0,0 +1,13 @@ +# +# CM_FML_0005.fml - 공통 FML 필드 테이블 (UBF 필드 정의) +# *base 190 +# +# name rel-number type flags comments +CM_FML_0005_KEY 1 string - 처리키 +CM_FML_0005_MERCHID 2 string - 가맹점번호 +CM_FML_0005_CARDNO 3 string - 카드번호(마스킹) +CM_FML_0005_AMOUNT 4 long - 거래금액 +CM_FML_0005_BIZDATE 5 string - 영업일 +CM_FML_0005_STATUS 6 char - 상태코드 +CM_FML_0005_FEE 7 long - 수수료 +CM_FML_0005_RESPCODE 8 string - 응답코드 diff --git a/fml/cm_fml_0006.fml b/fml/cm_fml_0006.fml new file mode 100644 index 0000000..f5ff0d7 --- /dev/null +++ b/fml/cm_fml_0006.fml @@ -0,0 +1,13 @@ +# +# CM_FML_0006.fml - 공통 FML 필드 테이블 (UBF 필드 정의) +# *base 120 +# +# name rel-number type flags comments +CM_FML_0006_KEY 1 string - 처리키 +CM_FML_0006_MERCHID 2 string - 가맹점번호 +CM_FML_0006_CARDNO 3 string - 카드번호(마스킹) +CM_FML_0006_AMOUNT 4 long - 거래금액 +CM_FML_0006_BIZDATE 5 string - 영업일 +CM_FML_0006_STATUS 6 char - 상태코드 +CM_FML_0006_FEE 7 long - 수수료 +CM_FML_0006_RESPCODE 8 string - 응답코드 diff --git a/fml/cm_fml_0007.fml b/fml/cm_fml_0007.fml new file mode 100644 index 0000000..543e4e5 --- /dev/null +++ b/fml/cm_fml_0007.fml @@ -0,0 +1,13 @@ +# +# CM_FML_0007.fml - 공통 FML 필드 테이블 (UBF 필드 정의) +# *base 140 +# +# name rel-number type flags comments +CM_FML_0007_KEY 1 string - 처리키 +CM_FML_0007_MERCHID 2 string - 가맹점번호 +CM_FML_0007_CARDNO 3 string - 카드번호(마스킹) +CM_FML_0007_AMOUNT 4 long - 거래금액 +CM_FML_0007_BIZDATE 5 string - 영업일 +CM_FML_0007_STATUS 6 char - 상태코드 +CM_FML_0007_FEE 7 long - 수수료 +CM_FML_0007_RESPCODE 8 string - 응답코드 diff --git a/fml/cm_fml_0008.fml b/fml/cm_fml_0008.fml new file mode 100644 index 0000000..78c70a1 --- /dev/null +++ b/fml/cm_fml_0008.fml @@ -0,0 +1,13 @@ +# +# CM_FML_0008.fml - 공통 FML 필드 테이블 (UBF 필드 정의) +# *base 160 +# +# name rel-number type flags comments +CM_FML_0008_KEY 1 string - 처리키 +CM_FML_0008_MERCHID 2 string - 가맹점번호 +CM_FML_0008_CARDNO 3 string - 카드번호(마스킹) +CM_FML_0008_AMOUNT 4 long - 거래금액 +CM_FML_0008_BIZDATE 5 string - 영업일 +CM_FML_0008_STATUS 6 char - 상태코드 +CM_FML_0008_FEE 7 long - 수수료 +CM_FML_0008_RESPCODE 8 string - 응답코드 diff --git a/fml/cm_fml_0009.fml b/fml/cm_fml_0009.fml new file mode 100644 index 0000000..3bfd22a --- /dev/null +++ b/fml/cm_fml_0009.fml @@ -0,0 +1,13 @@ +# +# CM_FML_0009.fml - 공통 FML 필드 테이블 (UBF 필드 정의) +# *base 180 +# +# name rel-number type flags comments +CM_FML_0009_KEY 1 string - 처리키 +CM_FML_0009_MERCHID 2 string - 가맹점번호 +CM_FML_0009_CARDNO 3 string - 카드번호(마스킹) +CM_FML_0009_AMOUNT 4 long - 거래금액 +CM_FML_0009_BIZDATE 5 string - 영업일 +CM_FML_0009_STATUS 6 char - 상태코드 +CM_FML_0009_FEE 7 long - 수수료 +CM_FML_0009_RESPCODE 8 string - 응답코드 diff --git a/fml/cm_fml_0010.fml b/fml/cm_fml_0010.fml new file mode 100644 index 0000000..93ce7f7 --- /dev/null +++ b/fml/cm_fml_0010.fml @@ -0,0 +1,13 @@ +# +# CM_FML_0010.fml - 공통 FML 필드 테이블 (UBF 필드 정의) +# *base 110 +# +# name rel-number type flags comments +CM_FML_0010_KEY 1 string - 처리키 +CM_FML_0010_MERCHID 2 string - 가맹점번호 +CM_FML_0010_CARDNO 3 string - 카드번호(마스킹) +CM_FML_0010_AMOUNT 4 long - 거래금액 +CM_FML_0010_BIZDATE 5 string - 영업일 +CM_FML_0010_STATUS 6 char - 상태코드 +CM_FML_0010_FEE 7 long - 수수료 +CM_FML_0010_RESPCODE 8 string - 응답코드 diff --git a/fml/cm_fml_0011.fml b/fml/cm_fml_0011.fml new file mode 100644 index 0000000..0f5be54 --- /dev/null +++ b/fml/cm_fml_0011.fml @@ -0,0 +1,13 @@ +# +# CM_FML_0011.fml - 공통 FML 필드 테이블 (UBF 필드 정의) +# *base 130 +# +# name rel-number type flags comments +CM_FML_0011_KEY 1 string - 처리키 +CM_FML_0011_MERCHID 2 string - 가맹점번호 +CM_FML_0011_CARDNO 3 string - 카드번호(마스킹) +CM_FML_0011_AMOUNT 4 long - 거래금액 +CM_FML_0011_BIZDATE 5 string - 영업일 +CM_FML_0011_STATUS 6 char - 상태코드 +CM_FML_0011_FEE 7 long - 수수료 +CM_FML_0011_RESPCODE 8 string - 응답코드 diff --git a/fml/lg_fml_0001.fml b/fml/lg_fml_0001.fml new file mode 100644 index 0000000..26f1c00 --- /dev/null +++ b/fml/lg_fml_0001.fml @@ -0,0 +1,13 @@ +# +# LG_FML_0001.fml - 원장 FML 필드 테이블 (UBF 필드 정의) +# *base 180 +# +# name rel-number type flags comments +LG_FML_0001_KEY 1 string - 처리키 +LG_FML_0001_MERCHID 2 string - 가맹점번호 +LG_FML_0001_CARDNO 3 string - 카드번호(마스킹) +LG_FML_0001_AMOUNT 4 long - 거래금액 +LG_FML_0001_BIZDATE 5 string - 영업일 +LG_FML_0001_STATUS 6 char - 상태코드 +LG_FML_0001_FEE 7 long - 수수료 +LG_FML_0001_RESPCODE 8 string - 응답코드 diff --git a/fml/lg_fml_0002.fml b/fml/lg_fml_0002.fml new file mode 100644 index 0000000..a88cfd5 --- /dev/null +++ b/fml/lg_fml_0002.fml @@ -0,0 +1,13 @@ +# +# LG_FML_0002.fml - 원장 FML 필드 테이블 (UBF 필드 정의) +# *base 110 +# +# name rel-number type flags comments +LG_FML_0002_KEY 1 string - 처리키 +LG_FML_0002_MERCHID 2 string - 가맹점번호 +LG_FML_0002_CARDNO 3 string - 카드번호(마스킹) +LG_FML_0002_AMOUNT 4 long - 거래금액 +LG_FML_0002_BIZDATE 5 string - 영업일 +LG_FML_0002_STATUS 6 char - 상태코드 +LG_FML_0002_FEE 7 long - 수수료 +LG_FML_0002_RESPCODE 8 string - 응답코드 diff --git a/fml/lg_fml_0003.fml b/fml/lg_fml_0003.fml new file mode 100644 index 0000000..f246df7 --- /dev/null +++ b/fml/lg_fml_0003.fml @@ -0,0 +1,13 @@ +# +# LG_FML_0003.fml - 원장 FML 필드 테이블 (UBF 필드 정의) +# *base 130 +# +# name rel-number type flags comments +LG_FML_0003_KEY 1 string - 처리키 +LG_FML_0003_MERCHID 2 string - 가맹점번호 +LG_FML_0003_CARDNO 3 string - 카드번호(마스킹) +LG_FML_0003_AMOUNT 4 long - 거래금액 +LG_FML_0003_BIZDATE 5 string - 영업일 +LG_FML_0003_STATUS 6 char - 상태코드 +LG_FML_0003_FEE 7 long - 수수료 +LG_FML_0003_RESPCODE 8 string - 응답코드 diff --git a/fml/lg_fml_0004.fml b/fml/lg_fml_0004.fml new file mode 100644 index 0000000..c2d4454 --- /dev/null +++ b/fml/lg_fml_0004.fml @@ -0,0 +1,13 @@ +# +# LG_FML_0004.fml - 원장 FML 필드 테이블 (UBF 필드 정의) +# *base 150 +# +# name rel-number type flags comments +LG_FML_0004_KEY 1 string - 처리키 +LG_FML_0004_MERCHID 2 string - 가맹점번호 +LG_FML_0004_CARDNO 3 string - 카드번호(마스킹) +LG_FML_0004_AMOUNT 4 long - 거래금액 +LG_FML_0004_BIZDATE 5 string - 영업일 +LG_FML_0004_STATUS 6 char - 상태코드 +LG_FML_0004_FEE 7 long - 수수료 +LG_FML_0004_RESPCODE 8 string - 응답코드 diff --git a/fml/lg_fml_0005.fml b/fml/lg_fml_0005.fml new file mode 100644 index 0000000..2d12fda --- /dev/null +++ b/fml/lg_fml_0005.fml @@ -0,0 +1,13 @@ +# +# LG_FML_0005.fml - 원장 FML 필드 테이블 (UBF 필드 정의) +# *base 170 +# +# name rel-number type flags comments +LG_FML_0005_KEY 1 string - 처리키 +LG_FML_0005_MERCHID 2 string - 가맹점번호 +LG_FML_0005_CARDNO 3 string - 카드번호(마스킹) +LG_FML_0005_AMOUNT 4 long - 거래금액 +LG_FML_0005_BIZDATE 5 string - 영업일 +LG_FML_0005_STATUS 6 char - 상태코드 +LG_FML_0005_FEE 7 long - 수수료 +LG_FML_0005_RESPCODE 8 string - 응답코드 diff --git a/fml/lg_fml_0006.fml b/fml/lg_fml_0006.fml new file mode 100644 index 0000000..60be0d8 --- /dev/null +++ b/fml/lg_fml_0006.fml @@ -0,0 +1,13 @@ +# +# LG_FML_0006.fml - 원장 FML 필드 테이블 (UBF 필드 정의) +# *base 190 +# +# name rel-number type flags comments +LG_FML_0006_KEY 1 string - 처리키 +LG_FML_0006_MERCHID 2 string - 가맹점번호 +LG_FML_0006_CARDNO 3 string - 카드번호(마스킹) +LG_FML_0006_AMOUNT 4 long - 거래금액 +LG_FML_0006_BIZDATE 5 string - 영업일 +LG_FML_0006_STATUS 6 char - 상태코드 +LG_FML_0006_FEE 7 long - 수수료 +LG_FML_0006_RESPCODE 8 string - 응답코드 diff --git a/fml/lg_fml_0007.fml b/fml/lg_fml_0007.fml new file mode 100644 index 0000000..96ec5eb --- /dev/null +++ b/fml/lg_fml_0007.fml @@ -0,0 +1,13 @@ +# +# LG_FML_0007.fml - 원장 FML 필드 테이블 (UBF 필드 정의) +# *base 120 +# +# name rel-number type flags comments +LG_FML_0007_KEY 1 string - 처리키 +LG_FML_0007_MERCHID 2 string - 가맹점번호 +LG_FML_0007_CARDNO 3 string - 카드번호(마스킹) +LG_FML_0007_AMOUNT 4 long - 거래금액 +LG_FML_0007_BIZDATE 5 string - 영업일 +LG_FML_0007_STATUS 6 char - 상태코드 +LG_FML_0007_FEE 7 long - 수수료 +LG_FML_0007_RESPCODE 8 string - 응답코드 diff --git a/fml/lg_fml_0008.fml b/fml/lg_fml_0008.fml new file mode 100644 index 0000000..885561a --- /dev/null +++ b/fml/lg_fml_0008.fml @@ -0,0 +1,13 @@ +# +# LG_FML_0008.fml - 원장 FML 필드 테이블 (UBF 필드 정의) +# *base 140 +# +# name rel-number type flags comments +LG_FML_0008_KEY 1 string - 처리키 +LG_FML_0008_MERCHID 2 string - 가맹점번호 +LG_FML_0008_CARDNO 3 string - 카드번호(마스킹) +LG_FML_0008_AMOUNT 4 long - 거래금액 +LG_FML_0008_BIZDATE 5 string - 영업일 +LG_FML_0008_STATUS 6 char - 상태코드 +LG_FML_0008_FEE 7 long - 수수료 +LG_FML_0008_RESPCODE 8 string - 응답코드 diff --git a/fml/lg_fml_0009.fml b/fml/lg_fml_0009.fml new file mode 100644 index 0000000..3072400 --- /dev/null +++ b/fml/lg_fml_0009.fml @@ -0,0 +1,13 @@ +# +# LG_FML_0009.fml - 원장 FML 필드 테이블 (UBF 필드 정의) +# *base 160 +# +# name rel-number type flags comments +LG_FML_0009_KEY 1 string - 처리키 +LG_FML_0009_MERCHID 2 string - 가맹점번호 +LG_FML_0009_CARDNO 3 string - 카드번호(마스킹) +LG_FML_0009_AMOUNT 4 long - 거래금액 +LG_FML_0009_BIZDATE 5 string - 영업일 +LG_FML_0009_STATUS 6 char - 상태코드 +LG_FML_0009_FEE 7 long - 수수료 +LG_FML_0009_RESPCODE 8 string - 응답코드 diff --git a/fml/lg_fml_0010.fml b/fml/lg_fml_0010.fml new file mode 100644 index 0000000..a3e548d --- /dev/null +++ b/fml/lg_fml_0010.fml @@ -0,0 +1,13 @@ +# +# LG_FML_0010.fml - 원장 FML 필드 테이블 (UBF 필드 정의) +# *base 180 +# +# name rel-number type flags comments +LG_FML_0010_KEY 1 string - 처리키 +LG_FML_0010_MERCHID 2 string - 가맹점번호 +LG_FML_0010_CARDNO 3 string - 카드번호(마스킹) +LG_FML_0010_AMOUNT 4 long - 거래금액 +LG_FML_0010_BIZDATE 5 string - 영업일 +LG_FML_0010_STATUS 6 char - 상태코드 +LG_FML_0010_FEE 7 long - 수수료 +LG_FML_0010_RESPCODE 8 string - 응답코드 diff --git a/fml/lg_fml_0011.fml b/fml/lg_fml_0011.fml new file mode 100644 index 0000000..ab03fd8 --- /dev/null +++ b/fml/lg_fml_0011.fml @@ -0,0 +1,13 @@ +# +# LG_FML_0011.fml - 원장 FML 필드 테이블 (UBF 필드 정의) +# *base 110 +# +# name rel-number type flags comments +LG_FML_0011_KEY 1 string - 처리키 +LG_FML_0011_MERCHID 2 string - 가맹점번호 +LG_FML_0011_CARDNO 3 string - 카드번호(마스킹) +LG_FML_0011_AMOUNT 4 long - 거래금액 +LG_FML_0011_BIZDATE 5 string - 영업일 +LG_FML_0011_STATUS 6 char - 상태코드 +LG_FML_0011_FEE 7 long - 수수료 +LG_FML_0011_RESPCODE 8 string - 응답코드 diff --git a/fml/mg_fml_0001.fml b/fml/mg_fml_0001.fml new file mode 100644 index 0000000..50164bd --- /dev/null +++ b/fml/mg_fml_0001.fml @@ -0,0 +1,13 @@ +# +# MG_FML_0001.fml - 전문게이트웨이 FML 필드 테이블 (UBF 필드 정의) +# *base 110 +# +# name rel-number type flags comments +MG_FML_0001_KEY 1 string - 처리키 +MG_FML_0001_MERCHID 2 string - 가맹점번호 +MG_FML_0001_CARDNO 3 string - 카드번호(마스킹) +MG_FML_0001_AMOUNT 4 long - 거래금액 +MG_FML_0001_BIZDATE 5 string - 영업일 +MG_FML_0001_STATUS 6 char - 상태코드 +MG_FML_0001_FEE 7 long - 수수료 +MG_FML_0001_RESPCODE 8 string - 응답코드 diff --git a/fml/mg_fml_0002.fml b/fml/mg_fml_0002.fml new file mode 100644 index 0000000..2e15245 --- /dev/null +++ b/fml/mg_fml_0002.fml @@ -0,0 +1,13 @@ +# +# MG_FML_0002.fml - 전문게이트웨이 FML 필드 테이블 (UBF 필드 정의) +# *base 130 +# +# name rel-number type flags comments +MG_FML_0002_KEY 1 string - 처리키 +MG_FML_0002_MERCHID 2 string - 가맹점번호 +MG_FML_0002_CARDNO 3 string - 카드번호(마스킹) +MG_FML_0002_AMOUNT 4 long - 거래금액 +MG_FML_0002_BIZDATE 5 string - 영업일 +MG_FML_0002_STATUS 6 char - 상태코드 +MG_FML_0002_FEE 7 long - 수수료 +MG_FML_0002_RESPCODE 8 string - 응답코드 diff --git a/fml/mg_fml_0003.fml b/fml/mg_fml_0003.fml new file mode 100644 index 0000000..8db25ce --- /dev/null +++ b/fml/mg_fml_0003.fml @@ -0,0 +1,13 @@ +# +# MG_FML_0003.fml - 전문게이트웨이 FML 필드 테이블 (UBF 필드 정의) +# *base 150 +# +# name rel-number type flags comments +MG_FML_0003_KEY 1 string - 처리키 +MG_FML_0003_MERCHID 2 string - 가맹점번호 +MG_FML_0003_CARDNO 3 string - 카드번호(마스킹) +MG_FML_0003_AMOUNT 4 long - 거래금액 +MG_FML_0003_BIZDATE 5 string - 영업일 +MG_FML_0003_STATUS 6 char - 상태코드 +MG_FML_0003_FEE 7 long - 수수료 +MG_FML_0003_RESPCODE 8 string - 응답코드 diff --git a/fml/mg_fml_0004.fml b/fml/mg_fml_0004.fml new file mode 100644 index 0000000..14c875e --- /dev/null +++ b/fml/mg_fml_0004.fml @@ -0,0 +1,13 @@ +# +# MG_FML_0004.fml - 전문게이트웨이 FML 필드 테이블 (UBF 필드 정의) +# *base 170 +# +# name rel-number type flags comments +MG_FML_0004_KEY 1 string - 처리키 +MG_FML_0004_MERCHID 2 string - 가맹점번호 +MG_FML_0004_CARDNO 3 string - 카드번호(마스킹) +MG_FML_0004_AMOUNT 4 long - 거래금액 +MG_FML_0004_BIZDATE 5 string - 영업일 +MG_FML_0004_STATUS 6 char - 상태코드 +MG_FML_0004_FEE 7 long - 수수료 +MG_FML_0004_RESPCODE 8 string - 응답코드 diff --git a/fml/mg_fml_0005.fml b/fml/mg_fml_0005.fml new file mode 100644 index 0000000..9bc2770 --- /dev/null +++ b/fml/mg_fml_0005.fml @@ -0,0 +1,13 @@ +# +# MG_FML_0005.fml - 전문게이트웨이 FML 필드 테이블 (UBF 필드 정의) +# *base 190 +# +# name rel-number type flags comments +MG_FML_0005_KEY 1 string - 처리키 +MG_FML_0005_MERCHID 2 string - 가맹점번호 +MG_FML_0005_CARDNO 3 string - 카드번호(마스킹) +MG_FML_0005_AMOUNT 4 long - 거래금액 +MG_FML_0005_BIZDATE 5 string - 영업일 +MG_FML_0005_STATUS 6 char - 상태코드 +MG_FML_0005_FEE 7 long - 수수료 +MG_FML_0005_RESPCODE 8 string - 응답코드 diff --git a/fml/mg_fml_0006.fml b/fml/mg_fml_0006.fml new file mode 100644 index 0000000..d9a2fc2 --- /dev/null +++ b/fml/mg_fml_0006.fml @@ -0,0 +1,13 @@ +# +# MG_FML_0006.fml - 전문게이트웨이 FML 필드 테이블 (UBF 필드 정의) +# *base 120 +# +# name rel-number type flags comments +MG_FML_0006_KEY 1 string - 처리키 +MG_FML_0006_MERCHID 2 string - 가맹점번호 +MG_FML_0006_CARDNO 3 string - 카드번호(마스킹) +MG_FML_0006_AMOUNT 4 long - 거래금액 +MG_FML_0006_BIZDATE 5 string - 영업일 +MG_FML_0006_STATUS 6 char - 상태코드 +MG_FML_0006_FEE 7 long - 수수료 +MG_FML_0006_RESPCODE 8 string - 응답코드 diff --git a/fml/mg_fml_0007.fml b/fml/mg_fml_0007.fml new file mode 100644 index 0000000..1acbe51 --- /dev/null +++ b/fml/mg_fml_0007.fml @@ -0,0 +1,13 @@ +# +# MG_FML_0007.fml - 전문게이트웨이 FML 필드 테이블 (UBF 필드 정의) +# *base 140 +# +# name rel-number type flags comments +MG_FML_0007_KEY 1 string - 처리키 +MG_FML_0007_MERCHID 2 string - 가맹점번호 +MG_FML_0007_CARDNO 3 string - 카드번호(마스킹) +MG_FML_0007_AMOUNT 4 long - 거래금액 +MG_FML_0007_BIZDATE 5 string - 영업일 +MG_FML_0007_STATUS 6 char - 상태코드 +MG_FML_0007_FEE 7 long - 수수료 +MG_FML_0007_RESPCODE 8 string - 응답코드 diff --git a/fml/mg_fml_0008.fml b/fml/mg_fml_0008.fml new file mode 100644 index 0000000..94f1642 --- /dev/null +++ b/fml/mg_fml_0008.fml @@ -0,0 +1,13 @@ +# +# MG_FML_0008.fml - 전문게이트웨이 FML 필드 테이블 (UBF 필드 정의) +# *base 160 +# +# name rel-number type flags comments +MG_FML_0008_KEY 1 string - 처리키 +MG_FML_0008_MERCHID 2 string - 가맹점번호 +MG_FML_0008_CARDNO 3 string - 카드번호(마스킹) +MG_FML_0008_AMOUNT 4 long - 거래금액 +MG_FML_0008_BIZDATE 5 string - 영업일 +MG_FML_0008_STATUS 6 char - 상태코드 +MG_FML_0008_FEE 7 long - 수수료 +MG_FML_0008_RESPCODE 8 string - 응답코드 diff --git a/fml/mg_fml_0009.fml b/fml/mg_fml_0009.fml new file mode 100644 index 0000000..828495c --- /dev/null +++ b/fml/mg_fml_0009.fml @@ -0,0 +1,13 @@ +# +# MG_FML_0009.fml - 전문게이트웨이 FML 필드 테이블 (UBF 필드 정의) +# *base 180 +# +# name rel-number type flags comments +MG_FML_0009_KEY 1 string - 처리키 +MG_FML_0009_MERCHID 2 string - 가맹점번호 +MG_FML_0009_CARDNO 3 string - 카드번호(마스킹) +MG_FML_0009_AMOUNT 4 long - 거래금액 +MG_FML_0009_BIZDATE 5 string - 영업일 +MG_FML_0009_STATUS 6 char - 상태코드 +MG_FML_0009_FEE 7 long - 수수료 +MG_FML_0009_RESPCODE 8 string - 응답코드 diff --git a/fml/mg_fml_0010.fml b/fml/mg_fml_0010.fml new file mode 100644 index 0000000..71e1ca6 --- /dev/null +++ b/fml/mg_fml_0010.fml @@ -0,0 +1,13 @@ +# +# MG_FML_0010.fml - 전문게이트웨이 FML 필드 테이블 (UBF 필드 정의) +# *base 110 +# +# name rel-number type flags comments +MG_FML_0010_KEY 1 string - 처리키 +MG_FML_0010_MERCHID 2 string - 가맹점번호 +MG_FML_0010_CARDNO 3 string - 카드번호(마스킹) +MG_FML_0010_AMOUNT 4 long - 거래금액 +MG_FML_0010_BIZDATE 5 string - 영업일 +MG_FML_0010_STATUS 6 char - 상태코드 +MG_FML_0010_FEE 7 long - 수수료 +MG_FML_0010_RESPCODE 8 string - 응답코드 diff --git a/fml/mg_fml_0011.fml b/fml/mg_fml_0011.fml new file mode 100644 index 0000000..51ed9b5 --- /dev/null +++ b/fml/mg_fml_0011.fml @@ -0,0 +1,13 @@ +# +# MG_FML_0011.fml - 전문게이트웨이 FML 필드 테이블 (UBF 필드 정의) +# *base 130 +# +# name rel-number type flags comments +MG_FML_0011_KEY 1 string - 처리키 +MG_FML_0011_MERCHID 2 string - 가맹점번호 +MG_FML_0011_CARDNO 3 string - 카드번호(마스킹) +MG_FML_0011_AMOUNT 4 long - 거래금액 +MG_FML_0011_BIZDATE 5 string - 영업일 +MG_FML_0011_STATUS 6 char - 상태코드 +MG_FML_0011_FEE 7 long - 수수료 +MG_FML_0011_RESPCODE 8 string - 응답코드 diff --git a/fml/mm_fml_0001.fml b/fml/mm_fml_0001.fml new file mode 100644 index 0000000..aad6df3 --- /dev/null +++ b/fml/mm_fml_0001.fml @@ -0,0 +1,13 @@ +# +# MM_FML_0001.fml - 마스터 FML 필드 테이블 (UBF 필드 정의) +# *base 190 +# +# name rel-number type flags comments +MM_FML_0001_KEY 1 string - 처리키 +MM_FML_0001_MERCHID 2 string - 가맹점번호 +MM_FML_0001_CARDNO 3 string - 카드번호(마스킹) +MM_FML_0001_AMOUNT 4 long - 거래금액 +MM_FML_0001_BIZDATE 5 string - 영업일 +MM_FML_0001_STATUS 6 char - 상태코드 +MM_FML_0001_FEE 7 long - 수수료 +MM_FML_0001_RESPCODE 8 string - 응답코드 diff --git a/fml/mm_fml_0002.fml b/fml/mm_fml_0002.fml new file mode 100644 index 0000000..190c6eb --- /dev/null +++ b/fml/mm_fml_0002.fml @@ -0,0 +1,13 @@ +# +# MM_FML_0002.fml - 마스터 FML 필드 테이블 (UBF 필드 정의) +# *base 120 +# +# name rel-number type flags comments +MM_FML_0002_KEY 1 string - 처리키 +MM_FML_0002_MERCHID 2 string - 가맹점번호 +MM_FML_0002_CARDNO 3 string - 카드번호(마스킹) +MM_FML_0002_AMOUNT 4 long - 거래금액 +MM_FML_0002_BIZDATE 5 string - 영업일 +MM_FML_0002_STATUS 6 char - 상태코드 +MM_FML_0002_FEE 7 long - 수수료 +MM_FML_0002_RESPCODE 8 string - 응답코드 diff --git a/fml/mm_fml_0003.fml b/fml/mm_fml_0003.fml new file mode 100644 index 0000000..30f22dc --- /dev/null +++ b/fml/mm_fml_0003.fml @@ -0,0 +1,13 @@ +# +# MM_FML_0003.fml - 마스터 FML 필드 테이블 (UBF 필드 정의) +# *base 140 +# +# name rel-number type flags comments +MM_FML_0003_KEY 1 string - 처리키 +MM_FML_0003_MERCHID 2 string - 가맹점번호 +MM_FML_0003_CARDNO 3 string - 카드번호(마스킹) +MM_FML_0003_AMOUNT 4 long - 거래금액 +MM_FML_0003_BIZDATE 5 string - 영업일 +MM_FML_0003_STATUS 6 char - 상태코드 +MM_FML_0003_FEE 7 long - 수수료 +MM_FML_0003_RESPCODE 8 string - 응답코드 diff --git a/fml/mm_fml_0004.fml b/fml/mm_fml_0004.fml new file mode 100644 index 0000000..6b4412a --- /dev/null +++ b/fml/mm_fml_0004.fml @@ -0,0 +1,13 @@ +# +# MM_FML_0004.fml - 마스터 FML 필드 테이블 (UBF 필드 정의) +# *base 160 +# +# name rel-number type flags comments +MM_FML_0004_KEY 1 string - 처리키 +MM_FML_0004_MERCHID 2 string - 가맹점번호 +MM_FML_0004_CARDNO 3 string - 카드번호(마스킹) +MM_FML_0004_AMOUNT 4 long - 거래금액 +MM_FML_0004_BIZDATE 5 string - 영업일 +MM_FML_0004_STATUS 6 char - 상태코드 +MM_FML_0004_FEE 7 long - 수수료 +MM_FML_0004_RESPCODE 8 string - 응답코드 diff --git a/fml/mm_fml_0005.fml b/fml/mm_fml_0005.fml new file mode 100644 index 0000000..ddc06c7 --- /dev/null +++ b/fml/mm_fml_0005.fml @@ -0,0 +1,13 @@ +# +# MM_FML_0005.fml - 마스터 FML 필드 테이블 (UBF 필드 정의) +# *base 180 +# +# name rel-number type flags comments +MM_FML_0005_KEY 1 string - 처리키 +MM_FML_0005_MERCHID 2 string - 가맹점번호 +MM_FML_0005_CARDNO 3 string - 카드번호(마스킹) +MM_FML_0005_AMOUNT 4 long - 거래금액 +MM_FML_0005_BIZDATE 5 string - 영업일 +MM_FML_0005_STATUS 6 char - 상태코드 +MM_FML_0005_FEE 7 long - 수수료 +MM_FML_0005_RESPCODE 8 string - 응답코드 diff --git a/fml/mm_fml_0006.fml b/fml/mm_fml_0006.fml new file mode 100644 index 0000000..3ad8d85 --- /dev/null +++ b/fml/mm_fml_0006.fml @@ -0,0 +1,13 @@ +# +# MM_FML_0006.fml - 마스터 FML 필드 테이블 (UBF 필드 정의) +# *base 110 +# +# name rel-number type flags comments +MM_FML_0006_KEY 1 string - 처리키 +MM_FML_0006_MERCHID 2 string - 가맹점번호 +MM_FML_0006_CARDNO 3 string - 카드번호(마스킹) +MM_FML_0006_AMOUNT 4 long - 거래금액 +MM_FML_0006_BIZDATE 5 string - 영업일 +MM_FML_0006_STATUS 6 char - 상태코드 +MM_FML_0006_FEE 7 long - 수수료 +MM_FML_0006_RESPCODE 8 string - 응답코드 diff --git a/fml/mm_fml_0007.fml b/fml/mm_fml_0007.fml new file mode 100644 index 0000000..e2ba69e --- /dev/null +++ b/fml/mm_fml_0007.fml @@ -0,0 +1,13 @@ +# +# MM_FML_0007.fml - 마스터 FML 필드 테이블 (UBF 필드 정의) +# *base 130 +# +# name rel-number type flags comments +MM_FML_0007_KEY 1 string - 처리키 +MM_FML_0007_MERCHID 2 string - 가맹점번호 +MM_FML_0007_CARDNO 3 string - 카드번호(마스킹) +MM_FML_0007_AMOUNT 4 long - 거래금액 +MM_FML_0007_BIZDATE 5 string - 영업일 +MM_FML_0007_STATUS 6 char - 상태코드 +MM_FML_0007_FEE 7 long - 수수료 +MM_FML_0007_RESPCODE 8 string - 응답코드 diff --git a/fml/mm_fml_0008.fml b/fml/mm_fml_0008.fml new file mode 100644 index 0000000..5abb9e1 --- /dev/null +++ b/fml/mm_fml_0008.fml @@ -0,0 +1,13 @@ +# +# MM_FML_0008.fml - 마스터 FML 필드 테이블 (UBF 필드 정의) +# *base 150 +# +# name rel-number type flags comments +MM_FML_0008_KEY 1 string - 처리키 +MM_FML_0008_MERCHID 2 string - 가맹점번호 +MM_FML_0008_CARDNO 3 string - 카드번호(마스킹) +MM_FML_0008_AMOUNT 4 long - 거래금액 +MM_FML_0008_BIZDATE 5 string - 영업일 +MM_FML_0008_STATUS 6 char - 상태코드 +MM_FML_0008_FEE 7 long - 수수료 +MM_FML_0008_RESPCODE 8 string - 응답코드 diff --git a/fml/mm_fml_0009.fml b/fml/mm_fml_0009.fml new file mode 100644 index 0000000..d3dc9b2 --- /dev/null +++ b/fml/mm_fml_0009.fml @@ -0,0 +1,13 @@ +# +# MM_FML_0009.fml - 마스터 FML 필드 테이블 (UBF 필드 정의) +# *base 170 +# +# name rel-number type flags comments +MM_FML_0009_KEY 1 string - 처리키 +MM_FML_0009_MERCHID 2 string - 가맹점번호 +MM_FML_0009_CARDNO 3 string - 카드번호(마스킹) +MM_FML_0009_AMOUNT 4 long - 거래금액 +MM_FML_0009_BIZDATE 5 string - 영업일 +MM_FML_0009_STATUS 6 char - 상태코드 +MM_FML_0009_FEE 7 long - 수수료 +MM_FML_0009_RESPCODE 8 string - 응답코드 diff --git a/fml/mm_fml_0010.fml b/fml/mm_fml_0010.fml new file mode 100644 index 0000000..8551477 --- /dev/null +++ b/fml/mm_fml_0010.fml @@ -0,0 +1,13 @@ +# +# MM_FML_0010.fml - 마스터 FML 필드 테이블 (UBF 필드 정의) +# *base 190 +# +# name rel-number type flags comments +MM_FML_0010_KEY 1 string - 처리키 +MM_FML_0010_MERCHID 2 string - 가맹점번호 +MM_FML_0010_CARDNO 3 string - 카드번호(마스킹) +MM_FML_0010_AMOUNT 4 long - 거래금액 +MM_FML_0010_BIZDATE 5 string - 영업일 +MM_FML_0010_STATUS 6 char - 상태코드 +MM_FML_0010_FEE 7 long - 수수료 +MM_FML_0010_RESPCODE 8 string - 응답코드 diff --git a/fml/mm_fml_0011.fml b/fml/mm_fml_0011.fml new file mode 100644 index 0000000..a5ddb54 --- /dev/null +++ b/fml/mm_fml_0011.fml @@ -0,0 +1,13 @@ +# +# MM_FML_0011.fml - 마스터 FML 필드 테이블 (UBF 필드 정의) +# *base 120 +# +# name rel-number type flags comments +MM_FML_0011_KEY 1 string - 처리키 +MM_FML_0011_MERCHID 2 string - 가맹점번호 +MM_FML_0011_CARDNO 3 string - 카드번호(마스킹) +MM_FML_0011_AMOUNT 4 long - 거래금액 +MM_FML_0011_BIZDATE 5 string - 영업일 +MM_FML_0011_STATUS 6 char - 상태코드 +MM_FML_0011_FEE 7 long - 수수료 +MM_FML_0011_RESPCODE 8 string - 응답코드 diff --git a/fml/py_fml_0001.fml b/fml/py_fml_0001.fml new file mode 100644 index 0000000..fd26c77 --- /dev/null +++ b/fml/py_fml_0001.fml @@ -0,0 +1,13 @@ +# +# PY_FML_0001.fml - 지급 FML 필드 테이블 (UBF 필드 정의) +# *base 170 +# +# name rel-number type flags comments +PY_FML_0001_KEY 1 string - 처리키 +PY_FML_0001_MERCHID 2 string - 가맹점번호 +PY_FML_0001_CARDNO 3 string - 카드번호(마스킹) +PY_FML_0001_AMOUNT 4 long - 거래금액 +PY_FML_0001_BIZDATE 5 string - 영업일 +PY_FML_0001_STATUS 6 char - 상태코드 +PY_FML_0001_FEE 7 long - 수수료 +PY_FML_0001_RESPCODE 8 string - 응답코드 diff --git a/fml/py_fml_0002.fml b/fml/py_fml_0002.fml new file mode 100644 index 0000000..03163bf --- /dev/null +++ b/fml/py_fml_0002.fml @@ -0,0 +1,13 @@ +# +# PY_FML_0002.fml - 지급 FML 필드 테이블 (UBF 필드 정의) +# *base 190 +# +# name rel-number type flags comments +PY_FML_0002_KEY 1 string - 처리키 +PY_FML_0002_MERCHID 2 string - 가맹점번호 +PY_FML_0002_CARDNO 3 string - 카드번호(마스킹) +PY_FML_0002_AMOUNT 4 long - 거래금액 +PY_FML_0002_BIZDATE 5 string - 영업일 +PY_FML_0002_STATUS 6 char - 상태코드 +PY_FML_0002_FEE 7 long - 수수료 +PY_FML_0002_RESPCODE 8 string - 응답코드 diff --git a/fml/py_fml_0003.fml b/fml/py_fml_0003.fml new file mode 100644 index 0000000..3814504 --- /dev/null +++ b/fml/py_fml_0003.fml @@ -0,0 +1,13 @@ +# +# PY_FML_0003.fml - 지급 FML 필드 테이블 (UBF 필드 정의) +# *base 120 +# +# name rel-number type flags comments +PY_FML_0003_KEY 1 string - 처리키 +PY_FML_0003_MERCHID 2 string - 가맹점번호 +PY_FML_0003_CARDNO 3 string - 카드번호(마스킹) +PY_FML_0003_AMOUNT 4 long - 거래금액 +PY_FML_0003_BIZDATE 5 string - 영업일 +PY_FML_0003_STATUS 6 char - 상태코드 +PY_FML_0003_FEE 7 long - 수수료 +PY_FML_0003_RESPCODE 8 string - 응답코드 diff --git a/fml/py_fml_0004.fml b/fml/py_fml_0004.fml new file mode 100644 index 0000000..9c7c975 --- /dev/null +++ b/fml/py_fml_0004.fml @@ -0,0 +1,13 @@ +# +# PY_FML_0004.fml - 지급 FML 필드 테이블 (UBF 필드 정의) +# *base 140 +# +# name rel-number type flags comments +PY_FML_0004_KEY 1 string - 처리키 +PY_FML_0004_MERCHID 2 string - 가맹점번호 +PY_FML_0004_CARDNO 3 string - 카드번호(마스킹) +PY_FML_0004_AMOUNT 4 long - 거래금액 +PY_FML_0004_BIZDATE 5 string - 영업일 +PY_FML_0004_STATUS 6 char - 상태코드 +PY_FML_0004_FEE 7 long - 수수료 +PY_FML_0004_RESPCODE 8 string - 응답코드 diff --git a/fml/py_fml_0005.fml b/fml/py_fml_0005.fml new file mode 100644 index 0000000..3dfa374 --- /dev/null +++ b/fml/py_fml_0005.fml @@ -0,0 +1,13 @@ +# +# PY_FML_0005.fml - 지급 FML 필드 테이블 (UBF 필드 정의) +# *base 160 +# +# name rel-number type flags comments +PY_FML_0005_KEY 1 string - 처리키 +PY_FML_0005_MERCHID 2 string - 가맹점번호 +PY_FML_0005_CARDNO 3 string - 카드번호(마스킹) +PY_FML_0005_AMOUNT 4 long - 거래금액 +PY_FML_0005_BIZDATE 5 string - 영업일 +PY_FML_0005_STATUS 6 char - 상태코드 +PY_FML_0005_FEE 7 long - 수수료 +PY_FML_0005_RESPCODE 8 string - 응답코드 diff --git a/fml/py_fml_0006.fml b/fml/py_fml_0006.fml new file mode 100644 index 0000000..1b202d6 --- /dev/null +++ b/fml/py_fml_0006.fml @@ -0,0 +1,13 @@ +# +# PY_FML_0006.fml - 지급 FML 필드 테이블 (UBF 필드 정의) +# *base 180 +# +# name rel-number type flags comments +PY_FML_0006_KEY 1 string - 처리키 +PY_FML_0006_MERCHID 2 string - 가맹점번호 +PY_FML_0006_CARDNO 3 string - 카드번호(마스킹) +PY_FML_0006_AMOUNT 4 long - 거래금액 +PY_FML_0006_BIZDATE 5 string - 영업일 +PY_FML_0006_STATUS 6 char - 상태코드 +PY_FML_0006_FEE 7 long - 수수료 +PY_FML_0006_RESPCODE 8 string - 응답코드 diff --git a/fml/py_fml_0007.fml b/fml/py_fml_0007.fml new file mode 100644 index 0000000..dc1b74b --- /dev/null +++ b/fml/py_fml_0007.fml @@ -0,0 +1,13 @@ +# +# PY_FML_0007.fml - 지급 FML 필드 테이블 (UBF 필드 정의) +# *base 110 +# +# name rel-number type flags comments +PY_FML_0007_KEY 1 string - 처리키 +PY_FML_0007_MERCHID 2 string - 가맹점번호 +PY_FML_0007_CARDNO 3 string - 카드번호(마스킹) +PY_FML_0007_AMOUNT 4 long - 거래금액 +PY_FML_0007_BIZDATE 5 string - 영업일 +PY_FML_0007_STATUS 6 char - 상태코드 +PY_FML_0007_FEE 7 long - 수수료 +PY_FML_0007_RESPCODE 8 string - 응답코드 diff --git a/fml/py_fml_0008.fml b/fml/py_fml_0008.fml new file mode 100644 index 0000000..09057e9 --- /dev/null +++ b/fml/py_fml_0008.fml @@ -0,0 +1,13 @@ +# +# PY_FML_0008.fml - 지급 FML 필드 테이블 (UBF 필드 정의) +# *base 130 +# +# name rel-number type flags comments +PY_FML_0008_KEY 1 string - 처리키 +PY_FML_0008_MERCHID 2 string - 가맹점번호 +PY_FML_0008_CARDNO 3 string - 카드번호(마스킹) +PY_FML_0008_AMOUNT 4 long - 거래금액 +PY_FML_0008_BIZDATE 5 string - 영업일 +PY_FML_0008_STATUS 6 char - 상태코드 +PY_FML_0008_FEE 7 long - 수수료 +PY_FML_0008_RESPCODE 8 string - 응답코드 diff --git a/fml/py_fml_0009.fml b/fml/py_fml_0009.fml new file mode 100644 index 0000000..b8b5c76 --- /dev/null +++ b/fml/py_fml_0009.fml @@ -0,0 +1,13 @@ +# +# PY_FML_0009.fml - 지급 FML 필드 테이블 (UBF 필드 정의) +# *base 150 +# +# name rel-number type flags comments +PY_FML_0009_KEY 1 string - 처리키 +PY_FML_0009_MERCHID 2 string - 가맹점번호 +PY_FML_0009_CARDNO 3 string - 카드번호(마스킹) +PY_FML_0009_AMOUNT 4 long - 거래금액 +PY_FML_0009_BIZDATE 5 string - 영업일 +PY_FML_0009_STATUS 6 char - 상태코드 +PY_FML_0009_FEE 7 long - 수수료 +PY_FML_0009_RESPCODE 8 string - 응답코드 diff --git a/fml/py_fml_0010.fml b/fml/py_fml_0010.fml new file mode 100644 index 0000000..593326b --- /dev/null +++ b/fml/py_fml_0010.fml @@ -0,0 +1,13 @@ +# +# PY_FML_0010.fml - 지급 FML 필드 테이블 (UBF 필드 정의) +# *base 170 +# +# name rel-number type flags comments +PY_FML_0010_KEY 1 string - 처리키 +PY_FML_0010_MERCHID 2 string - 가맹점번호 +PY_FML_0010_CARDNO 3 string - 카드번호(마스킹) +PY_FML_0010_AMOUNT 4 long - 거래금액 +PY_FML_0010_BIZDATE 5 string - 영업일 +PY_FML_0010_STATUS 6 char - 상태코드 +PY_FML_0010_FEE 7 long - 수수료 +PY_FML_0010_RESPCODE 8 string - 응답코드 diff --git a/fml/py_fml_0011.fml b/fml/py_fml_0011.fml new file mode 100644 index 0000000..bf55ee7 --- /dev/null +++ b/fml/py_fml_0011.fml @@ -0,0 +1,13 @@ +# +# PY_FML_0011.fml - 지급 FML 필드 테이블 (UBF 필드 정의) +# *base 190 +# +# name rel-number type flags comments +PY_FML_0011_KEY 1 string - 처리키 +PY_FML_0011_MERCHID 2 string - 가맹점번호 +PY_FML_0011_CARDNO 3 string - 카드번호(마스킹) +PY_FML_0011_AMOUNT 4 long - 거래금액 +PY_FML_0011_BIZDATE 5 string - 영업일 +PY_FML_0011_STATUS 6 char - 상태코드 +PY_FML_0011_FEE 7 long - 수수료 +PY_FML_0011_RESPCODE 8 string - 응답코드 diff --git a/fml/rc_fml_0001.fml b/fml/rc_fml_0001.fml new file mode 100644 index 0000000..e587c53 --- /dev/null +++ b/fml/rc_fml_0001.fml @@ -0,0 +1,13 @@ +# +# RC_FML_0001.fml - 대사 FML 필드 테이블 (UBF 필드 정의) +# *base 140 +# +# name rel-number type flags comments +RC_FML_0001_KEY 1 string - 처리키 +RC_FML_0001_MERCHID 2 string - 가맹점번호 +RC_FML_0001_CARDNO 3 string - 카드번호(마스킹) +RC_FML_0001_AMOUNT 4 long - 거래금액 +RC_FML_0001_BIZDATE 5 string - 영업일 +RC_FML_0001_STATUS 6 char - 상태코드 +RC_FML_0001_FEE 7 long - 수수료 +RC_FML_0001_RESPCODE 8 string - 응답코드 diff --git a/fml/rc_fml_0002.fml b/fml/rc_fml_0002.fml new file mode 100644 index 0000000..c24f743 --- /dev/null +++ b/fml/rc_fml_0002.fml @@ -0,0 +1,13 @@ +# +# RC_FML_0002.fml - 대사 FML 필드 테이블 (UBF 필드 정의) +# *base 160 +# +# name rel-number type flags comments +RC_FML_0002_KEY 1 string - 처리키 +RC_FML_0002_MERCHID 2 string - 가맹점번호 +RC_FML_0002_CARDNO 3 string - 카드번호(마스킹) +RC_FML_0002_AMOUNT 4 long - 거래금액 +RC_FML_0002_BIZDATE 5 string - 영업일 +RC_FML_0002_STATUS 6 char - 상태코드 +RC_FML_0002_FEE 7 long - 수수료 +RC_FML_0002_RESPCODE 8 string - 응답코드 diff --git a/fml/rc_fml_0003.fml b/fml/rc_fml_0003.fml new file mode 100644 index 0000000..0b5e685 --- /dev/null +++ b/fml/rc_fml_0003.fml @@ -0,0 +1,13 @@ +# +# RC_FML_0003.fml - 대사 FML 필드 테이블 (UBF 필드 정의) +# *base 180 +# +# name rel-number type flags comments +RC_FML_0003_KEY 1 string - 처리키 +RC_FML_0003_MERCHID 2 string - 가맹점번호 +RC_FML_0003_CARDNO 3 string - 카드번호(마스킹) +RC_FML_0003_AMOUNT 4 long - 거래금액 +RC_FML_0003_BIZDATE 5 string - 영업일 +RC_FML_0003_STATUS 6 char - 상태코드 +RC_FML_0003_FEE 7 long - 수수료 +RC_FML_0003_RESPCODE 8 string - 응답코드 diff --git a/fml/rc_fml_0004.fml b/fml/rc_fml_0004.fml new file mode 100644 index 0000000..b6e7a40 --- /dev/null +++ b/fml/rc_fml_0004.fml @@ -0,0 +1,13 @@ +# +# RC_FML_0004.fml - 대사 FML 필드 테이블 (UBF 필드 정의) +# *base 110 +# +# name rel-number type flags comments +RC_FML_0004_KEY 1 string - 처리키 +RC_FML_0004_MERCHID 2 string - 가맹점번호 +RC_FML_0004_CARDNO 3 string - 카드번호(마스킹) +RC_FML_0004_AMOUNT 4 long - 거래금액 +RC_FML_0004_BIZDATE 5 string - 영업일 +RC_FML_0004_STATUS 6 char - 상태코드 +RC_FML_0004_FEE 7 long - 수수료 +RC_FML_0004_RESPCODE 8 string - 응답코드 diff --git a/fml/rc_fml_0005.fml b/fml/rc_fml_0005.fml new file mode 100644 index 0000000..07991db --- /dev/null +++ b/fml/rc_fml_0005.fml @@ -0,0 +1,13 @@ +# +# RC_FML_0005.fml - 대사 FML 필드 테이블 (UBF 필드 정의) +# *base 130 +# +# name rel-number type flags comments +RC_FML_0005_KEY 1 string - 처리키 +RC_FML_0005_MERCHID 2 string - 가맹점번호 +RC_FML_0005_CARDNO 3 string - 카드번호(마스킹) +RC_FML_0005_AMOUNT 4 long - 거래금액 +RC_FML_0005_BIZDATE 5 string - 영업일 +RC_FML_0005_STATUS 6 char - 상태코드 +RC_FML_0005_FEE 7 long - 수수료 +RC_FML_0005_RESPCODE 8 string - 응답코드 diff --git a/fml/rc_fml_0006.fml b/fml/rc_fml_0006.fml new file mode 100644 index 0000000..833464f --- /dev/null +++ b/fml/rc_fml_0006.fml @@ -0,0 +1,13 @@ +# +# RC_FML_0006.fml - 대사 FML 필드 테이블 (UBF 필드 정의) +# *base 150 +# +# name rel-number type flags comments +RC_FML_0006_KEY 1 string - 처리키 +RC_FML_0006_MERCHID 2 string - 가맹점번호 +RC_FML_0006_CARDNO 3 string - 카드번호(마스킹) +RC_FML_0006_AMOUNT 4 long - 거래금액 +RC_FML_0006_BIZDATE 5 string - 영업일 +RC_FML_0006_STATUS 6 char - 상태코드 +RC_FML_0006_FEE 7 long - 수수료 +RC_FML_0006_RESPCODE 8 string - 응답코드 diff --git a/fml/rc_fml_0007.fml b/fml/rc_fml_0007.fml new file mode 100644 index 0000000..1c3a7dd --- /dev/null +++ b/fml/rc_fml_0007.fml @@ -0,0 +1,13 @@ +# +# RC_FML_0007.fml - 대사 FML 필드 테이블 (UBF 필드 정의) +# *base 170 +# +# name rel-number type flags comments +RC_FML_0007_KEY 1 string - 처리키 +RC_FML_0007_MERCHID 2 string - 가맹점번호 +RC_FML_0007_CARDNO 3 string - 카드번호(마스킹) +RC_FML_0007_AMOUNT 4 long - 거래금액 +RC_FML_0007_BIZDATE 5 string - 영업일 +RC_FML_0007_STATUS 6 char - 상태코드 +RC_FML_0007_FEE 7 long - 수수료 +RC_FML_0007_RESPCODE 8 string - 응답코드 diff --git a/fml/rc_fml_0008.fml b/fml/rc_fml_0008.fml new file mode 100644 index 0000000..e0f934e --- /dev/null +++ b/fml/rc_fml_0008.fml @@ -0,0 +1,13 @@ +# +# RC_FML_0008.fml - 대사 FML 필드 테이블 (UBF 필드 정의) +# *base 190 +# +# name rel-number type flags comments +RC_FML_0008_KEY 1 string - 처리키 +RC_FML_0008_MERCHID 2 string - 가맹점번호 +RC_FML_0008_CARDNO 3 string - 카드번호(마스킹) +RC_FML_0008_AMOUNT 4 long - 거래금액 +RC_FML_0008_BIZDATE 5 string - 영업일 +RC_FML_0008_STATUS 6 char - 상태코드 +RC_FML_0008_FEE 7 long - 수수료 +RC_FML_0008_RESPCODE 8 string - 응답코드 diff --git a/fml/rc_fml_0009.fml b/fml/rc_fml_0009.fml new file mode 100644 index 0000000..12674ed --- /dev/null +++ b/fml/rc_fml_0009.fml @@ -0,0 +1,13 @@ +# +# RC_FML_0009.fml - 대사 FML 필드 테이블 (UBF 필드 정의) +# *base 120 +# +# name rel-number type flags comments +RC_FML_0009_KEY 1 string - 처리키 +RC_FML_0009_MERCHID 2 string - 가맹점번호 +RC_FML_0009_CARDNO 3 string - 카드번호(마스킹) +RC_FML_0009_AMOUNT 4 long - 거래금액 +RC_FML_0009_BIZDATE 5 string - 영업일 +RC_FML_0009_STATUS 6 char - 상태코드 +RC_FML_0009_FEE 7 long - 수수료 +RC_FML_0009_RESPCODE 8 string - 응답코드 diff --git a/fml/rc_fml_0010.fml b/fml/rc_fml_0010.fml new file mode 100644 index 0000000..aa9d594 --- /dev/null +++ b/fml/rc_fml_0010.fml @@ -0,0 +1,13 @@ +# +# RC_FML_0010.fml - 대사 FML 필드 테이블 (UBF 필드 정의) +# *base 140 +# +# name rel-number type flags comments +RC_FML_0010_KEY 1 string - 처리키 +RC_FML_0010_MERCHID 2 string - 가맹점번호 +RC_FML_0010_CARDNO 3 string - 카드번호(마스킹) +RC_FML_0010_AMOUNT 4 long - 거래금액 +RC_FML_0010_BIZDATE 5 string - 영업일 +RC_FML_0010_STATUS 6 char - 상태코드 +RC_FML_0010_FEE 7 long - 수수료 +RC_FML_0010_RESPCODE 8 string - 응답코드 diff --git a/fml/rc_fml_0011.fml b/fml/rc_fml_0011.fml new file mode 100644 index 0000000..2eeb9df --- /dev/null +++ b/fml/rc_fml_0011.fml @@ -0,0 +1,13 @@ +# +# RC_FML_0011.fml - 대사 FML 필드 테이블 (UBF 필드 정의) +# *base 160 +# +# name rel-number type flags comments +RC_FML_0011_KEY 1 string - 처리키 +RC_FML_0011_MERCHID 2 string - 가맹점번호 +RC_FML_0011_CARDNO 3 string - 카드번호(마스킹) +RC_FML_0011_AMOUNT 4 long - 거래금액 +RC_FML_0011_BIZDATE 5 string - 영업일 +RC_FML_0011_STATUS 6 char - 상태코드 +RC_FML_0011_FEE 7 long - 수수료 +RC_FML_0011_RESPCODE 8 string - 응답코드 diff --git a/fml/st_fml_0001.fml b/fml/st_fml_0001.fml new file mode 100644 index 0000000..18b242e --- /dev/null +++ b/fml/st_fml_0001.fml @@ -0,0 +1,13 @@ +# +# ST_FML_0001.fml - 정산수수료 FML 필드 테이블 (UBF 필드 정의) +# *base 160 +# +# name rel-number type flags comments +ST_FML_0001_KEY 1 string - 처리키 +ST_FML_0001_MERCHID 2 string - 가맹점번호 +ST_FML_0001_CARDNO 3 string - 카드번호(마스킹) +ST_FML_0001_AMOUNT 4 long - 거래금액 +ST_FML_0001_BIZDATE 5 string - 영업일 +ST_FML_0001_STATUS 6 char - 상태코드 +ST_FML_0001_FEE 7 long - 수수료 +ST_FML_0001_RESPCODE 8 string - 응답코드 diff --git a/fml/st_fml_0002.fml b/fml/st_fml_0002.fml new file mode 100644 index 0000000..cdca802 --- /dev/null +++ b/fml/st_fml_0002.fml @@ -0,0 +1,13 @@ +# +# ST_FML_0002.fml - 정산수수료 FML 필드 테이블 (UBF 필드 정의) +# *base 180 +# +# name rel-number type flags comments +ST_FML_0002_KEY 1 string - 처리키 +ST_FML_0002_MERCHID 2 string - 가맹점번호 +ST_FML_0002_CARDNO 3 string - 카드번호(마스킹) +ST_FML_0002_AMOUNT 4 long - 거래금액 +ST_FML_0002_BIZDATE 5 string - 영업일 +ST_FML_0002_STATUS 6 char - 상태코드 +ST_FML_0002_FEE 7 long - 수수료 +ST_FML_0002_RESPCODE 8 string - 응답코드 diff --git a/fml/st_fml_0003.fml b/fml/st_fml_0003.fml new file mode 100644 index 0000000..be4a29b --- /dev/null +++ b/fml/st_fml_0003.fml @@ -0,0 +1,13 @@ +# +# ST_FML_0003.fml - 정산수수료 FML 필드 테이블 (UBF 필드 정의) +# *base 110 +# +# name rel-number type flags comments +ST_FML_0003_KEY 1 string - 처리키 +ST_FML_0003_MERCHID 2 string - 가맹점번호 +ST_FML_0003_CARDNO 3 string - 카드번호(마스킹) +ST_FML_0003_AMOUNT 4 long - 거래금액 +ST_FML_0003_BIZDATE 5 string - 영업일 +ST_FML_0003_STATUS 6 char - 상태코드 +ST_FML_0003_FEE 7 long - 수수료 +ST_FML_0003_RESPCODE 8 string - 응답코드 diff --git a/fml/st_fml_0004.fml b/fml/st_fml_0004.fml new file mode 100644 index 0000000..3e8b603 --- /dev/null +++ b/fml/st_fml_0004.fml @@ -0,0 +1,13 @@ +# +# ST_FML_0004.fml - 정산수수료 FML 필드 테이블 (UBF 필드 정의) +# *base 130 +# +# name rel-number type flags comments +ST_FML_0004_KEY 1 string - 처리키 +ST_FML_0004_MERCHID 2 string - 가맹점번호 +ST_FML_0004_CARDNO 3 string - 카드번호(마스킹) +ST_FML_0004_AMOUNT 4 long - 거래금액 +ST_FML_0004_BIZDATE 5 string - 영업일 +ST_FML_0004_STATUS 6 char - 상태코드 +ST_FML_0004_FEE 7 long - 수수료 +ST_FML_0004_RESPCODE 8 string - 응답코드 diff --git a/fml/st_fml_0005.fml b/fml/st_fml_0005.fml new file mode 100644 index 0000000..4cc4947 --- /dev/null +++ b/fml/st_fml_0005.fml @@ -0,0 +1,13 @@ +# +# ST_FML_0005.fml - 정산수수료 FML 필드 테이블 (UBF 필드 정의) +# *base 150 +# +# name rel-number type flags comments +ST_FML_0005_KEY 1 string - 처리키 +ST_FML_0005_MERCHID 2 string - 가맹점번호 +ST_FML_0005_CARDNO 3 string - 카드번호(마스킹) +ST_FML_0005_AMOUNT 4 long - 거래금액 +ST_FML_0005_BIZDATE 5 string - 영업일 +ST_FML_0005_STATUS 6 char - 상태코드 +ST_FML_0005_FEE 7 long - 수수료 +ST_FML_0005_RESPCODE 8 string - 응답코드 diff --git a/fml/st_fml_0006.fml b/fml/st_fml_0006.fml new file mode 100644 index 0000000..b1d8369 --- /dev/null +++ b/fml/st_fml_0006.fml @@ -0,0 +1,13 @@ +# +# ST_FML_0006.fml - 정산수수료 FML 필드 테이블 (UBF 필드 정의) +# *base 170 +# +# name rel-number type flags comments +ST_FML_0006_KEY 1 string - 처리키 +ST_FML_0006_MERCHID 2 string - 가맹점번호 +ST_FML_0006_CARDNO 3 string - 카드번호(마스킹) +ST_FML_0006_AMOUNT 4 long - 거래금액 +ST_FML_0006_BIZDATE 5 string - 영업일 +ST_FML_0006_STATUS 6 char - 상태코드 +ST_FML_0006_FEE 7 long - 수수료 +ST_FML_0006_RESPCODE 8 string - 응답코드 diff --git a/fml/st_fml_0007.fml b/fml/st_fml_0007.fml new file mode 100644 index 0000000..2806756 --- /dev/null +++ b/fml/st_fml_0007.fml @@ -0,0 +1,13 @@ +# +# ST_FML_0007.fml - 정산수수료 FML 필드 테이블 (UBF 필드 정의) +# *base 190 +# +# name rel-number type flags comments +ST_FML_0007_KEY 1 string - 처리키 +ST_FML_0007_MERCHID 2 string - 가맹점번호 +ST_FML_0007_CARDNO 3 string - 카드번호(마스킹) +ST_FML_0007_AMOUNT 4 long - 거래금액 +ST_FML_0007_BIZDATE 5 string - 영업일 +ST_FML_0007_STATUS 6 char - 상태코드 +ST_FML_0007_FEE 7 long - 수수료 +ST_FML_0007_RESPCODE 8 string - 응답코드 diff --git a/fml/st_fml_0008.fml b/fml/st_fml_0008.fml new file mode 100644 index 0000000..a158129 --- /dev/null +++ b/fml/st_fml_0008.fml @@ -0,0 +1,13 @@ +# +# ST_FML_0008.fml - 정산수수료 FML 필드 테이블 (UBF 필드 정의) +# *base 120 +# +# name rel-number type flags comments +ST_FML_0008_KEY 1 string - 처리키 +ST_FML_0008_MERCHID 2 string - 가맹점번호 +ST_FML_0008_CARDNO 3 string - 카드번호(마스킹) +ST_FML_0008_AMOUNT 4 long - 거래금액 +ST_FML_0008_BIZDATE 5 string - 영업일 +ST_FML_0008_STATUS 6 char - 상태코드 +ST_FML_0008_FEE 7 long - 수수료 +ST_FML_0008_RESPCODE 8 string - 응답코드 diff --git a/fml/st_fml_0009.fml b/fml/st_fml_0009.fml new file mode 100644 index 0000000..1994b61 --- /dev/null +++ b/fml/st_fml_0009.fml @@ -0,0 +1,13 @@ +# +# ST_FML_0009.fml - 정산수수료 FML 필드 테이블 (UBF 필드 정의) +# *base 140 +# +# name rel-number type flags comments +ST_FML_0009_KEY 1 string - 처리키 +ST_FML_0009_MERCHID 2 string - 가맹점번호 +ST_FML_0009_CARDNO 3 string - 카드번호(마스킹) +ST_FML_0009_AMOUNT 4 long - 거래금액 +ST_FML_0009_BIZDATE 5 string - 영업일 +ST_FML_0009_STATUS 6 char - 상태코드 +ST_FML_0009_FEE 7 long - 수수료 +ST_FML_0009_RESPCODE 8 string - 응답코드 diff --git a/fml/st_fml_0010.fml b/fml/st_fml_0010.fml new file mode 100644 index 0000000..8324245 --- /dev/null +++ b/fml/st_fml_0010.fml @@ -0,0 +1,13 @@ +# +# ST_FML_0010.fml - 정산수수료 FML 필드 테이블 (UBF 필드 정의) +# *base 160 +# +# name rel-number type flags comments +ST_FML_0010_KEY 1 string - 처리키 +ST_FML_0010_MERCHID 2 string - 가맹점번호 +ST_FML_0010_CARDNO 3 string - 카드번호(마스킹) +ST_FML_0010_AMOUNT 4 long - 거래금액 +ST_FML_0010_BIZDATE 5 string - 영업일 +ST_FML_0010_STATUS 6 char - 상태코드 +ST_FML_0010_FEE 7 long - 수수료 +ST_FML_0010_RESPCODE 8 string - 응답코드 diff --git a/fml/st_fml_0011.fml b/fml/st_fml_0011.fml new file mode 100644 index 0000000..adc8ffb --- /dev/null +++ b/fml/st_fml_0011.fml @@ -0,0 +1,13 @@ +# +# ST_FML_0011.fml - 정산수수료 FML 필드 테이블 (UBF 필드 정의) +# *base 180 +# +# name rel-number type flags comments +ST_FML_0011_KEY 1 string - 처리키 +ST_FML_0011_MERCHID 2 string - 가맹점번호 +ST_FML_0011_CARDNO 3 string - 카드번호(마스킹) +ST_FML_0011_AMOUNT 4 long - 거래금액 +ST_FML_0011_BIZDATE 5 string - 영업일 +ST_FML_0011_STATUS 6 char - 상태코드 +ST_FML_0011_FEE 7 long - 수수료 +ST_FML_0011_RESPCODE 8 string - 응답코드 diff --git a/fml/vl_fml_0001.fml b/fml/vl_fml_0001.fml new file mode 100644 index 0000000..2368ac3 --- /dev/null +++ b/fml/vl_fml_0001.fml @@ -0,0 +1,13 @@ +# +# VL_FML_0001.fml - 정합성 FML 필드 테이블 (UBF 필드 정의) +# *base 150 +# +# name rel-number type flags comments +VL_FML_0001_KEY 1 string - 처리키 +VL_FML_0001_MERCHID 2 string - 가맹점번호 +VL_FML_0001_CARDNO 3 string - 카드번호(마스킹) +VL_FML_0001_AMOUNT 4 long - 거래금액 +VL_FML_0001_BIZDATE 5 string - 영업일 +VL_FML_0001_STATUS 6 char - 상태코드 +VL_FML_0001_FEE 7 long - 수수료 +VL_FML_0001_RESPCODE 8 string - 응답코드 diff --git a/fml/vl_fml_0002.fml b/fml/vl_fml_0002.fml new file mode 100644 index 0000000..30f1989 --- /dev/null +++ b/fml/vl_fml_0002.fml @@ -0,0 +1,13 @@ +# +# VL_FML_0002.fml - 정합성 FML 필드 테이블 (UBF 필드 정의) +# *base 170 +# +# name rel-number type flags comments +VL_FML_0002_KEY 1 string - 처리키 +VL_FML_0002_MERCHID 2 string - 가맹점번호 +VL_FML_0002_CARDNO 3 string - 카드번호(마스킹) +VL_FML_0002_AMOUNT 4 long - 거래금액 +VL_FML_0002_BIZDATE 5 string - 영업일 +VL_FML_0002_STATUS 6 char - 상태코드 +VL_FML_0002_FEE 7 long - 수수료 +VL_FML_0002_RESPCODE 8 string - 응답코드 diff --git a/fml/vl_fml_0003.fml b/fml/vl_fml_0003.fml new file mode 100644 index 0000000..c1f7c4b --- /dev/null +++ b/fml/vl_fml_0003.fml @@ -0,0 +1,13 @@ +# +# VL_FML_0003.fml - 정합성 FML 필드 테이블 (UBF 필드 정의) +# *base 190 +# +# name rel-number type flags comments +VL_FML_0003_KEY 1 string - 처리키 +VL_FML_0003_MERCHID 2 string - 가맹점번호 +VL_FML_0003_CARDNO 3 string - 카드번호(마스킹) +VL_FML_0003_AMOUNT 4 long - 거래금액 +VL_FML_0003_BIZDATE 5 string - 영업일 +VL_FML_0003_STATUS 6 char - 상태코드 +VL_FML_0003_FEE 7 long - 수수료 +VL_FML_0003_RESPCODE 8 string - 응답코드 diff --git a/fml/vl_fml_0004.fml b/fml/vl_fml_0004.fml new file mode 100644 index 0000000..d72c226 --- /dev/null +++ b/fml/vl_fml_0004.fml @@ -0,0 +1,13 @@ +# +# VL_FML_0004.fml - 정합성 FML 필드 테이블 (UBF 필드 정의) +# *base 120 +# +# name rel-number type flags comments +VL_FML_0004_KEY 1 string - 처리키 +VL_FML_0004_MERCHID 2 string - 가맹점번호 +VL_FML_0004_CARDNO 3 string - 카드번호(마스킹) +VL_FML_0004_AMOUNT 4 long - 거래금액 +VL_FML_0004_BIZDATE 5 string - 영업일 +VL_FML_0004_STATUS 6 char - 상태코드 +VL_FML_0004_FEE 7 long - 수수료 +VL_FML_0004_RESPCODE 8 string - 응답코드 diff --git a/fml/vl_fml_0005.fml b/fml/vl_fml_0005.fml new file mode 100644 index 0000000..f887dba --- /dev/null +++ b/fml/vl_fml_0005.fml @@ -0,0 +1,13 @@ +# +# VL_FML_0005.fml - 정합성 FML 필드 테이블 (UBF 필드 정의) +# *base 140 +# +# name rel-number type flags comments +VL_FML_0005_KEY 1 string - 처리키 +VL_FML_0005_MERCHID 2 string - 가맹점번호 +VL_FML_0005_CARDNO 3 string - 카드번호(마스킹) +VL_FML_0005_AMOUNT 4 long - 거래금액 +VL_FML_0005_BIZDATE 5 string - 영업일 +VL_FML_0005_STATUS 6 char - 상태코드 +VL_FML_0005_FEE 7 long - 수수료 +VL_FML_0005_RESPCODE 8 string - 응답코드 diff --git a/fml/vl_fml_0006.fml b/fml/vl_fml_0006.fml new file mode 100644 index 0000000..91edac4 --- /dev/null +++ b/fml/vl_fml_0006.fml @@ -0,0 +1,13 @@ +# +# VL_FML_0006.fml - 정합성 FML 필드 테이블 (UBF 필드 정의) +# *base 160 +# +# name rel-number type flags comments +VL_FML_0006_KEY 1 string - 처리키 +VL_FML_0006_MERCHID 2 string - 가맹점번호 +VL_FML_0006_CARDNO 3 string - 카드번호(마스킹) +VL_FML_0006_AMOUNT 4 long - 거래금액 +VL_FML_0006_BIZDATE 5 string - 영업일 +VL_FML_0006_STATUS 6 char - 상태코드 +VL_FML_0006_FEE 7 long - 수수료 +VL_FML_0006_RESPCODE 8 string - 응답코드 diff --git a/fml/vl_fml_0007.fml b/fml/vl_fml_0007.fml new file mode 100644 index 0000000..420900e --- /dev/null +++ b/fml/vl_fml_0007.fml @@ -0,0 +1,13 @@ +# +# VL_FML_0007.fml - 정합성 FML 필드 테이블 (UBF 필드 정의) +# *base 180 +# +# name rel-number type flags comments +VL_FML_0007_KEY 1 string - 처리키 +VL_FML_0007_MERCHID 2 string - 가맹점번호 +VL_FML_0007_CARDNO 3 string - 카드번호(마스킹) +VL_FML_0007_AMOUNT 4 long - 거래금액 +VL_FML_0007_BIZDATE 5 string - 영업일 +VL_FML_0007_STATUS 6 char - 상태코드 +VL_FML_0007_FEE 7 long - 수수료 +VL_FML_0007_RESPCODE 8 string - 응답코드 diff --git a/fml/vl_fml_0008.fml b/fml/vl_fml_0008.fml new file mode 100644 index 0000000..dd010df --- /dev/null +++ b/fml/vl_fml_0008.fml @@ -0,0 +1,13 @@ +# +# VL_FML_0008.fml - 정합성 FML 필드 테이블 (UBF 필드 정의) +# *base 110 +# +# name rel-number type flags comments +VL_FML_0008_KEY 1 string - 처리키 +VL_FML_0008_MERCHID 2 string - 가맹점번호 +VL_FML_0008_CARDNO 3 string - 카드번호(마스킹) +VL_FML_0008_AMOUNT 4 long - 거래금액 +VL_FML_0008_BIZDATE 5 string - 영업일 +VL_FML_0008_STATUS 6 char - 상태코드 +VL_FML_0008_FEE 7 long - 수수료 +VL_FML_0008_RESPCODE 8 string - 응답코드 diff --git a/fml/vl_fml_0009.fml b/fml/vl_fml_0009.fml new file mode 100644 index 0000000..060f101 --- /dev/null +++ b/fml/vl_fml_0009.fml @@ -0,0 +1,13 @@ +# +# VL_FML_0009.fml - 정합성 FML 필드 테이블 (UBF 필드 정의) +# *base 130 +# +# name rel-number type flags comments +VL_FML_0009_KEY 1 string - 처리키 +VL_FML_0009_MERCHID 2 string - 가맹점번호 +VL_FML_0009_CARDNO 3 string - 카드번호(마스킹) +VL_FML_0009_AMOUNT 4 long - 거래금액 +VL_FML_0009_BIZDATE 5 string - 영업일 +VL_FML_0009_STATUS 6 char - 상태코드 +VL_FML_0009_FEE 7 long - 수수료 +VL_FML_0009_RESPCODE 8 string - 응답코드 diff --git a/fml/vl_fml_0010.fml b/fml/vl_fml_0010.fml new file mode 100644 index 0000000..6802745 --- /dev/null +++ b/fml/vl_fml_0010.fml @@ -0,0 +1,13 @@ +# +# VL_FML_0010.fml - 정합성 FML 필드 테이블 (UBF 필드 정의) +# *base 150 +# +# name rel-number type flags comments +VL_FML_0010_KEY 1 string - 처리키 +VL_FML_0010_MERCHID 2 string - 가맹점번호 +VL_FML_0010_CARDNO 3 string - 카드번호(마스킹) +VL_FML_0010_AMOUNT 4 long - 거래금액 +VL_FML_0010_BIZDATE 5 string - 영업일 +VL_FML_0010_STATUS 6 char - 상태코드 +VL_FML_0010_FEE 7 long - 수수료 +VL_FML_0010_RESPCODE 8 string - 응답코드 diff --git a/fml/vl_fml_0011.fml b/fml/vl_fml_0011.fml new file mode 100644 index 0000000..924ab73 --- /dev/null +++ b/fml/vl_fml_0011.fml @@ -0,0 +1,13 @@ +# +# VL_FML_0011.fml - 정합성 FML 필드 테이블 (UBF 필드 정의) +# *base 170 +# +# name rel-number type flags comments +VL_FML_0011_KEY 1 string - 처리키 +VL_FML_0011_MERCHID 2 string - 가맹점번호 +VL_FML_0011_CARDNO 3 string - 카드번호(마스킹) +VL_FML_0011_AMOUNT 4 long - 거래금액 +VL_FML_0011_BIZDATE 5 string - 영업일 +VL_FML_0011_STATUS 6 char - 상태코드 +VL_FML_0011_FEE 7 long - 수수료 +VL_FML_0011_RESPCODE 8 string - 응답코드 diff --git a/framework/txcore/dbio/txcore_dbio.h b/framework/txcore/dbio/txcore_dbio.h new file mode 100644 index 0000000..3d06784 --- /dev/null +++ b/framework/txcore/dbio/txcore_dbio.h @@ -0,0 +1,21 @@ +/* + * txcore_dbio.h - TxCore DBIO 규약 (ECPG/Pro*C 공통) + */ +#ifndef TXCORE_DBIO_H +#define TXCORE_DBIO_H + +#include "txcore.h" + +#define TX_SQL_OK 0 +#define TX_SQL_NOTFOUND 100 + +#define TX_DBIO_RESULT(sc) \ + ((sc) == TX_SQL_OK ? TX_OK : \ + (sc) == TX_SQL_NOTFOUND ? TX_ENOENT : TX_EDB) + +#define TX_DBIO_LOG_ERR(tag) \ + tx_log(TX_LOG_ERROR, "DBIO 오류 [%s] sqlcode=%ld msg=%.*s", \ + (tag), (long)sqlca.sqlcode, \ + (int)sqlca.sqlerrm.sqlerrml, sqlca.sqlerrm.sqlerrmc) + +#endif /* TXCORE_DBIO_H */ diff --git a/framework/txcore/include/txcore.h b/framework/txcore/include/txcore.h new file mode 100644 index 0000000..0bf1d11 --- /dev/null +++ b/framework/txcore/include/txcore.h @@ -0,0 +1,86 @@ +/* + * txcore.h - TxCore 공통 프레임워크 API + * + * TxCore 는 사내 표준 공통 프레임워크로, Tuxedo/ProFrame 계열 TP 모니터의 + * ATMI(tpcall/tpreturn/tpbegin) 및 FML/UBF(Fchg/Fget) 관용구를 얇게 감싼 + * 자체 구현 계층이다. 외부 TP 미들웨어 설치 없이 단독 빌드/링크된다. + */ +#ifndef TXCORE_H +#define TXCORE_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define TX_OK 0 +#define TX_FAIL (-1) +#define TX_ENOENT (-2) +#define TX_EINVAL (-3) +#define TX_EDB (-4) +#define TX_ENOMEM (-5) +#define TX_ENOKEY (-6) + +#define TX_LOG_DEBUG 0 +#define TX_LOG_INFO 1 +#define TX_LOG_WARN 2 +#define TX_LOG_ERROR 3 + +#define TX_MAX_SLOTS 64 +#define TX_KEY_LEN 32 +#define TX_VAL_LEN 256 + +typedef struct { + char key[TX_KEY_LEN]; + char val[TX_VAL_LEN]; + int len; + int used; +} TXFIELD; + +typedef struct { + int count; + TXFIELD slots[TX_MAX_SLOTS]; +} TXBUF; + +typedef struct { + char name[TX_KEY_LEN]; + TXBUF *in; + TXBUF *out; + int rcode; + long xid; +} TXSVCINFO; + +typedef void (*tx_service_fn)(TXSVCINFO *ctx); + +#define TX_SERVICE(name, ctx) void name(TXSVCINFO *ctx) + +TXBUF *tx_buf_alloc(void); +void tx_buf_free(TXBUF *buf); +void tx_buf_reset(TXBUF *buf); +int tx_buf_set(TXBUF *buf, const char *key, const char *val, int len); +int tx_buf_sets(TXBUF *buf, const char *key, const char *val); +int tx_buf_setlong(TXBUF *buf, const char *key, long val); +int tx_buf_get(TXBUF *buf, const char *key, char *out, int outlen); +int tx_buf_getlong(TXBUF *buf, const char *key, long *out); + +int tx_register(const char *name, tx_service_fn fn); +int tx_call(const char *svc, TXBUF *in, TXBUF *out); +int tx_return(TXSVCINFO *ctx, int rc, TXBUF *out); +int tx_service_count(void); + +int tx_begin(void); +int tx_commit(void); +int tx_abort(void); +long tx_current_xid(void); + +void tx_log(int level, const char *fmt, ...); +void tx_set_loglevel(int level); +const char *tx_strerror(int rc); + +#ifdef __cplusplus +} +#endif + +#endif /* TXCORE_H */ diff --git a/framework/txcore/src/txcore.c b/framework/txcore/src/txcore.c new file mode 100644 index 0000000..5ee58ef --- /dev/null +++ b/framework/txcore/src/txcore.c @@ -0,0 +1,265 @@ +/* + * txcore.c - TxCore 공통 프레임워크 구현 + */ +#include "txcore.h" + +#include +#include +#include +#include + +#define TX_MAX_SERVICES 512 + +typedef struct { + char name[TX_KEY_LEN]; + tx_service_fn fn; +} tx_entry_t; + +static tx_entry_t g_registry[TX_MAX_SERVICES]; +static int g_registry_count = 0; + +static int g_loglevel = TX_LOG_INFO; +static long g_xid_seq = 0; +static long g_cur_xid = 0; + +static const char *level_name(int level) +{ + switch (level) { + case TX_LOG_DEBUG: return "DEBUG"; + case TX_LOG_INFO: return "INFO "; + case TX_LOG_WARN: return "WARN "; + case TX_LOG_ERROR: return "ERROR"; + default: return "?????"; + } +} + +void tx_set_loglevel(int level) { g_loglevel = level; } + +void tx_log(int level, const char *fmt, ...) +{ + va_list ap; + time_t now; + struct tm tmv; + char ts[20]; + + if (level < g_loglevel) + return; + + now = time(NULL); + localtime_r(&now, &tmv); + strftime(ts, sizeof(ts), "%Y-%m-%d %H:%M:%S", &tmv); + + fprintf(stderr, "[%s] %s ", ts, level_name(level)); + va_start(ap, fmt); + vfprintf(stderr, fmt, ap); + va_end(ap); + fputc('\n', stderr); +} + +const char *tx_strerror(int rc) +{ + switch (rc) { + case TX_OK: return "정상"; + case TX_FAIL: return "일반 실패"; + case TX_ENOENT: return "서비스 미등록"; + case TX_EINVAL: return "파라미터 오류"; + case TX_EDB: return "DB 오류"; + case TX_ENOMEM: return "자원 부족"; + case TX_ENOKEY: return "버퍼 키 없음"; + default: return "알 수 없는 오류"; + } +} + +TXBUF *tx_buf_alloc(void) { return (TXBUF *)calloc(1, sizeof(TXBUF)); } +void tx_buf_free(TXBUF *buf) { if (buf) free(buf); } +void tx_buf_reset(TXBUF *buf) { if (buf) memset(buf, 0, sizeof(*buf)); } + +static TXFIELD *find_slot(TXBUF *buf, const char *key) +{ + int i; + for (i = 0; i < TX_MAX_SLOTS; i++) { + if (buf->slots[i].used && + strncmp(buf->slots[i].key, key, TX_KEY_LEN) == 0) + return &buf->slots[i]; + } + return NULL; +} + +static TXFIELD *alloc_slot(TXBUF *buf, const char *key) +{ + int i; + TXFIELD *f = find_slot(buf, key); + if (f) + return f; + for (i = 0; i < TX_MAX_SLOTS; i++) { + if (!buf->slots[i].used) { + f = &buf->slots[i]; + memset(f, 0, sizeof(*f)); + strncpy(f->key, key, TX_KEY_LEN - 1); + f->used = 1; + buf->count++; + return f; + } + } + return NULL; +} + +int tx_buf_set(TXBUF *buf, const char *key, const char *val, int len) +{ + TXFIELD *f; + if (!buf || !key || !val) + return TX_EINVAL; + if (len < 0 || len >= TX_VAL_LEN) + return TX_ENOMEM; + f = alloc_slot(buf, key); + if (!f) + return TX_ENOMEM; + memcpy(f->val, val, len); + f->val[len] = '\0'; + f->len = len; + return TX_OK; +} + +int tx_buf_sets(TXBUF *buf, const char *key, const char *val) +{ + if (!val) + return TX_EINVAL; + return tx_buf_set(buf, key, val, (int)strlen(val)); +} + +int tx_buf_setlong(TXBUF *buf, const char *key, long val) +{ + char tmp[32]; + snprintf(tmp, sizeof(tmp), "%ld", val); + return tx_buf_set(buf, key, tmp, (int)strlen(tmp)); +} + +int tx_buf_get(TXBUF *buf, const char *key, char *out, int outlen) +{ + TXFIELD *f; + if (!buf || !key || !out || outlen <= 0) + return TX_EINVAL; + f = find_slot(buf, key); + if (!f) + return TX_ENOKEY; + if (f->len >= outlen) + return TX_ENOMEM; + memcpy(out, f->val, f->len); + out[f->len] = '\0'; + return TX_OK; +} + +int tx_buf_getlong(TXBUF *buf, const char *key, long *out) +{ + TXFIELD *f; + char *end; + long v; + if (!buf || !key || !out) + return TX_EINVAL; + f = find_slot(buf, key); + if (!f) + return TX_ENOKEY; + v = strtol(f->val, &end, 10); + if (end == f->val) + return TX_EINVAL; + *out = v; + return TX_OK; +} + +int tx_register(const char *name, tx_service_fn fn) +{ + int i; + if (!name || !fn) + return TX_EINVAL; + if (g_registry_count >= TX_MAX_SERVICES) + return TX_ENOMEM; + for (i = 0; i < g_registry_count; i++) { + if (strncmp(g_registry[i].name, name, TX_KEY_LEN) == 0) { + g_registry[i].fn = fn; + return TX_OK; + } + } + strncpy(g_registry[g_registry_count].name, name, TX_KEY_LEN - 1); + g_registry[g_registry_count].fn = fn; + g_registry_count++; + tx_log(TX_LOG_DEBUG, "서비스 등록: %s", name); + return TX_OK; +} + +int tx_service_count(void) { return g_registry_count; } + +static tx_service_fn lookup(const char *name) +{ + int i; + for (i = 0; i < g_registry_count; i++) { + if (strncmp(g_registry[i].name, name, TX_KEY_LEN) == 0) + return g_registry[i].fn; + } + return NULL; +} + +int tx_call(const char *svc, TXBUF *in, TXBUF *out) +{ + tx_service_fn fn; + TXSVCINFO ctx; + if (!svc || !in || !out) + return TX_EINVAL; + fn = lookup(svc); + if (!fn) { + tx_log(TX_LOG_ERROR, "tx_call: 서비스 미등록 svc=%s", svc); + return TX_ENOENT; + } + memset(&ctx, 0, sizeof(ctx)); + strncpy(ctx.name, svc, TX_KEY_LEN - 1); + ctx.in = in; + ctx.out = out; + ctx.rcode = TX_OK; + ctx.xid = g_cur_xid; + fn(&ctx); + return ctx.rcode; +} + +int tx_return(TXSVCINFO *ctx, int rc, TXBUF *out) +{ + if (!ctx) + return TX_EINVAL; + ctx->rcode = rc; + if (out && ctx->out && out != ctx->out) + memcpy(ctx->out, out, sizeof(TXBUF)); + return rc; +} + +int tx_begin(void) +{ + if (g_cur_xid != 0) { + tx_log(TX_LOG_WARN, "tx_begin: 이미 진행중 xid=%ld", g_cur_xid); + return TX_FAIL; + } + g_cur_xid = ++g_xid_seq; + tx_log(TX_LOG_INFO, "tx_begin xid=%ld", g_cur_xid); + return TX_OK; +} + +int tx_commit(void) +{ + if (g_cur_xid == 0) { + tx_log(TX_LOG_WARN, "tx_commit: 트랜잭션 없음"); + return TX_FAIL; + } + tx_log(TX_LOG_INFO, "tx_commit xid=%ld", g_cur_xid); + g_cur_xid = 0; + return TX_OK; +} + +int tx_abort(void) +{ + if (g_cur_xid == 0) { + tx_log(TX_LOG_WARN, "tx_abort: 트랜잭션 없음"); + return TX_FAIL; + } + tx_log(TX_LOG_WARN, "tx_abort xid=%ld", g_cur_xid); + g_cur_xid = 0; + return TX_OK; +} + +long tx_current_xid(void) { return g_cur_xid; } diff --git a/generate.py b/generate.py new file mode 100644 index 0000000..bf56b89 --- /dev/null +++ b/generate.py @@ -0,0 +1,2254 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +""" +generate.py - acquire-core-full 레거시 C 코퍼스 결정론적 생성기 +================================================================ + +카드 매입·정산 도메인의 TxCore(사내 TP 프레임워크) 기반 레거시 C 시스템을 +아키타입별 템플릿 × 파라미터(module, program-id, difficulty tier)로 생성한다. + +- 각 프로그램은 self-contained: framework/txcore(공유 라이브러리)만 의존하며 + 독립적으로 .o 로 컴파일된다. +- 산출: framework/, app/{online,batch,dbio,common,include,shared}, fml/, scripts/, + mk/, config/, db/, Makefile, inventory.json + +사용법: + python3 generate.py [--fraction F] # F=1.0 full(~2050 files), 0.05 quick test +""" +import argparse +import json +import os +import shutil + +ROOT = os.path.dirname(os.path.abspath(__file__)) + +# 11개 업무 모듈: code -> (한글명, 영문 transform 태그) +MODULES = [ + ("mg", "전문게이트웨이", "msg-gateway"), + ("au", "승인한도", "authorization"), + ("ac", "매입", "acquire"), + ("rc", "대사", "reconciliation"), + ("vl", "정합성", "validation"), + ("st", "정산수수료", "settlement"), + ("py", "지급", "payment"), + ("lg", "원장", "ledger"), + ("mm", "마스터", "master"), + ("cm", "공통", "common"), + ("cl", "마감", "closing"), +] +MOD_CODES = [m[0] for m in MODULES] +MOD_KNAME = {m[0]: m[1] for m in MODULES} +MOD_XFORM = {m[0]: m[2] for m in MODULES} + +# 파일 타입별 목표 건수 (fraction=1.0 기준) +TARGETS = { + "online": 350, + "batch": 180, + "common": 120, + "dbio": 300, # 이 중 11개는 모듈 표준 dbio_main + "dbio_sql": 50, + "headers": 600, # core(11)+io헤더+cu헤더+standalone + "fml": 120, + "sh": 180, + "mk": 90, + "config": 60, +} + +# 데모 링크 대상 (생성 산출물로 링크 검증) +ONLINE_DEMOS = ["mg", "ac", "rc", "st"] +BATCH_DEMOS = ["rc", "cl"] + + +def tier_for(i): + """~55% easy, ~30% medium, ~15% hard (결정론적).""" + r = i % 20 + if r < 11: + return "easy" + if r < 17: + return "medium" + return "hard" + + +def render(tpl, **kw): + out = tpl + for k, v in kw.items(): + out = out.replace("@" + k + "@", str(v)) + return out + + +# ====================================================================== +# 공유 프레임워크 소스 (검증된 슬라이스에서 그대로 이식) - raw 문자열 +# ====================================================================== +TXCORE_H = r'''/* + * txcore.h - TxCore 공통 프레임워크 API + * + * TxCore 는 사내 표준 공통 프레임워크로, Tuxedo/ProFrame 계열 TP 모니터의 + * ATMI(tpcall/tpreturn/tpbegin) 및 FML/UBF(Fchg/Fget) 관용구를 얇게 감싼 + * 자체 구현 계층이다. 외부 TP 미들웨어 설치 없이 단독 빌드/링크된다. + */ +#ifndef TXCORE_H +#define TXCORE_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define TX_OK 0 +#define TX_FAIL (-1) +#define TX_ENOENT (-2) +#define TX_EINVAL (-3) +#define TX_EDB (-4) +#define TX_ENOMEM (-5) +#define TX_ENOKEY (-6) + +#define TX_LOG_DEBUG 0 +#define TX_LOG_INFO 1 +#define TX_LOG_WARN 2 +#define TX_LOG_ERROR 3 + +#define TX_MAX_SLOTS 64 +#define TX_KEY_LEN 32 +#define TX_VAL_LEN 256 + +typedef struct { + char key[TX_KEY_LEN]; + char val[TX_VAL_LEN]; + int len; + int used; +} TXFIELD; + +typedef struct { + int count; + TXFIELD slots[TX_MAX_SLOTS]; +} TXBUF; + +typedef struct { + char name[TX_KEY_LEN]; + TXBUF *in; + TXBUF *out; + int rcode; + long xid; +} TXSVCINFO; + +typedef void (*tx_service_fn)(TXSVCINFO *ctx); + +#define TX_SERVICE(name, ctx) void name(TXSVCINFO *ctx) + +TXBUF *tx_buf_alloc(void); +void tx_buf_free(TXBUF *buf); +void tx_buf_reset(TXBUF *buf); +int tx_buf_set(TXBUF *buf, const char *key, const char *val, int len); +int tx_buf_sets(TXBUF *buf, const char *key, const char *val); +int tx_buf_setlong(TXBUF *buf, const char *key, long val); +int tx_buf_get(TXBUF *buf, const char *key, char *out, int outlen); +int tx_buf_getlong(TXBUF *buf, const char *key, long *out); + +int tx_register(const char *name, tx_service_fn fn); +int tx_call(const char *svc, TXBUF *in, TXBUF *out); +int tx_return(TXSVCINFO *ctx, int rc, TXBUF *out); +int tx_service_count(void); + +int tx_begin(void); +int tx_commit(void); +int tx_abort(void); +long tx_current_xid(void); + +void tx_log(int level, const char *fmt, ...); +void tx_set_loglevel(int level); +const char *tx_strerror(int rc); + +#ifdef __cplusplus +} +#endif + +#endif /* TXCORE_H */ +''' + +TXCORE_DBIO_H = r'''/* + * txcore_dbio.h - TxCore DBIO 규약 (ECPG/Pro*C 공통) + */ +#ifndef TXCORE_DBIO_H +#define TXCORE_DBIO_H + +#include "txcore.h" + +#define TX_SQL_OK 0 +#define TX_SQL_NOTFOUND 100 + +#define TX_DBIO_RESULT(sc) \ + ((sc) == TX_SQL_OK ? TX_OK : \ + (sc) == TX_SQL_NOTFOUND ? TX_ENOENT : TX_EDB) + +#define TX_DBIO_LOG_ERR(tag) \ + tx_log(TX_LOG_ERROR, "DBIO 오류 [%s] sqlcode=%ld msg=%.*s", \ + (tag), (long)sqlca.sqlcode, \ + (int)sqlca.sqlerrm.sqlerrml, sqlca.sqlerrm.sqlerrmc) + +#endif /* TXCORE_DBIO_H */ +''' + +TXCORE_C = r'''/* + * txcore.c - TxCore 공통 프레임워크 구현 + */ +#include "txcore.h" + +#include +#include +#include +#include + +#define TX_MAX_SERVICES 512 + +typedef struct { + char name[TX_KEY_LEN]; + tx_service_fn fn; +} tx_entry_t; + +static tx_entry_t g_registry[TX_MAX_SERVICES]; +static int g_registry_count = 0; + +static int g_loglevel = TX_LOG_INFO; +static long g_xid_seq = 0; +static long g_cur_xid = 0; + +static const char *level_name(int level) +{ + switch (level) { + case TX_LOG_DEBUG: return "DEBUG"; + case TX_LOG_INFO: return "INFO "; + case TX_LOG_WARN: return "WARN "; + case TX_LOG_ERROR: return "ERROR"; + default: return "?????"; + } +} + +void tx_set_loglevel(int level) { g_loglevel = level; } + +void tx_log(int level, const char *fmt, ...) +{ + va_list ap; + time_t now; + struct tm tmv; + char ts[20]; + + if (level < g_loglevel) + return; + + now = time(NULL); + localtime_r(&now, &tmv); + strftime(ts, sizeof(ts), "%Y-%m-%d %H:%M:%S", &tmv); + + fprintf(stderr, "[%s] %s ", ts, level_name(level)); + va_start(ap, fmt); + vfprintf(stderr, fmt, ap); + va_end(ap); + fputc('\n', stderr); +} + +const char *tx_strerror(int rc) +{ + switch (rc) { + case TX_OK: return "정상"; + case TX_FAIL: return "일반 실패"; + case TX_ENOENT: return "서비스 미등록"; + case TX_EINVAL: return "파라미터 오류"; + case TX_EDB: return "DB 오류"; + case TX_ENOMEM: return "자원 부족"; + case TX_ENOKEY: return "버퍼 키 없음"; + default: return "알 수 없는 오류"; + } +} + +TXBUF *tx_buf_alloc(void) { return (TXBUF *)calloc(1, sizeof(TXBUF)); } +void tx_buf_free(TXBUF *buf) { if (buf) free(buf); } +void tx_buf_reset(TXBUF *buf) { if (buf) memset(buf, 0, sizeof(*buf)); } + +static TXFIELD *find_slot(TXBUF *buf, const char *key) +{ + int i; + for (i = 0; i < TX_MAX_SLOTS; i++) { + if (buf->slots[i].used && + strncmp(buf->slots[i].key, key, TX_KEY_LEN) == 0) + return &buf->slots[i]; + } + return NULL; +} + +static TXFIELD *alloc_slot(TXBUF *buf, const char *key) +{ + int i; + TXFIELD *f = find_slot(buf, key); + if (f) + return f; + for (i = 0; i < TX_MAX_SLOTS; i++) { + if (!buf->slots[i].used) { + f = &buf->slots[i]; + memset(f, 0, sizeof(*f)); + strncpy(f->key, key, TX_KEY_LEN - 1); + f->used = 1; + buf->count++; + return f; + } + } + return NULL; +} + +int tx_buf_set(TXBUF *buf, const char *key, const char *val, int len) +{ + TXFIELD *f; + if (!buf || !key || !val) + return TX_EINVAL; + if (len < 0 || len >= TX_VAL_LEN) + return TX_ENOMEM; + f = alloc_slot(buf, key); + if (!f) + return TX_ENOMEM; + memcpy(f->val, val, len); + f->val[len] = '\0'; + f->len = len; + return TX_OK; +} + +int tx_buf_sets(TXBUF *buf, const char *key, const char *val) +{ + if (!val) + return TX_EINVAL; + return tx_buf_set(buf, key, val, (int)strlen(val)); +} + +int tx_buf_setlong(TXBUF *buf, const char *key, long val) +{ + char tmp[32]; + snprintf(tmp, sizeof(tmp), "%ld", val); + return tx_buf_set(buf, key, tmp, (int)strlen(tmp)); +} + +int tx_buf_get(TXBUF *buf, const char *key, char *out, int outlen) +{ + TXFIELD *f; + if (!buf || !key || !out || outlen <= 0) + return TX_EINVAL; + f = find_slot(buf, key); + if (!f) + return TX_ENOKEY; + if (f->len >= outlen) + return TX_ENOMEM; + memcpy(out, f->val, f->len); + out[f->len] = '\0'; + return TX_OK; +} + +int tx_buf_getlong(TXBUF *buf, const char *key, long *out) +{ + TXFIELD *f; + char *end; + long v; + if (!buf || !key || !out) + return TX_EINVAL; + f = find_slot(buf, key); + if (!f) + return TX_ENOKEY; + v = strtol(f->val, &end, 10); + if (end == f->val) + return TX_EINVAL; + *out = v; + return TX_OK; +} + +int tx_register(const char *name, tx_service_fn fn) +{ + int i; + if (!name || !fn) + return TX_EINVAL; + if (g_registry_count >= TX_MAX_SERVICES) + return TX_ENOMEM; + for (i = 0; i < g_registry_count; i++) { + if (strncmp(g_registry[i].name, name, TX_KEY_LEN) == 0) { + g_registry[i].fn = fn; + return TX_OK; + } + } + strncpy(g_registry[g_registry_count].name, name, TX_KEY_LEN - 1); + g_registry[g_registry_count].fn = fn; + g_registry_count++; + tx_log(TX_LOG_DEBUG, "서비스 등록: %s", name); + return TX_OK; +} + +int tx_service_count(void) { return g_registry_count; } + +static tx_service_fn lookup(const char *name) +{ + int i; + for (i = 0; i < g_registry_count; i++) { + if (strncmp(g_registry[i].name, name, TX_KEY_LEN) == 0) + return g_registry[i].fn; + } + return NULL; +} + +int tx_call(const char *svc, TXBUF *in, TXBUF *out) +{ + tx_service_fn fn; + TXSVCINFO ctx; + if (!svc || !in || !out) + return TX_EINVAL; + fn = lookup(svc); + if (!fn) { + tx_log(TX_LOG_ERROR, "tx_call: 서비스 미등록 svc=%s", svc); + return TX_ENOENT; + } + memset(&ctx, 0, sizeof(ctx)); + strncpy(ctx.name, svc, TX_KEY_LEN - 1); + ctx.in = in; + ctx.out = out; + ctx.rcode = TX_OK; + ctx.xid = g_cur_xid; + fn(&ctx); + return ctx.rcode; +} + +int tx_return(TXSVCINFO *ctx, int rc, TXBUF *out) +{ + if (!ctx) + return TX_EINVAL; + ctx->rcode = rc; + if (out && ctx->out && out != ctx->out) + memcpy(ctx->out, out, sizeof(TXBUF)); + return rc; +} + +int tx_begin(void) +{ + if (g_cur_xid != 0) { + tx_log(TX_LOG_WARN, "tx_begin: 이미 진행중 xid=%ld", g_cur_xid); + return TX_FAIL; + } + g_cur_xid = ++g_xid_seq; + tx_log(TX_LOG_INFO, "tx_begin xid=%ld", g_cur_xid); + return TX_OK; +} + +int tx_commit(void) +{ + if (g_cur_xid == 0) { + tx_log(TX_LOG_WARN, "tx_commit: 트랜잭션 없음"); + return TX_FAIL; + } + tx_log(TX_LOG_INFO, "tx_commit xid=%ld", g_cur_xid); + g_cur_xid = 0; + return TX_OK; +} + +int tx_abort(void) +{ + if (g_cur_xid == 0) { + tx_log(TX_LOG_WARN, "tx_abort: 트랜잭션 없음"); + return TX_FAIL; + } + tx_log(TX_LOG_WARN, "tx_abort xid=%ld", g_cur_xid); + g_cur_xid = 0; + return TX_OK; +} + +long tx_current_xid(void) { return g_cur_xid; } +''' + +MSG_LAYOUT_H = r'''/* + * msg_layout.h - 카드 매입 전문(電文) 고정길이 레이아웃 (공유) + */ +#ifndef MSG_LAYOUT_H +#define MSG_LAYOUT_H + +#define MSG_TYPE_RECV "0200" +#define MSG_TYPE_RESP "0210" +#define MSG_TYPE_RECON "0500" + +#define RESP_OK "0000" +#define RESP_INVALID "9001" +#define RESP_NOMERCH "9002" +#define RESP_SYSERR "9999" + +typedef struct { + char msg_type[4]; + char trans_code[6]; + char merch_id[15]; + char card_no[16]; + char approval_no[9]; + char amount[12]; + char txn_date[8]; + char txn_time[6]; + char inst_month[2]; + char resp_code[4]; + char filler[18]; +} acq_msg_t; + +#define MSG_ACQ_LEN ((int)sizeof(acq_msg_t)) + +#define FLD_MSG_TYPE_LEN 4 +#define FLD_TRANS_CODE_LEN 6 +#define FLD_MERCH_ID_LEN 15 +#define FLD_CARD_NO_LEN 16 +#define FLD_APPROVAL_LEN 9 +#define FLD_AMOUNT_LEN 12 +#define FLD_TXN_DATE_LEN 8 +#define FLD_TXN_TIME_LEN 6 +#define FLD_INST_LEN 2 +#define FLD_RESP_LEN 4 + +#endif /* MSG_LAYOUT_H */ +''' + +ACQ_UTIL_H = r'''/* + * acq_util.h - 공통 유틸리티 (일자/금액/전문) 선언 (공유) + */ +#ifndef ACQ_UTIL_H +#define ACQ_UTIL_H + +#include "msg_layout.h" + +int date_is_valid(const char *yyyymmdd); +int date_weekday(const char *yyyymmdd); +int date_is_weekend(const char *yyyymmdd); +int date_next_business(const char *yyyymmdd, char *out); +void date_today(char *out); + +long amount_parse(const char *field, int len); +int amount_format(long amount, char *out, int len); +void amount_format_won(long amount, char *out, int outlen); +int amount_is_valid(long amount); + +void msg_field_copy(char *out, const char *field, int len); +void msg_field_set(char *field, const char *src, int len); +void msg_field_set_num(char *field, const char *src, int len); +int msg_unpack(acq_msg_t *msg, const char *raw, int rawlen); +int msg_pack(const acq_msg_t *msg, char *raw, int rawlen); +int msg_validate(const acq_msg_t *msg); + +#endif /* ACQ_UTIL_H */ +''' + +UTIL_DATE_C = r'''/* + * util_date.c - 일자/영업일 유틸리티 (plain C, 공유) + */ +#include "acq_util.h" + +#include +#include +#include +#include + +static int is_all_digit(const char *s, int len) +{ + int i; + for (i = 0; i < len; i++) + if (!isdigit((unsigned char)s[i])) + return 0; + return 1; +} + +static int to_int(const char *s, int len) +{ + int i, v = 0; + for (i = 0; i < len; i++) + v = v * 10 + (s[i] - '0'); + return v; +} + +static int days_in_month(int y, int m) +{ + static const int d[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; + if (m < 1 || m > 12) + return 0; + if (m == 2) { + int leap = (y % 4 == 0 && y % 100 != 0) || (y % 400 == 0); + return leap ? 29 : 28; + } + return d[m - 1]; +} + +int date_is_valid(const char *yyyymmdd) +{ + int y, m, d; + if (!yyyymmdd || strlen(yyyymmdd) < 8) + return 0; + if (!is_all_digit(yyyymmdd, 8)) + return 0; + y = to_int(yyyymmdd, 4); + m = to_int(yyyymmdd + 4, 2); + d = to_int(yyyymmdd + 6, 2); + if (y < 1900 || y > 2999) return 0; + if (m < 1 || m > 12) return 0; + if (d < 1 || d > days_in_month(y, m)) return 0; + return 1; +} + +int date_weekday(const char *yyyymmdd) +{ + static const int t[] = { 0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4 }; + int y, m, d; + if (!date_is_valid(yyyymmdd)) + return -1; + y = to_int(yyyymmdd, 4); + m = to_int(yyyymmdd + 4, 2); + d = to_int(yyyymmdd + 6, 2); + if (m < 3) + y -= 1; + return (y + y / 4 - y / 100 + y / 400 + t[m - 1] + d) % 7; +} + +int date_is_weekend(const char *yyyymmdd) +{ + int w = date_weekday(yyyymmdd); + return (w == 0 || w == 6) ? 1 : 0; +} + +static void add_one_day(const char *in, char *out) +{ + int y = to_int(in, 4); + int m = to_int(in + 4, 2); + int d = to_int(in + 6, 2); + d++; + if (d > days_in_month(y, m)) { + d = 1; m++; + if (m > 12) { m = 1; y++; } + } + snprintf(out, 9, "%04d%02d%02d", y, m, d); +} + +int date_next_business(const char *yyyymmdd, char *out) +{ + char cur[9]; + int guard = 0; + if (!date_is_valid(yyyymmdd) || !out) + return -1; + memcpy(cur, yyyymmdd, 8); + cur[8] = '\0'; + do { + add_one_day(cur, cur); + if (++guard > 14) + return -1; + } while (date_is_weekend(cur)); + memcpy(out, cur, 8); + out[8] = '\0'; + return 0; +} + +void date_today(char *out) +{ + time_t now = time(NULL); + struct tm tmv; + localtime_r(&now, &tmv); + strftime(out, 9, "%Y%m%d", &tmv); +} +''' + +UTIL_AMOUNT_C = r'''/* + * util_amount.c - 금액/통화 유틸리티 (plain C, 공유) + */ +#include "acq_util.h" + +#include +#include +#include + +#define AMOUNT_MAX 100000000L + +long amount_parse(const char *field, int len) +{ + long v = 0; + int i; + if (!field || len <= 0) + return -1; + for (i = 0; i < len; i++) { + char c = field[i]; + if (c == ' ') + continue; + if (!isdigit((unsigned char)c)) + return -1; + v = v * 10 + (c - '0'); + } + return v; +} + +int amount_format(long amount, char *out, int len) +{ + char tmp[32]; + int n; + if (!out || len <= 0 || amount < 0) + return -1; + n = snprintf(tmp, sizeof(tmp), "%0*ld", len, amount); + if (n < 0 || n > len) + return -1; + memcpy(out, tmp, len); + return 0; +} + +void amount_format_won(long amount, char *out, int outlen) +{ + char raw[32]; + int n, i, j, digits, first; + if (!out || outlen <= 0) + return; + n = snprintf(raw, sizeof(raw), "%ld", amount); + if (n < 0) { out[0] = '\0'; return; } + first = (raw[0] == '-') ? 1 : 0; + digits = n - first; + j = 0; + if (first && j < outlen - 1) + out[j++] = '-'; + for (i = first; i < n && j < outlen - 1; i++) { + int pos = i - first; + if (pos > 0 && (digits - pos) % 3 == 0) + if (j < outlen - 1) + out[j++] = ','; + out[j++] = raw[i]; + } + out[j] = '\0'; +} + +int amount_is_valid(long amount) +{ + return (amount >= 1 && amount <= AMOUNT_MAX) ? 1 : 0; +} +''' + +UTIL_MSG_C = r'''/* + * util_msg.c - 고정길이 전문 pack/unpack 유틸리티 (plain C, 공유) + */ +#include "acq_util.h" + +#include +#include + +void msg_field_copy(char *out, const char *field, int len) +{ + int end; + if (!out || !field || len < 0) + return; + end = len; + while (end > 0 && (field[end - 1] == ' ' || field[end - 1] == '\0')) + end--; + memcpy(out, field, end); + out[end] = '\0'; +} + +void msg_field_set(char *field, const char *src, int len) +{ + int slen, i; + if (!field || len < 0) + return; + slen = src ? (int)strlen(src) : 0; + if (slen > len) + slen = len; + memcpy(field, src, slen); + for (i = slen; i < len; i++) + field[i] = ' '; +} + +void msg_field_set_num(char *field, const char *src, int len) +{ + int slen, pad, i; + if (!field || len < 0) + return; + slen = src ? (int)strlen(src) : 0; + if (slen > len) + slen = len; + pad = len - slen; + for (i = 0; i < pad; i++) + field[i] = '0'; + if (src) + memcpy(field + pad, src, slen); +} + +int msg_unpack(acq_msg_t *msg, const char *raw, int rawlen) +{ + if (!msg || !raw) + return -1; + if (rawlen < MSG_ACQ_LEN) + return -1; + memcpy(msg, raw, MSG_ACQ_LEN); + return 0; +} + +int msg_pack(const acq_msg_t *msg, char *raw, int rawlen) +{ + if (!msg || !raw) + return -1; + if (rawlen < MSG_ACQ_LEN) + return -1; + memcpy(raw, msg, MSG_ACQ_LEN); + return 0; +} + +static int field_blank(const char *field, int len) +{ + int i; + for (i = 0; i < len; i++) + if (field[i] != ' ' && field[i] != '\0') + return 0; + return 1; +} + +int msg_validate(const acq_msg_t *msg) +{ + if (!msg) + return -1; + if (field_blank(msg->msg_type, FLD_MSG_TYPE_LEN)) return -1; + if (field_blank(msg->merch_id, FLD_MERCH_ID_LEN)) return -1; + if (field_blank(msg->card_no, FLD_CARD_NO_LEN)) return -1; + if (field_blank(msg->amount, FLD_AMOUNT_LEN)) return -1; + if (field_blank(msg->txn_date, FLD_TXN_DATE_LEN)) return -1; + return 0; +} +''' + +# ====================================================================== +# 모듈 core 헤더 (표준 DBIO API + 레코드 구조 + 상태코드) +# ====================================================================== +CORE_H_TPL = r'''/* + * @mod@_core.h - @KMOD@ 모듈 핵심 계약 (레코드/상태/표준 DBIO API) + * + * 이 모듈의 온라인/배치 프로그램은 SQL 을 직접 다루지 않고 아래 표준 + * DBIO API 만 호출한다. 구현은 app/dbio/@mod@_dbio_main.pgc (ECPG). + */ +#ifndef @MOD@_CORE_H +#define @MOD@_CORE_H + +#include "txcore.h" + +/* @KMOD@ 처리 상태코드 */ +#define @MOD@_ST_RECV "R" /* 접수/수신 */ +#define @MOD@_ST_DONE "M" /* 처리완료 */ +#define @MOD@_ST_FAIL "U" /* 불일치/실패 */ +#define @MOD@_ST_SETTLED "S" /* 정산완료 */ + +/* @KMOD@ 원장 레코드 (1행) */ +typedef struct { + char key[16]; /* 처리키(승인/거래 번호) PK */ + char merch_id[16]; /* 가맹점번호 */ + char card_no[20]; /* 카드번호(마스킹) */ + long amount; /* 거래금액(원) */ + char biz_date[9]; /* 영업일 YYYYMMDD */ + char status[2]; /* 상태코드 */ + long fee; /* 수수료(원) */ +} @mod@_rec_t; + +/* 표준 DBIO API (구현: @mod@_dbio_main.pgc) */ +int @mod@_dbio_connect(const char *target); +int @mod@_dbio_disconnect(void); +int @mod@_rec_insert(const @mod@_rec_t *rec); +int @mod@_rec_select(const char *key, @mod@_rec_t *out); +int @mod@_rec_update_status(const char *key, const char *status); +long @mod@_rec_count(const char *biz_date, const char *status); +int @mod@_rec_sum(const char *biz_date, long *out_sum); + +#endif /* @MOD@_CORE_H */ +''' + +DBIO_MAIN_TPL = r'''/* @tier medium @module @mod@ @transform @XFORM@-dbio */ +/* + * @mod@_dbio_main.pgc - @KMOD@ 표준 DBIO (ECPG 임베디드 SQL) + * + * @mod@_core.h 의 표준 API 를 @mod@_ledger 테이블에 대해 구현한다. + * 온라인/배치 프로그램은 이 함수들만 호출한다 (self-contained). + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "@mod@_core.h" + +EXEC SQL INCLUDE sqlca; + +int @mod@_dbio_connect(const char *target) +{ + EXEC SQL BEGIN DECLARE SECTION; + const char *h_target; + EXEC SQL END DECLARE SECTION; + + h_target = (target && target[0]) ? target : "acquire@localhost"; + + EXEC SQL CONNECT TO :h_target; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("@mod@ CONNECT"); + return TX_EDB; + } + tx_log(TX_LOG_INFO, "[@mod@] DB 접속 완료 target=%s", h_target); + return TX_OK; +} + +int @mod@_dbio_disconnect(void) +{ + EXEC SQL DISCONNECT CURRENT; + return TX_OK; +} + +int @mod@_rec_insert(const @mod@_rec_t *rec) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + char h_merch_id[16]; + char h_card_no[20]; + long h_amount; + char h_biz_date[9]; + char h_status[2]; + long h_fee; + EXEC SQL END DECLARE SECTION; + + if (!rec) + return TX_EINVAL; + + strncpy(h_key, rec->key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + strncpy(h_merch_id, rec->merch_id, sizeof(h_merch_id) - 1); + h_merch_id[sizeof(h_merch_id) - 1] = '\0'; + strncpy(h_card_no, rec->card_no, sizeof(h_card_no) - 1); + h_card_no[sizeof(h_card_no) - 1] = '\0'; + strncpy(h_biz_date, rec->biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + strncpy(h_status, rec->status, sizeof(h_status) - 1); + h_status[sizeof(h_status) - 1] = '\0'; + h_amount = rec->amount; + h_fee = rec->fee; + + EXEC SQL INSERT INTO @mod@_ledger + (key, merch_id, card_no, amount, biz_date, status, fee) + VALUES + (:h_key, :h_merch_id, :h_card_no, :h_amount, :h_biz_date, :h_status, :h_fee); + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("@mod@_rec_insert"); + return TX_EDB; + } + return TX_OK; +} + +int @mod@_rec_select(const char *key, @mod@_rec_t *out) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + char h_merch_id[16]; + char h_card_no[20]; + long h_amount; + char h_biz_date[9]; + char h_status[2]; + long h_fee; + EXEC SQL END DECLARE SECTION; + + if (!key || !out) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT merch_id, card_no, amount, biz_date, status, fee + INTO :h_merch_id, :h_card_no, :h_amount, :h_biz_date, :h_status, :h_fee + FROM @mod@_ledger + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("@mod@_rec_select"); + return TX_EDB; + } + + memset(out, 0, sizeof(*out)); + strncpy(out->key, h_key, sizeof(out->key) - 1); + strncpy(out->merch_id, h_merch_id, sizeof(out->merch_id) - 1); + strncpy(out->card_no, h_card_no, sizeof(out->card_no) - 1); + strncpy(out->biz_date, h_biz_date, sizeof(out->biz_date) - 1); + strncpy(out->status, h_status, sizeof(out->status) - 1); + out->amount = h_amount; + out->fee = h_fee; + return TX_OK; +} + +int @mod@_rec_update_status(const char *key, const char *status) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + char h_status[2]; + EXEC SQL END DECLARE SECTION; + + if (!key || !status) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + strncpy(h_status, status, sizeof(h_status) - 1); + h_status[sizeof(h_status) - 1] = '\0'; + + EXEC SQL UPDATE @mod@_ledger + SET status = :h_status, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("@mod@_rec_update_status"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long @mod@_rec_count(const char *biz_date, const char *status) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_status[2]; + int h_cnt; + EXEC SQL END DECLARE SECTION; + + if (!biz_date || !status) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + strncpy(h_status, status, sizeof(h_status) - 1); + h_status[sizeof(h_status) - 1] = '\0'; + + EXEC SQL SELECT count(*) + INTO :h_cnt + FROM @mod@_ledger + WHERE biz_date = :h_biz_date + AND status = :h_status; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("@mod@_rec_count"); + return -1; + } + return (long)h_cnt; +} + +int @mod@_rec_sum(const char *biz_date, long *out_sum) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date || !out_sum) + return TX_EINVAL; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM @mod@_ledger + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("@mod@_rec_sum"); + return TX_EDB; + } + *out_sum = h_sum; + return TX_OK; +} +''' + +# ====================================================================== +# 온라인 서비스 (.pgc) - easy / medium / hard +# ====================================================================== +ONLINE_HEAD = r'''/* @tier @TIER@ @module @mod@ @transform @XFORM@-online */ +/* + * @ID@.pgc - @KMOD@ 온라인 서비스 (@SVC@) [tier=@TIER@] + * + * TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 @mod@ 표준 DBIO 를 + * 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응) + */ +#include +#include + +#include "txcore.h" +#include "acq_util.h" +#include "@mod@_core.h" + +EXEC SQL INCLUDE sqlca; + +''' + +ONLINE_EASY = r'''TX_SERVICE(@SVC@, ctx) +{ + @mod@_rec_t rec; + char key[16]; + int rc; + + tx_log(TX_LOG_INFO, "[@SVC@] @KMOD@ 단건조회 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[@SVC@] KEY 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + rc = @mod@_rec_select(key, &rec); + if (rc != TX_OK) { + tx_log(TX_LOG_WARN, "[@SVC@] 조회 실패 key=%s rc=%d(%s)", + key, rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "KEY", rec.key); + tx_buf_sets(ctx->out, "MERCHID", rec.merch_id); + tx_buf_setlong(ctx->out, "AMOUNT", rec.amount); + tx_buf_sets(ctx->out, "STATUS", rec.status); + tx_log(TX_LOG_INFO, "[@SVC@] 조회완료 key=%s amount=%ld", key, rec.amount); + tx_return(ctx, TX_OK, ctx->out); +} +''' + +ONLINE_MEDIUM = r'''TX_SERVICE(@SVC@, ctx) +{ + @mod@_rec_t rec; + char key[16], merch[16], bizdate[16]; + long amount = 0, cnt; + int rc; + + tx_log(TX_LOG_INFO, "[@SVC@] @KMOD@ 등록 서비스 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[@SVC@] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + /* 업무검증: 금액 범위 + 영업일 형식 */ + if (!amount_is_valid(amount)) { + tx_log(TX_LOG_WARN, "[@SVC@] 금액 범위 오류 amount=%ld", amount); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + if (!date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[@SVC@] 영업일 오류 date=%s", bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, @MOD@_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; /* 수수료 1% 가정 */ + + rc = @mod@_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[@SVC@] 등록 실패 rc=%d(%s)", rc, tx_strerror(rc)); + tx_return(ctx, rc, ctx->out); + return; + } + + cnt = @mod@_rec_count(bizdate, @MOD@_ST_RECV); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYCNT", (cnt < 0) ? 0 : cnt); + tx_log(TX_LOG_INFO, "[@SVC@] 등록완료 key=%s 당일건수=%ld", key, cnt); + tx_return(ctx, TX_OK, ctx->out); +} +''' + +ONLINE_HARD = r'''TX_SERVICE(@SVC@, ctx) +{ + @mod@_rec_t rec; + char key[16], merch[16], bizdate[16], nextbiz[9]; + long amount = 0, daysum = 0; + int rc; + TXBUF *sub_in; + TXBUF *sub_out; + + tx_log(TX_LOG_INFO, "[@SVC@] @KMOD@ 트랜잭션 오케스트레이션 진입"); + + if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK || + tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK || + tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) { + tx_log(TX_LOG_ERROR, "[@SVC@] 필수 필드 누락"); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + tx_buf_getlong(ctx->in, "AMOUNT", &amount); + + if (!amount_is_valid(amount) || !date_is_valid(bizdate)) { + tx_log(TX_LOG_WARN, "[@SVC@] 입력 검증 실패 amount=%ld date=%s", + amount, bizdate); + tx_return(ctx, TX_EINVAL, ctx->out); + return; + } + + /* 트랜잭션 시작 → 원장 반영 → 후속 서비스 연계 → 커밋 */ + if (tx_begin() != TX_OK) { + tx_return(ctx, TX_FAIL, ctx->out); + return; + } + + memset(&rec, 0, sizeof(rec)); + strncpy(rec.key, key, sizeof(rec.key) - 1); + strncpy(rec.merch_id, merch, sizeof(rec.merch_id) - 1); + strncpy(rec.biz_date, bizdate, sizeof(rec.biz_date) - 1); + strncpy(rec.status, @MOD@_ST_RECV, sizeof(rec.status) - 1); + rec.amount = amount; + rec.fee = amount / 100; + + rc = @mod@_rec_insert(&rec); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[@SVC@] 원장반영 실패 rc=%d", rc); + tx_abort(); + tx_return(ctx, rc, ctx->out); + return; + } + + /* 정산 영업일 = 거래일의 다음 영업일 */ + if (date_next_business(bizdate, nextbiz) != 0) { + memcpy(nextbiz, bizdate, 8); + nextbiz[8] = '\0'; + } + + /* 후속 정산집계 서비스 연계 (레지스트리 문자열 디스패치) */ + sub_in = tx_buf_alloc(); + sub_out = tx_buf_alloc(); + if (sub_in && sub_out) { + tx_buf_sets(sub_in, "MERCHID", merch); + tx_buf_sets(sub_in, "BIZDATE", nextbiz); + tx_buf_setlong(sub_in, "AMOUNT", amount); + rc = tx_call("@NEXTSVC@", sub_in, sub_out); + if (rc != TX_OK) + tx_log(TX_LOG_WARN, "[@SVC@] 후속연계 경고 rc=%d", rc); + } + tx_buf_free(sub_in); + tx_buf_free(sub_out); + + /* 교차 검증: 당일 합계 재계산 */ + if (@mod@_rec_sum(bizdate, &daysum) != TX_OK) + daysum = 0; + + tx_commit(); + + tx_buf_reset(ctx->out); + tx_buf_sets(ctx->out, "RESPCODE", RESP_OK); + tx_buf_sets(ctx->out, "KEY", key); + tx_buf_setlong(ctx->out, "DAYSUM", daysum); + tx_log(TX_LOG_INFO, "[@SVC@] 완료 key=%s 당일합계=%ld", key, daysum); + tx_return(ctx, TX_OK, ctx->out); +} +''' + +# ====================================================================== +# 배치 (.pgc) - 커서 DECLARE/OPEN/FETCH 루프 + main() +# ====================================================================== +BATCH_TPL = r'''/* @tier @TIER@ @module @mod@ @transform @XFORM@-batch */ +/* + * @ID@.pgc - @KMOD@ 배치 (커서 순회 + 상태전이) [tier=@TIER@] + * + * 지정 영업일의 접수(status='R') 건을 커서로 순회하며 업무규칙에 따라 + * 완료('M')/불일치('U') 로 상태를 전이한다. 배치 main 엔트리 포함. + * + * 실행: @ID@ [db@host] + */ +#include +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "acq_util.h" +#include "@mod@_core.h" + +EXEC SQL INCLUDE sqlca; + +static int run_@ID@(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + char h_key[16]; + char h_merch_id[16]; + long h_amount; + char h_new_status[2]; + EXEC SQL END DECLARE SECTION; + + long total = 0, done = 0, unmatch = 0, errcnt = 0; + int rc; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL DECLARE cur_@ID@ CURSOR FOR + SELECT key, merch_id, amount + FROM @mod@_ledger + WHERE biz_date = :h_biz_date + AND status = 'R' + ORDER BY key; + + EXEC SQL OPEN cur_@ID@; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("OPEN cur_@ID@"); + return TX_EDB; + } + + if (tx_begin() != TX_OK) + tx_log(TX_LOG_WARN, "[@ID@] tx_begin 경고"); + + for (;;) { + EXEC SQL FETCH cur_@ID@ INTO :h_key, :h_merch_id, :h_amount; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + break; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("FETCH cur_@ID@"); + errcnt++; + break; + } + + total++; + + /* 업무규칙: 금액 유효성으로 완료/불일치 판정 */ + if (amount_is_valid(h_amount)) { + strncpy(h_new_status, @MOD@_ST_DONE, sizeof(h_new_status)); + done++; + } else { + strncpy(h_new_status, @MOD@_ST_FAIL, sizeof(h_new_status)); + unmatch++; + } + + rc = @mod@_rec_update_status(h_key, h_new_status); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[@ID@] 상태전이 실패 key=%s rc=%d", h_key, rc); + errcnt++; + } + } + + EXEC SQL CLOSE cur_@ID@; + + if (errcnt == 0) + tx_commit(); + else + tx_abort(); + + tx_log(TX_LOG_INFO, + "[@ID@] 요약 date=%s 대상=%ld 완료=%ld 불일치=%ld 오류=%ld", + biz_date, total, done, unmatch, errcnt); + + printf("========== @KMOD@ 배치 결과 [@ID@] ==========\n"); + printf(" 영업일 : %s\n", biz_date); + printf(" 대상 건수 : %ld\n", total); + printf(" 완료(M) : %ld\n", done); + printf(" 불일치(U) : %ld\n", unmatch); + printf(" 오류 건수 : %ld\n", errcnt); + printf("=============================================\n"); + + return (errcnt == 0) ? TX_OK : TX_FAIL; +} + +int main(int argc, char **argv) +{ + const char *biz_date; + const char *target; + int rc; + + tx_set_loglevel(TX_LOG_INFO); + + if (argc < 2) { + fprintf(stderr, "사용법: %s [db@host]\n", argv[0]); + return 2; + } + biz_date = argv[1]; + target = (argc >= 3) ? argv[2] : NULL; + + if (!date_is_valid(biz_date)) { + fprintf(stderr, "오류: 유효하지 않은 영업일 '%s'\n", biz_date); + return 2; + } + + tx_log(TX_LOG_INFO, "[@ID@] 배치 시작 date=%s", biz_date); + + rc = @mod@_dbio_connect(target); + if (rc != TX_OK) { + tx_log(TX_LOG_ERROR, "[@ID@] DB 접속 실패 rc=%d", rc); + return 1; + } + + rc = run_@ID@(biz_date); + + @mod@_dbio_disconnect(); + + tx_log(TX_LOG_INFO, "[@ID@] 배치 종료 rc=%d(%s)", rc, tx_strerror(rc)); + return (rc == TX_OK) ? 0 : 1; +} +''' + +# ====================================================================== +# 추가 DBIO (.pgc) - 자체 헤더에 선언된 함수 구현 (self-contained) +# ====================================================================== +DBIO_EXTRA_H = r'''/* + * @ID@.h - @KMOD@ 보조 DBIO 선언 (@ID@.pgc 구현) + */ +#ifndef @IDU@_H +#define @IDU@_H + +#include "txcore.h" + +/* @ID@ 전용 조회/갱신 (테이블 @ID@_t) */ +int @ID@_fetch(const char *key, long *out_amount); +int @ID@_touch(const char *key, long amount); +long @ID@_total(const char *biz_date); + +#endif /* @IDU@_H */ +''' + +DBIO_EXTRA_TPL = r'''/* @tier @TIER@ @module @mod@ @transform @XFORM@-dbio */ +/* + * @ID@.pgc - @KMOD@ 보조 DBIO (ECPG) [tier=@TIER@] + */ +#include +#include + +#include "txcore.h" +#include "txcore_dbio.h" +#include "@ID@.h" + +EXEC SQL INCLUDE sqlca; + +int @ID@_fetch(const char *key, long *out_amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key || !out_amount) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + + EXEC SQL SELECT amount + INTO :h_amount + FROM @ID@_t + WHERE key = :h_key; + + if (sqlca.sqlcode == TX_SQL_NOTFOUND) + return TX_ENOENT; + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("@ID@_fetch"); + return TX_EDB; + } + *out_amount = h_amount; + return TX_OK; +} + +int @ID@_touch(const char *key, long amount) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_key[16]; + long h_amount; + EXEC SQL END DECLARE SECTION; + + if (!key) + return TX_EINVAL; + + strncpy(h_key, key, sizeof(h_key) - 1); + h_key[sizeof(h_key) - 1] = '\0'; + h_amount = amount; + + EXEC SQL UPDATE @ID@_t + SET amount = :h_amount, upd_ts = now() + WHERE key = :h_key; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("@ID@_touch"); + return TX_EDB; + } + if (sqlca.sqlerrd[2] == 0) + return TX_ENOENT; + return TX_OK; +} + +long @ID@_total(const char *biz_date) +{ + EXEC SQL BEGIN DECLARE SECTION; + char h_biz_date[9]; + long h_sum; + EXEC SQL END DECLARE SECTION; + + if (!biz_date) + return -1; + + strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1); + h_biz_date[sizeof(h_biz_date) - 1] = '\0'; + + EXEC SQL SELECT coalesce(sum(amount), 0) + INTO :h_sum + FROM @ID@_t + WHERE biz_date = :h_biz_date; + + if (sqlca.sqlcode != TX_SQL_OK) { + TX_DBIO_LOG_ERR("@ID@_total"); + return -1; + } + return h_sum; +} +''' + +# ====================================================================== +# 공통 유틸 (.c) - plain C +# ====================================================================== +COMMON_H = r'''/* + * @ID@.h - @KMOD@ 공통 유틸 선언 (@ID@.c 구현) + */ +#ifndef @IDU@_H +#define @IDU@_H + +long @ID@_fee(long amount, int rate_bp); +long @ID@_round_unit(long amount, long unit); +int @ID@_classify(long amount); + +#endif /* @IDU@_H */ +''' + +COMMON_TPL = r'''/* @tier @TIER@ @module @mod@ @transform @XFORM@-util */ +/* + * @ID@.c - @KMOD@ 공통 유틸리티 (plain C) [tier=@TIER@] + */ +#include "@ID@.h" + +#include + +/* 수수료 계산: rate_bp 는 basis point(1bp=0.01%) */ +long @ID@_fee(long amount, int rate_bp) +{ + long fee; + if (amount <= 0 || rate_bp < 0) + return 0; + fee = (amount * (long)rate_bp) / 10000L; + if (fee < 0) + fee = 0; + return fee; +} + +/* 절사(내림) 단위 정규화 */ +long @ID@_round_unit(long amount, long unit) +{ + if (unit <= 0) + return amount; + return (amount / unit) * unit; +} + +/* 금액 구간 분류: 0=소액 1=일반 2=고액 */ +int @ID@_classify(long amount) +{ + if (amount < 10000L) + return 0; + if (amount < 1000000L) + return 1; + return 2; +} +''' + +# ====================================================================== +# 독립 헤더 (전문 struct / 상수 / 레코드) - 4종 로테이션 +# ====================================================================== +HDR_REC = r'''/* + * @ID@.h - @KMOD@ 레코드/뷰 구조 정의 + */ +#ifndef @IDU@_H +#define @IDU@_H + +/* @KMOD@ 처리 뷰 레코드 */ +typedef struct { + char key[16]; + char merch_id[16]; + long amount; + long fee; + char biz_date[9]; + char status[2]; + char reserved[16]; +} @ID@_view_t; + +#define @IDU@_STATUS_OPEN "O" +#define @IDU@_STATUS_HOLD "H" +#define @IDU@_STATUS_CLOSE "C" + +#endif /* @IDU@_H */ +''' + +HDR_MSG = r'''/* + * @ID@.h - @KMOD@ 고정길이 전문 레이아웃 (positional, 재배치 금지) + */ +#ifndef @IDU@_H +#define @IDU@_H + +typedef struct { + char msg_type[4]; /* 전문구분 4 */ + char merch_id[15]; /* 가맹점번호 15 */ + char key[9]; /* 처리키 9 */ + char amount[12]; /* 금액 12 zero-pad */ + char biz_date[8]; /* 영업일 8 */ + char resp_code[4]; /* 응답코드 4 */ + char filler[20]; /* 예비 20 */ +} @ID@_msg_t; + +#define @IDU@_MSG_LEN ((int)sizeof(@ID@_msg_t)) + +#endif /* @IDU@_H */ +''' + +HDR_CONST = r'''/* + * @ID@.h - @KMOD@ 코드/상수 테이블 + */ +#ifndef @IDU@_H +#define @IDU@_H + +#define @IDU@_RC_OK 0 +#define @IDU@_RC_RETRY 1 +#define @IDU@_RC_SKIP 2 +#define @IDU@_RC_ERROR 9 + +#define @IDU@_LIMIT_DAILY 100000000L +#define @IDU@_LIMIT_SINGLE 50000000L +#define @IDU@_FEE_RATE_BP 250 /* 2.50% */ + +#define @IDU@_CHAN_ONLINE "01" +#define @IDU@_CHAN_BATCH "02" +#define @IDU@_CHAN_RECON "03" + +#endif /* @IDU@_H */ +''' + +HDR_DECL = r'''/* + * @ID@.h - @KMOD@ 내부 헬퍼 선언 + */ +#ifndef @IDU@_H +#define @IDU@_H + +#include "txcore.h" + +int @ID@_check(const char *key, long amount); +int @ID@_apply(TXBUF *in, TXBUF *out); +long @ID@_eval(long amount, int factor); + +#endif /* @IDU@_H */ +''' + +HDR_ROTATION = [HDR_REC, HDR_MSG, HDR_CONST, HDR_DECL] + +# ====================================================================== +# 데모 서버 main (온라인 데모 링크용, 생성 산출물 검증) +# ====================================================================== +DEMO_MAIN_TPL = r'''/* + * demo_@mod@_main.c - @KMOD@ 온라인 데모 부트스트랩 (링크 검증) + * + * 생성된 플래그십 서비스(@SVC@)를 TxCore 레지스트리에 등록하여 + * 등록/디스패치/DBIO 링크 경로가 실제로 연결됨을 증명한다. + */ +#include + +#include "txcore.h" + +void @SVC@(TXSVCINFO *ctx); + +int main(void) +{ + tx_set_loglevel(TX_LOG_INFO); + tx_log(TX_LOG_INFO, "@KMOD@ 온라인 데모 기동 (TxCore)"); + + tx_register("@SVC@", @SVC@); + + tx_log(TX_LOG_INFO, "등록 서비스 수 = %d", tx_service_count()); + printf("demo_@mod@_server 준비완료: 서비스 %d개 등록\n", + tx_service_count()); + return 0; +} +''' + +# ====================================================================== +# 비컴파일 아티팩트 템플릿 +# ====================================================================== +FML_TPL = '''# +# @ID@.fml - @KMOD@ FML 필드 테이블 (UBF 필드 정의) +# *base 1@BASE@0 +# +# name rel-number type flags comments +@ID@_KEY 1 string - 처리키 +@ID@_MERCHID 2 string - 가맹점번호 +@ID@_CARDNO 3 string - 카드번호(마스킹) +@ID@_AMOUNT 4 long - 거래금액 +@ID@_BIZDATE 5 string - 영업일 +@ID@_STATUS 6 char - 상태코드 +@ID@_FEE 7 long - 수수료 +@ID@_RESPCODE 8 string - 응답코드 +''' + +SH_TPL = '''#!/bin/sh +# @ID@.sh - @KMOD@ 실행 러너 (@TIER@) +# 사용법: @ID@.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/@ID@_${BIZDATE}.log" + +echo "[@ID@] @KMOD@ 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/@RUNBIN@" ]; then + "${BIN}/@RUNBIN@" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[@ID@] 실행 파일 없음: ${BIN}/@RUNBIN@" >&2 + RC=0 +fi +echo "[@ID@] 종료 rc=${RC}" +exit ${RC} +''' + +MK_TPL = '''# @ID@.mk - @KMOD@ 빌드 조각 (참고용 include 단편) +# 이 조각은 상위 Makefile 이 아카이브/배포 시 참조하는 메타데이터다. +@IDU@_MODULE := @mod@ +@IDU@_TIER := @TIER@ +@IDU@_SRC := app/@SUBDIR@/@REF@ +@IDU@_DESC := @KMOD@ @XFORM@ 처리 단위 + +.PHONY: @ID@-info +@ID@-info: + @echo "@ID@ module=@mod@ tier=@TIER@ transform=@XFORM@" +''' + +UBB_TPL = '''# +# @ID@.ubb - @KMOD@ TP 도메인 구성 (Tuxedo UBBCONFIG 형식, 참고) +# +*RESOURCES + IPCKEY @IPCKEY@ + MASTER SITE1 + MODEL SHM + LDBAL Y + +*MACHINES + "acqhost" LMID=SITE1 + APPDIR="/app/acquire-core" + TUXCONFIG="/app/acquire-core/tuxconfig" + +*GROUPS + GRP_@MOD@ LMID=SITE1 GRPNO=@GRPNO@ + +*SERVERS + @MOD@_SVR SRVGRP=GRP_@MOD@ SRVID=@GRPNO@ CLOPT="-A" + +*SERVICES + @MOD@_SVC LOAD=50 PRIO=50 +''' + +CFG_TPL = '''# @ID@.cfg - @KMOD@ 런타임 설정 (@TIER@) +[general] +module = @mod@ +transform = @XFORM@ +tier = @TIER@ + +[db] +dsn = acquire@localhost +schema = public +fetch_size = 1000 + +[limits] +daily_cap = 100000000 +single_cap = 50000000 +fee_rate_bp = 250 +''' + +DAT_TPL = '''# @ID@.dat - @KMOD@ 코드 매핑 데이터 (파이프 구분) +# code|label|value +01|@KMOD@ 접수|R +02|@KMOD@ 완료|M +03|@KMOD@ 불일치|U +04|@KMOD@ 정산|S +''' + +SQL_TPL = '''-- @ID@.sql - @KMOD@ DBIO 스키마/뷰 정의 (@TIER@) +-- 런타임 PostgreSQL 에 적용. 컴파일에는 불필요. + +CREATE TABLE IF NOT EXISTS @mod@_ledger ( + key VARCHAR(15) NOT NULL, + merch_id VARCHAR(15) NOT NULL, + card_no VARCHAR(19) NOT NULL, + amount BIGINT NOT NULL DEFAULT 0, + biz_date CHAR(8) NOT NULL, + status CHAR(1) NOT NULL DEFAULT 'R', + fee BIGINT NOT NULL DEFAULT 0, + reg_ts TIMESTAMP NOT NULL DEFAULT now(), + upd_ts TIMESTAMP, + CONSTRAINT pk_@mod@_ledger PRIMARY KEY (key) +); + +CREATE INDEX IF NOT EXISTS ix_@ID@_date_status + ON @mod@_ledger (biz_date, status); + +CREATE OR REPLACE VIEW @ID@_daily_v AS + SELECT biz_date, status, count(*) AS cnt, sum(amount) AS total + FROM @mod@_ledger + GROUP BY biz_date, status; +''' + +SCHEMA_SQL = '''-- schema.sql - acquire-core-full 공통 스키마 루트 +-- 모듈별 원장 테이블은 db/_*.sql 참조. + +CREATE TABLE IF NOT EXISTS merchant ( + merch_id VARCHAR(15) NOT NULL, + merch_name VARCHAR(60) NOT NULL, + biz_no VARCHAR(12), + status CHAR(1) NOT NULL DEFAULT 'A', + CONSTRAINT pk_merchant PRIMARY KEY (merch_id) +); + +CREATE TABLE IF NOT EXISTS approval ( + appr_no VARCHAR(9) NOT NULL, + merch_id VARCHAR(15) NOT NULL, + amount BIGINT NOT NULL, + appr_date CHAR(8) NOT NULL, + status CHAR(1) NOT NULL DEFAULT 'A', + CONSTRAINT pk_approval PRIMARY KEY (appr_no) +); +''' + + +# ====================================================================== +# 생성 로직 +# ====================================================================== +def main(): + ap = argparse.ArgumentParser() + ap.add_argument("--fraction", type=float, default=1.0, + help="목표 건수 대비 생성 비율 (테스트용)") + args = ap.parse_args() + frac = args.fraction + + def scaled(name, floor): + return max(floor, int(round(TARGETS[name] * frac))) + + n_online = scaled("online", 11) + n_batch = scaled("batch", 11) + n_common = scaled("common", 11) + n_dbio = scaled("dbio", 22) # 11 main + extras + n_dbsql = scaled("dbio_sql", 11) + n_fml = scaled("fml", 11) + n_sh = scaled("sh", 11) + n_mk = scaled("mk", 11) + n_config = scaled("config", 11) + + n_mods = len(MOD_CODES) + n_dbio_extra = max(0, n_dbio - n_mods) # main 은 모듈당 1개 + + # 헤더: core(11) + io헤더(extra dbio 수) + cu헤더(common 수) + standalone + n_hdr_target = scaled("headers", n_mods + 4) + n_standalone = max(0, n_hdr_target - n_mods - n_dbio_extra - n_common) + + # ---- 디렉토리 초기화 ------------------------------------------------- + for sub in ["framework", "app", "fml", "scripts", "mk", "config", "db", + "build", "bin"]: + p = os.path.join(ROOT, sub) + if os.path.isdir(p): + shutil.rmtree(p) + for f in ["Makefile", "inventory.json"]: + p = os.path.join(ROOT, f) + if os.path.isfile(p): + os.remove(p) + + def wr(relpath, content): + p = os.path.join(ROOT, relpath) + os.makedirs(os.path.dirname(p), exist_ok=True) + with open(p, "w", encoding="utf-8") as fh: + fh.write(content) + + inventory = [] + counts = {} + + def bump(k, n=1): + counts[k] = counts.get(k, 0) + n + + def loc_of(s): + return s.count("\n") + (0 if s.endswith("\n") else 1) + + def sqlcount(s): + return s.count("EXEC SQL") + + def add_inv(pid, module, archetype, tier, path, content): + inventory.append({ + "id": pid, + "module": module, + "archetype": archetype, + "tier": tier, + "path": path, + "loc": loc_of(content), + "sqlCount": sqlcount(content), + }) + + # ---- 프레임워크 (공유) ---------------------------------------------- + wr("framework/txcore/include/txcore.h", TXCORE_H) + wr("framework/txcore/dbio/txcore_dbio.h", TXCORE_DBIO_H) + wr("framework/txcore/src/txcore.c", TXCORE_C) + wr("app/shared/include/msg_layout.h", MSG_LAYOUT_H) + wr("app/shared/include/acq_util.h", ACQ_UTIL_H) + wr("app/shared/common/util_date.c", UTIL_DATE_C) + wr("app/shared/common/util_amount.c", UTIL_AMOUNT_C) + wr("app/shared/common/util_msg.c", UTIL_MSG_C) + bump("framework", 3) + bump("shared_hdr", 2) + bump("shared_c", 3) + + # ---- 모듈 core 헤더 + dbio_main ------------------------------------- + first_online = {} # mod -> flagship online id + first_batch = {} # mod -> flagship batch id + + for mod, kname, xform in MODULES: + core = render(CORE_H_TPL, mod=mod, MOD=mod.upper(), + KMOD=kname, XFORM=xform) + wr("app/include/%s_core.h" % mod, core) + bump("headers") + + dm = render(DBIO_MAIN_TPL, mod=mod, MOD=mod.upper(), + KMOD=kname, XFORM=xform) + pid = "%s_dbio_main" % mod + path = "app/dbio/%s.pgc" % pid + wr(path, dm) + add_inv(pid, mod, "dbio", "medium", path, dm) + bump("dbio") + + # ---- 온라인 서비스 --------------------------------------------------- + seq = {m: 0 for m in MOD_CODES} + for i in range(n_online): + mod = MOD_CODES[i % n_mods] + seq[mod] += 1 + pid = "%s_ol_%04d" % (mod, seq[mod]) + svc = pid.upper() + tier = tier_for(i) + kname = MOD_KNAME[mod] + xform = MOD_XFORM[mod] + if mod not in first_online: + first_online[mod] = (pid, svc) + body = {"easy": ONLINE_EASY, "medium": ONLINE_MEDIUM, + "hard": ONLINE_HARD}[tier] + content = render(ONLINE_HEAD + body, mod=mod, MOD=mod.upper(), + ID=pid, SVC=svc, TIER=tier, KMOD=kname, XFORM=xform, + NEXTSVC="%s_POST" % mod.upper()) + path = "app/online/%s.pgc" % pid + wr(path, content) + add_inv(pid, mod, "online", tier, path, content) + bump("online") + + # ---- 배치 ------------------------------------------------------------ + bseq = {m: 0 for m in MOD_CODES} + for i in range(n_batch): + mod = MOD_CODES[i % n_mods] + bseq[mod] += 1 + pid = "%s_bt_%04d" % (mod, bseq[mod]) + tier = tier_for(i) + kname = MOD_KNAME[mod] + xform = MOD_XFORM[mod] + if mod not in first_batch: + first_batch[mod] = pid + content = render(BATCH_TPL, mod=mod, MOD=mod.upper(), ID=pid, + TIER=tier, KMOD=kname, XFORM=xform) + path = "app/batch/%s.pgc" % pid + wr(path, content) + add_inv(pid, mod, "batch", tier, path, content) + bump("batch") + + # ---- 추가 DBIO ------------------------------------------------------- + ioseq = {m: 0 for m in MOD_CODES} + for i in range(n_dbio_extra): + mod = MOD_CODES[i % n_mods] + ioseq[mod] += 1 + pid = "%s_io_%04d" % (mod, ioseq[mod]) + tier = tier_for(i) + kname = MOD_KNAME[mod] + xform = MOD_XFORM[mod] + hdr = render(DBIO_EXTRA_H, ID=pid, IDU=pid.upper(), KMOD=kname) + wr("app/include/%s.h" % pid, hdr) + bump("headers") + content = render(DBIO_EXTRA_TPL, mod=mod, ID=pid, TIER=tier, + KMOD=kname, XFORM=xform) + path = "app/dbio/%s.pgc" % pid + wr(path, content) + add_inv(pid, mod, "dbio", tier, path, content) + bump("dbio") + + # ---- 공통 유틸 ------------------------------------------------------- + cseq = {m: 0 for m in MOD_CODES} + for i in range(n_common): + mod = MOD_CODES[i % n_mods] + cseq[mod] += 1 + pid = "%s_cu_%04d" % (mod, cseq[mod]) + tier = tier_for(i) + kname = MOD_KNAME[mod] + xform = MOD_XFORM[mod] + hdr = render(COMMON_H, ID=pid, IDU=pid.upper(), KMOD=kname) + wr("app/include/%s.h" % pid, hdr) + bump("headers") + content = render(COMMON_TPL, mod=mod, ID=pid, TIER=tier, + KMOD=kname, XFORM=xform) + path = "app/common/%s.c" % pid + wr(path, content) + add_inv(pid, mod, "common", tier, path, content) + bump("common") + + # ---- 독립 헤더 ------------------------------------------------------- + hseq = {m: 0 for m in MOD_CODES} + for i in range(n_standalone): + mod = MOD_CODES[i % n_mods] + hseq[mod] += 1 + pid = "%s_h_%04d" % (mod, hseq[mod]) + kname = MOD_KNAME[mod] + tpl = HDR_ROTATION[i % len(HDR_ROTATION)] + content = render(tpl, ID=pid, IDU=pid.upper(), KMOD=kname) + wr("app/include/%s.h" % pid, content) + bump("headers") + + # ---- 데모 서버 main (온라인 데모) ----------------------------------- + for mod in ONLINE_DEMOS: + if mod not in first_online: + continue + _pid, svc = first_online[mod] + content = render(DEMO_MAIN_TPL, mod=mod, SVC=svc, KMOD=MOD_KNAME[mod]) + wr("app/common/demo_%s_main.c" % mod, content) + bump("demo_main") + + # ---- FML ------------------------------------------------------------- + for i in range(n_fml): + mod = MOD_CODES[i % n_mods] + pid = "%s_fml_%04d" % (mod, i // n_mods + 1) + content = render(FML_TPL, ID=pid.upper(), KMOD=MOD_KNAME[mod], + BASE=(i % 9) + 1) + wr("fml/%s.fml" % pid, content) + bump("fml") + + # ---- 셸 러너 --------------------------------------------------------- + for i in range(n_sh): + mod = MOD_CODES[i % n_mods] + pid = "%s_run_%04d" % (mod, i // n_mods + 1) + tier = tier_for(i) + runbin = "demo_%s_batch" % mod if mod in BATCH_DEMOS else \ + first_batch.get(mod, "%s_bt_0001" % mod) + content = render(SH_TPL, ID=pid, TIER=tier, KMOD=MOD_KNAME[mod], + RUNBIN=runbin) + wr("scripts/%s.sh" % pid, content) + os.chmod(os.path.join(ROOT, "scripts/%s.sh" % pid), 0o755) + bump("sh") + + # ---- Makefile 조각 --------------------------------------------------- + for i in range(n_mk): + mod = MOD_CODES[i % n_mods] + pid = "%s_frag_%04d" % (mod, i // n_mods + 1) + tier = tier_for(i) + content = render(MK_TPL, ID=pid, IDU=pid.upper(), mod=mod, TIER=tier, + KMOD=MOD_KNAME[mod], XFORM=MOD_XFORM[mod], + SUBDIR="online", REF="%s_ol_0001.pgc" % mod) + wr("mk/%s.mk" % pid, content) + bump("mk") + + # ---- 설정 (.ubb/.cfg/.dat) ------------------------------------------ + cfg_exts = ["ubb", "cfg", "dat"] + for i in range(n_config): + mod = MOD_CODES[i % n_mods] + ext = cfg_exts[i % 3] + pid = "%s_cfg_%04d" % (mod, i // n_mods + 1) + if ext == "ubb": + content = render(UBB_TPL, ID=pid, MOD=mod.upper(), + KMOD=MOD_KNAME[mod], + IPCKEY=str(70000 + i), GRPNO=str((i % 30) + 1)) + elif ext == "cfg": + content = render(CFG_TPL, ID=pid, mod=mod, + XFORM=MOD_XFORM[mod], TIER=tier_for(i)) + else: + content = render(DAT_TPL, ID=pid, KMOD=MOD_KNAME[mod]) + wr("config/%s.%s" % (pid, ext), content) + bump("config") + + # ---- DBIO SQL 스키마 ------------------------------------------------- + wr("db/schema.sql", SCHEMA_SQL) + for i in range(n_dbsql): + mod = MOD_CODES[i % n_mods] + pid = "%s_ddl_%04d" % (mod, i // n_mods + 1) + content = render(SQL_TPL, ID=pid, mod=mod, KMOD=MOD_KNAME[mod], + TIER=tier_for(i)) + wr("db/%s.sql" % pid, content) + bump("dbio_sql") + + # ---- Makefile -------------------------------------------------------- + wr("Makefile", build_makefile(first_online, first_batch)) + + # ---- inventory.json -------------------------------------------------- + tier_hist = {} + arche_hist = {} + for r in inventory: + tier_hist[r["tier"]] = tier_hist.get(r["tier"], 0) + 1 + arche_hist[r["archetype"]] = arche_hist.get(r["archetype"], 0) + 1 + + inv_doc = { + "corpus": "acquire-core-full", + "domain": "card acquiring / settlement (카드 매입·정산)", + "framework": "TxCore (ECPG + 고정길이 전문 + TP 관용구)", + "generatedBy": "generate.py", + "fraction": frac, + "fileCounts": counts, + "programCount": len(inventory), + "byTier": tier_hist, + "byArchetype": arche_hist, + "modules": {m[0]: m[1] for m in MODULES}, + "programs": sorted(inventory, key=lambda r: r["path"]), + } + with open(os.path.join(ROOT, "inventory.json"), "w", encoding="utf-8") as fh: + json.dump(inv_doc, fh, ensure_ascii=False, indent=2) + + # ---- 요약 출력 ------------------------------------------------------- + total_files = 0 + for _root, _dirs, files in os.walk(ROOT): + if "/.git" in _root: + continue + for f in files: + total_files += 1 + print("=== acquire-core-full 생성 완료 (fraction=%.3f) ===" % frac) + for k in sorted(counts): + print(" %-12s %5d" % (k, counts[k])) + print(" programs(inv) %5d" % len(inventory)) + print(" tier ", tier_hist) + print(" 총 파일수 ", total_files) + + +def build_makefile(first_online, first_batch): + lines = [] + A = lines.append + A("# ==========================================================================") + A("# acquire-core-full / TxCore Makefile (생성기 산출물)") + A("#") + A("# .pgc --ecpg--> .c --gcc--> build/*.o --ar--> libtxcore.a --ld--> bin/*") + A("#") + A("# ~1000개 .c/.pgc 를 build/*.o 로 컴파일하는 것이 빌드 검증의 핵심.") + A("# 와일드카드로 전체 소스를 수집하고, 대표 데모 바이너리 몇 개를 링크한다.") + A("# ==========================================================================") + A("CC := gcc") + A("ECPG := ecpg") + A("AR := ar") + A("PG_INCDIR := $(shell pg_config --includedir 2>/dev/null)") + A("") + A("INCLUDES := -Iframework/txcore/include \\") + A(" -Iframework/txcore/dbio \\") + A(" -Iapp/include \\") + A(" -Iapp/shared/include \\") + A(" -I$(PG_INCDIR)") + A("") + A("# 고정길이 관용구 경고만 억제 (-Werror 없음)") + A("CFLAGS := -g -O2 -Wall -Wextra -Wno-unused-parameter \\") + A(" -Wno-stringop-truncation -Wno-format-truncation \\") + A(" -Wno-unused-variable -Wno-unused-but-set-variable $(INCLUDES)") + A("ECPGFLAGS := -Iframework/txcore/include -Iframework/txcore/dbio \\") + A(" -Iapp/include -Iapp/shared/include") + A("LDLIBS := -lecpg -lpq") + A("") + A("BUILD := build") + A("BIN := bin") + A("") + A("# ---- 소스 수집 (와일드카드) ----------------------------------------------") + A("ONLINE_PGC := $(wildcard app/online/*.pgc)") + A("BATCH_PGC := $(wildcard app/batch/*.pgc)") + A("DBIO_PGC := $(wildcard app/dbio/*.pgc)") + A("COMMON_C := $(wildcard app/common/*.c)") + A("SHARED_C := $(wildcard app/shared/common/*.c)") + A("") + A("PGC_ALL := $(ONLINE_PGC) $(BATCH_PGC) $(DBIO_PGC)") + A("GEN_C := $(PGC_ALL:.pgc=.c)") + A("") + A("PGC_OBJ := $(patsubst %,$(BUILD)/%.o,$(basename $(notdir $(PGC_ALL))))") + A("COMMON_OBJ := $(patsubst %,$(BUILD)/%.o,$(basename $(notdir $(COMMON_C))))") + A("SHARED_OBJ := $(patsubst %,$(BUILD)/%.o,$(basename $(notdir $(SHARED_C))))") + A("ALL_OBJ := $(PGC_OBJ) $(COMMON_OBJ) $(SHARED_OBJ)") + A("") + A("LIBTXCORE := $(BUILD)/libtxcore.a") + A("") + # 데모 바이너리 목록 + demo_bins = [] + for mod in ONLINE_DEMOS: + if mod in first_online: + demo_bins.append("$(BIN)/demo_%s_server" % mod) + for mod in BATCH_DEMOS: + if mod in first_batch: + demo_bins.append("$(BIN)/demo_%s_batch" % mod) + A("DEMO_BINS := " + " ".join(demo_bins)) + A("") + A(".SECONDARY:") + A(".PHONY: all clean dirs gen objs demos") + A("") + A("all: dirs $(LIBTXCORE) objs demos") + A("\t@echo \"==> 빌드 완료\"") + A("\t@echo \"오브젝트: $(words $(ALL_OBJ)) 개\"") + A("") + A("dirs:") + A("\t@mkdir -p $(BUILD) $(BIN)") + A("") + A("gen: $(GEN_C)") + A("objs: $(ALL_OBJ)") + A("demos: $(DEMO_BINS)") + A("") + A("# ---- ecpg: .pgc -> .c (디렉토리별) ---------------------------------------") + A("app/online/%.c: app/online/%.pgc") + A("\t$(ECPG) $(ECPGFLAGS) -o $@ $<") + A("app/batch/%.c: app/batch/%.pgc") + A("\t$(ECPG) $(ECPGFLAGS) -o $@ $<") + A("app/dbio/%.c: app/dbio/%.pgc") + A("\t$(ECPG) $(ECPGFLAGS) -o $@ $<") + A("") + A("# ---- 컴파일: build/.o (gen 선행 보장) --------------------------") + A("$(BUILD)/%.o: app/online/%.c | gen") + A("\t$(CC) $(CFLAGS) -c $< -o $@") + A("$(BUILD)/%.o: app/batch/%.c | gen") + A("\t$(CC) $(CFLAGS) -c $< -o $@") + A("$(BUILD)/%.o: app/dbio/%.c | gen") + A("\t$(CC) $(CFLAGS) -c $< -o $@") + A("$(BUILD)/%.o: app/common/%.c") + A("\t$(CC) $(CFLAGS) -c $< -o $@") + A("$(BUILD)/%.o: app/shared/common/%.c") + A("\t$(CC) $(CFLAGS) -c $< -o $@") + A("") + A("# ---- TxCore 정적 라이브러리 ----------------------------------------------") + A("$(BUILD)/txcore.o: framework/txcore/src/txcore.c") + A("\t$(CC) $(CFLAGS) -c $< -o $@") + A("$(LIBTXCORE): $(BUILD)/txcore.o") + A("\t$(AR) rcs $@ $^") + A("") + A("# ---- 대표 데모 바이너리 (링크 검증) --------------------------------------") + for mod in ONLINE_DEMOS: + if mod not in first_online: + continue + flag_id, _svc = first_online[mod] + objs = "$(BUILD)/demo_%s_main.o $(BUILD)/%s.o $(BUILD)/%s_dbio_main.o $(SHARED_OBJ)" % ( + mod, flag_id, mod) + A("$(BIN)/demo_%s_server: %s $(LIBTXCORE)" % (mod, objs)) + A("\t$(CC) $(CFLAGS) -o $@ %s -L$(BUILD) -ltxcore $(LDLIBS)" % objs) + A("") + for mod in BATCH_DEMOS: + if mod not in first_batch: + continue + bid = first_batch[mod] + objs = "$(BUILD)/%s.o $(BUILD)/%s_dbio_main.o $(SHARED_OBJ)" % (bid, mod) + A("$(BIN)/demo_%s_batch: %s $(LIBTXCORE)" % (mod, objs)) + A("\t$(CC) $(CFLAGS) -o $@ %s -L$(BUILD) -ltxcore $(LDLIBS)" % objs) + A("") + A("# ==========================================================================") + A("clean:") + A("\trm -rf $(BUILD) $(BIN)") + A("\trm -f $(GEN_C)") + A("") + return "\n".join(lines) + "\n" + + +if __name__ == "__main__": + main() diff --git a/inventory.json b/inventory.json new file mode 100644 index 0000000..9650aa8 --- /dev/null +++ b/inventory.json @@ -0,0 +1,8600 @@ +{ + "corpus": "acquire-core-full", + "domain": "card acquiring / settlement (카드 매입·정산)", + "framework": "TxCore (ECPG + 고정길이 전문 + TP 관용구)", + "generatedBy": "generate.py", + "fraction": 1.0, + "fileCounts": { + "framework": 3, + "shared_hdr": 2, + "shared_c": 3, + "headers": 600, + "dbio": 300, + "online": 350, + "batch": 180, + "common": 120, + "demo_main": 4, + "fml": 120, + "sh": 180, + "mk": 90, + "config": 60, + "dbio_sql": 50 + }, + "programCount": 950, + "byTier": { + "medium": 287, + "easy": 525, + "hard": 138 + }, + "byArchetype": { + "dbio": 300, + "online": 350, + "batch": 180, + "common": 120 + }, + "modules": { + "mg": "전문게이트웨이", + "au": "승인한도", + "ac": "매입", + "rc": "대사", + "vl": "정합성", + "st": "정산수수료", + "py": "지급", + "lg": "원장", + "mm": "마스터", + "cm": "공통", + "cl": "마감" + }, + "programs": [ + { + "id": "ac_bt_0001", + "module": "ac", + "archetype": "batch", + "tier": "easy", + "path": "app/batch/ac_bt_0001.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "ac_bt_0002", + "module": "ac", + "archetype": "batch", + "tier": "medium", + "path": "app/batch/ac_bt_0002.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "ac_bt_0003", + "module": "ac", + "archetype": "batch", + "tier": "easy", + "path": "app/batch/ac_bt_0003.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "ac_bt_0004", + "module": "ac", + "archetype": "batch", + "tier": "medium", + "path": "app/batch/ac_bt_0004.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "ac_bt_0005", + "module": "ac", + "archetype": "batch", + "tier": "easy", + "path": "app/batch/ac_bt_0005.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "ac_bt_0006", + "module": "ac", + "archetype": "batch", + "tier": "hard", + "path": "app/batch/ac_bt_0006.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "ac_bt_0007", + "module": "ac", + "archetype": "batch", + "tier": "easy", + "path": "app/batch/ac_bt_0007.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "ac_bt_0008", + "module": "ac", + "archetype": "batch", + "tier": "hard", + "path": "app/batch/ac_bt_0008.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "ac_bt_0009", + "module": "ac", + "archetype": "batch", + "tier": "easy", + "path": "app/batch/ac_bt_0009.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "ac_bt_0010", + "module": "ac", + "archetype": "batch", + "tier": "easy", + "path": "app/batch/ac_bt_0010.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "ac_bt_0011", + "module": "ac", + "archetype": "batch", + "tier": "medium", + "path": "app/batch/ac_bt_0011.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "ac_bt_0012", + "module": "ac", + "archetype": "batch", + "tier": "easy", + "path": "app/batch/ac_bt_0012.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "ac_bt_0013", + "module": "ac", + "archetype": "batch", + "tier": "medium", + "path": "app/batch/ac_bt_0013.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "ac_bt_0014", + "module": "ac", + "archetype": "batch", + "tier": "easy", + "path": "app/batch/ac_bt_0014.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "ac_bt_0015", + "module": "ac", + "archetype": "batch", + "tier": "medium", + "path": "app/batch/ac_bt_0015.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "ac_bt_0016", + "module": "ac", + "archetype": "batch", + "tier": "easy", + "path": "app/batch/ac_bt_0016.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "ac_bt_0017", + "module": "ac", + "archetype": "batch", + "tier": "hard", + "path": "app/batch/ac_bt_0017.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "au_bt_0001", + "module": "au", + "archetype": "batch", + "tier": "easy", + "path": "app/batch/au_bt_0001.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "au_bt_0002", + "module": "au", + "archetype": "batch", + "tier": "medium", + "path": "app/batch/au_bt_0002.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "au_bt_0003", + "module": "au", + "archetype": "batch", + "tier": "easy", + "path": "app/batch/au_bt_0003.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "au_bt_0004", + "module": "au", + "archetype": "batch", + "tier": "medium", + "path": "app/batch/au_bt_0004.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "au_bt_0005", + "module": "au", + "archetype": "batch", + "tier": "easy", + "path": "app/batch/au_bt_0005.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "au_bt_0006", + "module": "au", + "archetype": "batch", + "tier": "medium", + "path": "app/batch/au_bt_0006.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "au_bt_0007", + "module": "au", + "archetype": "batch", + "tier": "easy", + "path": "app/batch/au_bt_0007.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "au_bt_0008", + "module": "au", + "archetype": "batch", + "tier": "hard", + "path": "app/batch/au_bt_0008.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "au_bt_0009", + "module": "au", + "archetype": "batch", + "tier": "easy", + "path": "app/batch/au_bt_0009.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "au_bt_0010", + "module": "au", + "archetype": "batch", + "tier": "easy", + "path": "app/batch/au_bt_0010.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "au_bt_0011", + "module": "au", + "archetype": "batch", + "tier": "medium", + "path": "app/batch/au_bt_0011.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "au_bt_0012", + "module": "au", + "archetype": "batch", + "tier": "easy", + "path": "app/batch/au_bt_0012.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "au_bt_0013", + "module": "au", + "archetype": "batch", + "tier": "medium", + "path": "app/batch/au_bt_0013.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "au_bt_0014", + "module": "au", + "archetype": "batch", + "tier": "easy", + "path": "app/batch/au_bt_0014.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "au_bt_0015", + "module": "au", + "archetype": "batch", + "tier": "medium", + "path": "app/batch/au_bt_0015.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "au_bt_0016", + "module": "au", + "archetype": "batch", + "tier": "easy", + "path": "app/batch/au_bt_0016.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "au_bt_0017", + "module": "au", + "archetype": "batch", + "tier": "hard", + "path": "app/batch/au_bt_0017.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "cl_bt_0001", + "module": "cl", + "archetype": "batch", + "tier": "easy", + "path": "app/batch/cl_bt_0001.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "cl_bt_0002", + "module": "cl", + "archetype": "batch", + "tier": "easy", + "path": "app/batch/cl_bt_0002.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "cl_bt_0003", + "module": "cl", + "archetype": "batch", + "tier": "medium", + "path": "app/batch/cl_bt_0003.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "cl_bt_0004", + "module": "cl", + "archetype": "batch", + "tier": "easy", + "path": "app/batch/cl_bt_0004.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "cl_bt_0005", + "module": "cl", + "archetype": "batch", + "tier": "medium", + "path": "app/batch/cl_bt_0005.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "cl_bt_0006", + "module": "cl", + "archetype": "batch", + "tier": "easy", + "path": "app/batch/cl_bt_0006.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "cl_bt_0007", + "module": "cl", + "archetype": "batch", + "tier": "medium", + "path": "app/batch/cl_bt_0007.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "cl_bt_0008", + "module": "cl", + "archetype": "batch", + "tier": "easy", + "path": "app/batch/cl_bt_0008.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "cl_bt_0009", + "module": "cl", + "archetype": "batch", + "tier": "hard", + "path": "app/batch/cl_bt_0009.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "cl_bt_0010", + "module": "cl", + "archetype": "batch", + "tier": "easy", + "path": "app/batch/cl_bt_0010.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "cl_bt_0011", + "module": "cl", + "archetype": "batch", + "tier": "easy", + "path": "app/batch/cl_bt_0011.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "cl_bt_0012", + "module": "cl", + "archetype": "batch", + "tier": "medium", + "path": "app/batch/cl_bt_0012.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "cl_bt_0013", + "module": "cl", + "archetype": "batch", + "tier": "easy", + "path": "app/batch/cl_bt_0013.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "cl_bt_0014", + "module": "cl", + "archetype": "batch", + "tier": "medium", + "path": "app/batch/cl_bt_0014.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "cl_bt_0015", + "module": "cl", + "archetype": "batch", + "tier": "easy", + "path": "app/batch/cl_bt_0015.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "cl_bt_0016", + "module": "cl", + "archetype": "batch", + "tier": "medium", + "path": "app/batch/cl_bt_0016.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "cm_bt_0001", + "module": "cm", + "archetype": "batch", + "tier": "easy", + "path": "app/batch/cm_bt_0001.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "cm_bt_0002", + "module": "cm", + "archetype": "batch", + "tier": "easy", + "path": "app/batch/cm_bt_0002.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "cm_bt_0003", + "module": "cm", + "archetype": "batch", + "tier": "medium", + "path": "app/batch/cm_bt_0003.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "cm_bt_0004", + "module": "cm", + "archetype": "batch", + "tier": "easy", + "path": "app/batch/cm_bt_0004.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "cm_bt_0005", + "module": "cm", + "archetype": "batch", + "tier": "medium", + "path": "app/batch/cm_bt_0005.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "cm_bt_0006", + "module": "cm", + "archetype": "batch", + "tier": "easy", + "path": "app/batch/cm_bt_0006.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "cm_bt_0007", + "module": "cm", + "archetype": "batch", + "tier": "medium", + "path": "app/batch/cm_bt_0007.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "cm_bt_0008", + "module": "cm", + "archetype": "batch", + "tier": "easy", + "path": "app/batch/cm_bt_0008.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "cm_bt_0009", + "module": "cm", + "archetype": "batch", + "tier": "hard", + "path": "app/batch/cm_bt_0009.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "cm_bt_0010", + "module": "cm", + "archetype": "batch", + "tier": "easy", + "path": "app/batch/cm_bt_0010.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "cm_bt_0011", + "module": "cm", + "archetype": "batch", + "tier": "hard", + "path": "app/batch/cm_bt_0011.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "cm_bt_0012", + "module": "cm", + "archetype": "batch", + "tier": "easy", + "path": "app/batch/cm_bt_0012.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "cm_bt_0013", + "module": "cm", + "archetype": "batch", + "tier": "easy", + "path": "app/batch/cm_bt_0013.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "cm_bt_0014", + "module": "cm", + "archetype": "batch", + "tier": "medium", + "path": "app/batch/cm_bt_0014.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "cm_bt_0015", + "module": "cm", + "archetype": "batch", + "tier": "easy", + "path": "app/batch/cm_bt_0015.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "cm_bt_0016", + "module": "cm", + "archetype": "batch", + "tier": "medium", + "path": "app/batch/cm_bt_0016.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "lg_bt_0001", + "module": "lg", + "archetype": "batch", + "tier": "easy", + "path": "app/batch/lg_bt_0001.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "lg_bt_0002", + "module": "lg", + "archetype": "batch", + "tier": "hard", + "path": "app/batch/lg_bt_0002.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "lg_bt_0003", + "module": "lg", + "archetype": "batch", + "tier": "easy", + "path": "app/batch/lg_bt_0003.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "lg_bt_0004", + "module": "lg", + "archetype": "batch", + "tier": "easy", + "path": "app/batch/lg_bt_0004.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "lg_bt_0005", + "module": "lg", + "archetype": "batch", + "tier": "medium", + "path": "app/batch/lg_bt_0005.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "lg_bt_0006", + "module": "lg", + "archetype": "batch", + "tier": "easy", + "path": "app/batch/lg_bt_0006.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "lg_bt_0007", + "module": "lg", + "archetype": "batch", + "tier": "medium", + "path": "app/batch/lg_bt_0007.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "lg_bt_0008", + "module": "lg", + "archetype": "batch", + "tier": "easy", + "path": "app/batch/lg_bt_0008.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "lg_bt_0009", + "module": "lg", + "archetype": "batch", + "tier": "medium", + "path": "app/batch/lg_bt_0009.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "lg_bt_0010", + "module": "lg", + "archetype": "batch", + "tier": "easy", + "path": "app/batch/lg_bt_0010.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "lg_bt_0011", + "module": "lg", + "archetype": "batch", + "tier": "hard", + "path": "app/batch/lg_bt_0011.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "lg_bt_0012", + "module": "lg", + "archetype": "batch", + "tier": "easy", + "path": "app/batch/lg_bt_0012.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "lg_bt_0013", + "module": "lg", + "archetype": "batch", + "tier": "hard", + "path": "app/batch/lg_bt_0013.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "lg_bt_0014", + "module": "lg", + "archetype": "batch", + "tier": "easy", + "path": "app/batch/lg_bt_0014.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "lg_bt_0015", + "module": "lg", + "archetype": "batch", + "tier": "easy", + "path": "app/batch/lg_bt_0015.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "lg_bt_0016", + "module": "lg", + "archetype": "batch", + "tier": "medium", + "path": "app/batch/lg_bt_0016.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "mg_bt_0001", + "module": "mg", + "archetype": "batch", + "tier": "easy", + "path": "app/batch/mg_bt_0001.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "mg_bt_0002", + "module": "mg", + "archetype": "batch", + "tier": "medium", + "path": "app/batch/mg_bt_0002.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "mg_bt_0003", + "module": "mg", + "archetype": "batch", + "tier": "easy", + "path": "app/batch/mg_bt_0003.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "mg_bt_0004", + "module": "mg", + "archetype": "batch", + "tier": "medium", + "path": "app/batch/mg_bt_0004.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "mg_bt_0005", + "module": "mg", + "archetype": "batch", + "tier": "easy", + "path": "app/batch/mg_bt_0005.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "mg_bt_0006", + "module": "mg", + "archetype": "batch", + "tier": "medium", + "path": "app/batch/mg_bt_0006.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "mg_bt_0007", + "module": "mg", + "archetype": "batch", + "tier": "easy", + "path": "app/batch/mg_bt_0007.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "mg_bt_0008", + "module": "mg", + "archetype": "batch", + "tier": "hard", + "path": "app/batch/mg_bt_0008.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "mg_bt_0009", + "module": "mg", + "archetype": "batch", + "tier": "easy", + "path": "app/batch/mg_bt_0009.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "mg_bt_0010", + "module": "mg", + "archetype": "batch", + "tier": "hard", + "path": "app/batch/mg_bt_0010.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "mg_bt_0011", + "module": "mg", + "archetype": "batch", + "tier": "easy", + "path": "app/batch/mg_bt_0011.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "mg_bt_0012", + "module": "mg", + "archetype": "batch", + "tier": "easy", + "path": "app/batch/mg_bt_0012.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "mg_bt_0013", + "module": "mg", + "archetype": "batch", + "tier": "medium", + "path": "app/batch/mg_bt_0013.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "mg_bt_0014", + "module": "mg", + "archetype": "batch", + "tier": "easy", + "path": "app/batch/mg_bt_0014.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "mg_bt_0015", + "module": "mg", + "archetype": "batch", + "tier": "medium", + "path": "app/batch/mg_bt_0015.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "mg_bt_0016", + "module": "mg", + "archetype": "batch", + "tier": "easy", + "path": "app/batch/mg_bt_0016.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "mg_bt_0017", + "module": "mg", + "archetype": "batch", + "tier": "medium", + "path": "app/batch/mg_bt_0017.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "mm_bt_0001", + "module": "mm", + "archetype": "batch", + "tier": "easy", + "path": "app/batch/mm_bt_0001.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "mm_bt_0002", + "module": "mm", + "archetype": "batch", + "tier": "hard", + "path": "app/batch/mm_bt_0002.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "mm_bt_0003", + "module": "mm", + "archetype": "batch", + "tier": "easy", + "path": "app/batch/mm_bt_0003.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "mm_bt_0004", + "module": "mm", + "archetype": "batch", + "tier": "easy", + "path": "app/batch/mm_bt_0004.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "mm_bt_0005", + "module": "mm", + "archetype": "batch", + "tier": "medium", + "path": "app/batch/mm_bt_0005.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "mm_bt_0006", + "module": "mm", + "archetype": "batch", + "tier": "easy", + "path": "app/batch/mm_bt_0006.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "mm_bt_0007", + "module": "mm", + "archetype": "batch", + "tier": "medium", + "path": "app/batch/mm_bt_0007.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "mm_bt_0008", + "module": "mm", + "archetype": "batch", + "tier": "easy", + "path": "app/batch/mm_bt_0008.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "mm_bt_0009", + "module": "mm", + "archetype": "batch", + "tier": "medium", + "path": "app/batch/mm_bt_0009.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "mm_bt_0010", + "module": "mm", + "archetype": "batch", + "tier": "easy", + "path": "app/batch/mm_bt_0010.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "mm_bt_0011", + "module": "mm", + "archetype": "batch", + "tier": "hard", + "path": "app/batch/mm_bt_0011.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "mm_bt_0012", + "module": "mm", + "archetype": "batch", + "tier": "easy", + "path": "app/batch/mm_bt_0012.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "mm_bt_0013", + "module": "mm", + "archetype": "batch", + "tier": "easy", + "path": "app/batch/mm_bt_0013.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "mm_bt_0014", + "module": "mm", + "archetype": "batch", + "tier": "medium", + "path": "app/batch/mm_bt_0014.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "mm_bt_0015", + "module": "mm", + "archetype": "batch", + "tier": "easy", + "path": "app/batch/mm_bt_0015.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "mm_bt_0016", + "module": "mm", + "archetype": "batch", + "tier": "medium", + "path": "app/batch/mm_bt_0016.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "py_bt_0001", + "module": "py", + "archetype": "batch", + "tier": "easy", + "path": "app/batch/py_bt_0001.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "py_bt_0002", + "module": "py", + "archetype": "batch", + "tier": "hard", + "path": "app/batch/py_bt_0002.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "py_bt_0003", + "module": "py", + "archetype": "batch", + "tier": "easy", + "path": "app/batch/py_bt_0003.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "py_bt_0004", + "module": "py", + "archetype": "batch", + "tier": "hard", + "path": "app/batch/py_bt_0004.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "py_bt_0005", + "module": "py", + "archetype": "batch", + "tier": "easy", + "path": "app/batch/py_bt_0005.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "py_bt_0006", + "module": "py", + "archetype": "batch", + "tier": "easy", + "path": "app/batch/py_bt_0006.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "py_bt_0007", + "module": "py", + "archetype": "batch", + "tier": "medium", + "path": "app/batch/py_bt_0007.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "py_bt_0008", + "module": "py", + "archetype": "batch", + "tier": "easy", + "path": "app/batch/py_bt_0008.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "py_bt_0009", + "module": "py", + "archetype": "batch", + "tier": "medium", + "path": "app/batch/py_bt_0009.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "py_bt_0010", + "module": "py", + "archetype": "batch", + "tier": "easy", + "path": "app/batch/py_bt_0010.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "py_bt_0011", + "module": "py", + "archetype": "batch", + "tier": "medium", + "path": "app/batch/py_bt_0011.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "py_bt_0012", + "module": "py", + "archetype": "batch", + "tier": "easy", + "path": "app/batch/py_bt_0012.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "py_bt_0013", + "module": "py", + "archetype": "batch", + "tier": "hard", + "path": "app/batch/py_bt_0013.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "py_bt_0014", + "module": "py", + "archetype": "batch", + "tier": "easy", + "path": "app/batch/py_bt_0014.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "py_bt_0015", + "module": "py", + "archetype": "batch", + "tier": "easy", + "path": "app/batch/py_bt_0015.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "py_bt_0016", + "module": "py", + "archetype": "batch", + "tier": "medium", + "path": "app/batch/py_bt_0016.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "rc_bt_0001", + "module": "rc", + "archetype": "batch", + "tier": "easy", + "path": "app/batch/rc_bt_0001.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "rc_bt_0002", + "module": "rc", + "archetype": "batch", + "tier": "medium", + "path": "app/batch/rc_bt_0002.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "rc_bt_0003", + "module": "rc", + "archetype": "batch", + "tier": "easy", + "path": "app/batch/rc_bt_0003.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "rc_bt_0004", + "module": "rc", + "archetype": "batch", + "tier": "medium", + "path": "app/batch/rc_bt_0004.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "rc_bt_0005", + "module": "rc", + "archetype": "batch", + "tier": "easy", + "path": "app/batch/rc_bt_0005.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "rc_bt_0006", + "module": "rc", + "archetype": "batch", + "tier": "hard", + "path": "app/batch/rc_bt_0006.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "rc_bt_0007", + "module": "rc", + "archetype": "batch", + "tier": "easy", + "path": "app/batch/rc_bt_0007.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "rc_bt_0008", + "module": "rc", + "archetype": "batch", + "tier": "easy", + "path": "app/batch/rc_bt_0008.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "rc_bt_0009", + "module": "rc", + "archetype": "batch", + "tier": "medium", + "path": "app/batch/rc_bt_0009.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "rc_bt_0010", + "module": "rc", + "archetype": "batch", + "tier": "easy", + "path": "app/batch/rc_bt_0010.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "rc_bt_0011", + "module": "rc", + "archetype": "batch", + "tier": "medium", + "path": "app/batch/rc_bt_0011.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "rc_bt_0012", + "module": "rc", + "archetype": "batch", + "tier": "easy", + "path": "app/batch/rc_bt_0012.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "rc_bt_0013", + "module": "rc", + "archetype": "batch", + "tier": "medium", + "path": "app/batch/rc_bt_0013.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "rc_bt_0014", + "module": "rc", + "archetype": "batch", + "tier": "easy", + "path": "app/batch/rc_bt_0014.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "rc_bt_0015", + "module": "rc", + "archetype": "batch", + "tier": "hard", + "path": "app/batch/rc_bt_0015.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "rc_bt_0016", + "module": "rc", + "archetype": "batch", + "tier": "easy", + "path": "app/batch/rc_bt_0016.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "rc_bt_0017", + "module": "rc", + "archetype": "batch", + "tier": "hard", + "path": "app/batch/rc_bt_0017.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "st_bt_0001", + "module": "st", + "archetype": "batch", + "tier": "easy", + "path": "app/batch/st_bt_0001.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "st_bt_0002", + "module": "st", + "archetype": "batch", + "tier": "medium", + "path": "app/batch/st_bt_0002.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "st_bt_0003", + "module": "st", + "archetype": "batch", + "tier": "easy", + "path": "app/batch/st_bt_0003.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "st_bt_0004", + "module": "st", + "archetype": "batch", + "tier": "hard", + "path": "app/batch/st_bt_0004.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "st_bt_0005", + "module": "st", + "archetype": "batch", + "tier": "easy", + "path": "app/batch/st_bt_0005.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "st_bt_0006", + "module": "st", + "archetype": "batch", + "tier": "easy", + "path": "app/batch/st_bt_0006.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "st_bt_0007", + "module": "st", + "archetype": "batch", + "tier": "medium", + "path": "app/batch/st_bt_0007.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "st_bt_0008", + "module": "st", + "archetype": "batch", + "tier": "easy", + "path": "app/batch/st_bt_0008.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "st_bt_0009", + "module": "st", + "archetype": "batch", + "tier": "medium", + "path": "app/batch/st_bt_0009.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "st_bt_0010", + "module": "st", + "archetype": "batch", + "tier": "easy", + "path": "app/batch/st_bt_0010.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "st_bt_0011", + "module": "st", + "archetype": "batch", + "tier": "medium", + "path": "app/batch/st_bt_0011.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "st_bt_0012", + "module": "st", + "archetype": "batch", + "tier": "easy", + "path": "app/batch/st_bt_0012.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "st_bt_0013", + "module": "st", + "archetype": "batch", + "tier": "hard", + "path": "app/batch/st_bt_0013.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "st_bt_0014", + "module": "st", + "archetype": "batch", + "tier": "easy", + "path": "app/batch/st_bt_0014.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "st_bt_0015", + "module": "st", + "archetype": "batch", + "tier": "hard", + "path": "app/batch/st_bt_0015.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "st_bt_0016", + "module": "st", + "archetype": "batch", + "tier": "easy", + "path": "app/batch/st_bt_0016.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "vl_bt_0001", + "module": "vl", + "archetype": "batch", + "tier": "easy", + "path": "app/batch/vl_bt_0001.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "vl_bt_0002", + "module": "vl", + "archetype": "batch", + "tier": "medium", + "path": "app/batch/vl_bt_0002.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "vl_bt_0003", + "module": "vl", + "archetype": "batch", + "tier": "easy", + "path": "app/batch/vl_bt_0003.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "vl_bt_0004", + "module": "vl", + "archetype": "batch", + "tier": "hard", + "path": "app/batch/vl_bt_0004.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "vl_bt_0005", + "module": "vl", + "archetype": "batch", + "tier": "easy", + "path": "app/batch/vl_bt_0005.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "vl_bt_0006", + "module": "vl", + "archetype": "batch", + "tier": "hard", + "path": "app/batch/vl_bt_0006.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "vl_bt_0007", + "module": "vl", + "archetype": "batch", + "tier": "easy", + "path": "app/batch/vl_bt_0007.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "vl_bt_0008", + "module": "vl", + "archetype": "batch", + "tier": "easy", + "path": "app/batch/vl_bt_0008.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "vl_bt_0009", + "module": "vl", + "archetype": "batch", + "tier": "medium", + "path": "app/batch/vl_bt_0009.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "vl_bt_0010", + "module": "vl", + "archetype": "batch", + "tier": "easy", + "path": "app/batch/vl_bt_0010.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "vl_bt_0011", + "module": "vl", + "archetype": "batch", + "tier": "medium", + "path": "app/batch/vl_bt_0011.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "vl_bt_0012", + "module": "vl", + "archetype": "batch", + "tier": "easy", + "path": "app/batch/vl_bt_0012.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "vl_bt_0013", + "module": "vl", + "archetype": "batch", + "tier": "medium", + "path": "app/batch/vl_bt_0013.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "vl_bt_0014", + "module": "vl", + "archetype": "batch", + "tier": "easy", + "path": "app/batch/vl_bt_0014.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "vl_bt_0015", + "module": "vl", + "archetype": "batch", + "tier": "hard", + "path": "app/batch/vl_bt_0015.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "vl_bt_0016", + "module": "vl", + "archetype": "batch", + "tier": "easy", + "path": "app/batch/vl_bt_0016.pgc", + "loc": 138, + "sqlCount": 7 + }, + { + "id": "ac_cu_0001", + "module": "ac", + "archetype": "common", + "tier": "easy", + "path": "app/common/ac_cu_0001.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "ac_cu_0002", + "module": "ac", + "archetype": "common", + "tier": "medium", + "path": "app/common/ac_cu_0002.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "ac_cu_0003", + "module": "ac", + "archetype": "common", + "tier": "easy", + "path": "app/common/ac_cu_0003.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "ac_cu_0004", + "module": "ac", + "archetype": "common", + "tier": "medium", + "path": "app/common/ac_cu_0004.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "ac_cu_0005", + "module": "ac", + "archetype": "common", + "tier": "easy", + "path": "app/common/ac_cu_0005.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "ac_cu_0006", + "module": "ac", + "archetype": "common", + "tier": "hard", + "path": "app/common/ac_cu_0006.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "ac_cu_0007", + "module": "ac", + "archetype": "common", + "tier": "easy", + "path": "app/common/ac_cu_0007.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "ac_cu_0008", + "module": "ac", + "archetype": "common", + "tier": "hard", + "path": "app/common/ac_cu_0008.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "ac_cu_0009", + "module": "ac", + "archetype": "common", + "tier": "easy", + "path": "app/common/ac_cu_0009.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "ac_cu_0010", + "module": "ac", + "archetype": "common", + "tier": "easy", + "path": "app/common/ac_cu_0010.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "ac_cu_0011", + "module": "ac", + "archetype": "common", + "tier": "medium", + "path": "app/common/ac_cu_0011.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "au_cu_0001", + "module": "au", + "archetype": "common", + "tier": "easy", + "path": "app/common/au_cu_0001.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "au_cu_0002", + "module": "au", + "archetype": "common", + "tier": "medium", + "path": "app/common/au_cu_0002.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "au_cu_0003", + "module": "au", + "archetype": "common", + "tier": "easy", + "path": "app/common/au_cu_0003.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "au_cu_0004", + "module": "au", + "archetype": "common", + "tier": "medium", + "path": "app/common/au_cu_0004.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "au_cu_0005", + "module": "au", + "archetype": "common", + "tier": "easy", + "path": "app/common/au_cu_0005.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "au_cu_0006", + "module": "au", + "archetype": "common", + "tier": "medium", + "path": "app/common/au_cu_0006.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "au_cu_0007", + "module": "au", + "archetype": "common", + "tier": "easy", + "path": "app/common/au_cu_0007.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "au_cu_0008", + "module": "au", + "archetype": "common", + "tier": "hard", + "path": "app/common/au_cu_0008.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "au_cu_0009", + "module": "au", + "archetype": "common", + "tier": "easy", + "path": "app/common/au_cu_0009.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "au_cu_0010", + "module": "au", + "archetype": "common", + "tier": "easy", + "path": "app/common/au_cu_0010.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "au_cu_0011", + "module": "au", + "archetype": "common", + "tier": "medium", + "path": "app/common/au_cu_0011.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "cl_cu_0001", + "module": "cl", + "archetype": "common", + "tier": "easy", + "path": "app/common/cl_cu_0001.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "cl_cu_0002", + "module": "cl", + "archetype": "common", + "tier": "easy", + "path": "app/common/cl_cu_0002.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "cl_cu_0003", + "module": "cl", + "archetype": "common", + "tier": "medium", + "path": "app/common/cl_cu_0003.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "cl_cu_0004", + "module": "cl", + "archetype": "common", + "tier": "easy", + "path": "app/common/cl_cu_0004.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "cl_cu_0005", + "module": "cl", + "archetype": "common", + "tier": "medium", + "path": "app/common/cl_cu_0005.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "cl_cu_0006", + "module": "cl", + "archetype": "common", + "tier": "easy", + "path": "app/common/cl_cu_0006.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "cl_cu_0007", + "module": "cl", + "archetype": "common", + "tier": "medium", + "path": "app/common/cl_cu_0007.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "cl_cu_0008", + "module": "cl", + "archetype": "common", + "tier": "easy", + "path": "app/common/cl_cu_0008.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "cl_cu_0009", + "module": "cl", + "archetype": "common", + "tier": "hard", + "path": "app/common/cl_cu_0009.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "cl_cu_0010", + "module": "cl", + "archetype": "common", + "tier": "easy", + "path": "app/common/cl_cu_0010.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "cm_cu_0001", + "module": "cm", + "archetype": "common", + "tier": "easy", + "path": "app/common/cm_cu_0001.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "cm_cu_0002", + "module": "cm", + "archetype": "common", + "tier": "easy", + "path": "app/common/cm_cu_0002.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "cm_cu_0003", + "module": "cm", + "archetype": "common", + "tier": "medium", + "path": "app/common/cm_cu_0003.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "cm_cu_0004", + "module": "cm", + "archetype": "common", + "tier": "easy", + "path": "app/common/cm_cu_0004.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "cm_cu_0005", + "module": "cm", + "archetype": "common", + "tier": "medium", + "path": "app/common/cm_cu_0005.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "cm_cu_0006", + "module": "cm", + "archetype": "common", + "tier": "easy", + "path": "app/common/cm_cu_0006.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "cm_cu_0007", + "module": "cm", + "archetype": "common", + "tier": "medium", + "path": "app/common/cm_cu_0007.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "cm_cu_0008", + "module": "cm", + "archetype": "common", + "tier": "easy", + "path": "app/common/cm_cu_0008.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "cm_cu_0009", + "module": "cm", + "archetype": "common", + "tier": "hard", + "path": "app/common/cm_cu_0009.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "cm_cu_0010", + "module": "cm", + "archetype": "common", + "tier": "easy", + "path": "app/common/cm_cu_0010.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "cm_cu_0011", + "module": "cm", + "archetype": "common", + "tier": "hard", + "path": "app/common/cm_cu_0011.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "lg_cu_0001", + "module": "lg", + "archetype": "common", + "tier": "easy", + "path": "app/common/lg_cu_0001.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "lg_cu_0002", + "module": "lg", + "archetype": "common", + "tier": "hard", + "path": "app/common/lg_cu_0002.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "lg_cu_0003", + "module": "lg", + "archetype": "common", + "tier": "easy", + "path": "app/common/lg_cu_0003.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "lg_cu_0004", + "module": "lg", + "archetype": "common", + "tier": "easy", + "path": "app/common/lg_cu_0004.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "lg_cu_0005", + "module": "lg", + "archetype": "common", + "tier": "medium", + "path": "app/common/lg_cu_0005.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "lg_cu_0006", + "module": "lg", + "archetype": "common", + "tier": "easy", + "path": "app/common/lg_cu_0006.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "lg_cu_0007", + "module": "lg", + "archetype": "common", + "tier": "medium", + "path": "app/common/lg_cu_0007.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "lg_cu_0008", + "module": "lg", + "archetype": "common", + "tier": "easy", + "path": "app/common/lg_cu_0008.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "lg_cu_0009", + "module": "lg", + "archetype": "common", + "tier": "medium", + "path": "app/common/lg_cu_0009.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "lg_cu_0010", + "module": "lg", + "archetype": "common", + "tier": "easy", + "path": "app/common/lg_cu_0010.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "lg_cu_0011", + "module": "lg", + "archetype": "common", + "tier": "hard", + "path": "app/common/lg_cu_0011.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "mg_cu_0001", + "module": "mg", + "archetype": "common", + "tier": "easy", + "path": "app/common/mg_cu_0001.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "mg_cu_0002", + "module": "mg", + "archetype": "common", + "tier": "medium", + "path": "app/common/mg_cu_0002.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "mg_cu_0003", + "module": "mg", + "archetype": "common", + "tier": "easy", + "path": "app/common/mg_cu_0003.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "mg_cu_0004", + "module": "mg", + "archetype": "common", + "tier": "medium", + "path": "app/common/mg_cu_0004.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "mg_cu_0005", + "module": "mg", + "archetype": "common", + "tier": "easy", + "path": "app/common/mg_cu_0005.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "mg_cu_0006", + "module": "mg", + "archetype": "common", + "tier": "medium", + "path": "app/common/mg_cu_0006.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "mg_cu_0007", + "module": "mg", + "archetype": "common", + "tier": "easy", + "path": "app/common/mg_cu_0007.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "mg_cu_0008", + "module": "mg", + "archetype": "common", + "tier": "hard", + "path": "app/common/mg_cu_0008.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "mg_cu_0009", + "module": "mg", + "archetype": "common", + "tier": "easy", + "path": "app/common/mg_cu_0009.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "mg_cu_0010", + "module": "mg", + "archetype": "common", + "tier": "hard", + "path": "app/common/mg_cu_0010.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "mg_cu_0011", + "module": "mg", + "archetype": "common", + "tier": "easy", + "path": "app/common/mg_cu_0011.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "mm_cu_0001", + "module": "mm", + "archetype": "common", + "tier": "easy", + "path": "app/common/mm_cu_0001.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "mm_cu_0002", + "module": "mm", + "archetype": "common", + "tier": "hard", + "path": "app/common/mm_cu_0002.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "mm_cu_0003", + "module": "mm", + "archetype": "common", + "tier": "easy", + "path": "app/common/mm_cu_0003.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "mm_cu_0004", + "module": "mm", + "archetype": "common", + "tier": "easy", + "path": "app/common/mm_cu_0004.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "mm_cu_0005", + "module": "mm", + "archetype": "common", + "tier": "medium", + "path": "app/common/mm_cu_0005.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "mm_cu_0006", + "module": "mm", + "archetype": "common", + "tier": "easy", + "path": "app/common/mm_cu_0006.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "mm_cu_0007", + "module": "mm", + "archetype": "common", + "tier": "medium", + "path": "app/common/mm_cu_0007.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "mm_cu_0008", + "module": "mm", + "archetype": "common", + "tier": "easy", + "path": "app/common/mm_cu_0008.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "mm_cu_0009", + "module": "mm", + "archetype": "common", + "tier": "medium", + "path": "app/common/mm_cu_0009.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "mm_cu_0010", + "module": "mm", + "archetype": "common", + "tier": "easy", + "path": "app/common/mm_cu_0010.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "mm_cu_0011", + "module": "mm", + "archetype": "common", + "tier": "hard", + "path": "app/common/mm_cu_0011.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "py_cu_0001", + "module": "py", + "archetype": "common", + "tier": "easy", + "path": "app/common/py_cu_0001.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "py_cu_0002", + "module": "py", + "archetype": "common", + "tier": "hard", + "path": "app/common/py_cu_0002.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "py_cu_0003", + "module": "py", + "archetype": "common", + "tier": "easy", + "path": "app/common/py_cu_0003.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "py_cu_0004", + "module": "py", + "archetype": "common", + "tier": "hard", + "path": "app/common/py_cu_0004.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "py_cu_0005", + "module": "py", + "archetype": "common", + "tier": "easy", + "path": "app/common/py_cu_0005.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "py_cu_0006", + "module": "py", + "archetype": "common", + "tier": "easy", + "path": "app/common/py_cu_0006.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "py_cu_0007", + "module": "py", + "archetype": "common", + "tier": "medium", + "path": "app/common/py_cu_0007.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "py_cu_0008", + "module": "py", + "archetype": "common", + "tier": "easy", + "path": "app/common/py_cu_0008.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "py_cu_0009", + "module": "py", + "archetype": "common", + "tier": "medium", + "path": "app/common/py_cu_0009.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "py_cu_0010", + "module": "py", + "archetype": "common", + "tier": "easy", + "path": "app/common/py_cu_0010.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "py_cu_0011", + "module": "py", + "archetype": "common", + "tier": "medium", + "path": "app/common/py_cu_0011.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "rc_cu_0001", + "module": "rc", + "archetype": "common", + "tier": "easy", + "path": "app/common/rc_cu_0001.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "rc_cu_0002", + "module": "rc", + "archetype": "common", + "tier": "medium", + "path": "app/common/rc_cu_0002.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "rc_cu_0003", + "module": "rc", + "archetype": "common", + "tier": "easy", + "path": "app/common/rc_cu_0003.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "rc_cu_0004", + "module": "rc", + "archetype": "common", + "tier": "medium", + "path": "app/common/rc_cu_0004.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "rc_cu_0005", + "module": "rc", + "archetype": "common", + "tier": "easy", + "path": "app/common/rc_cu_0005.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "rc_cu_0006", + "module": "rc", + "archetype": "common", + "tier": "hard", + "path": "app/common/rc_cu_0006.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "rc_cu_0007", + "module": "rc", + "archetype": "common", + "tier": "easy", + "path": "app/common/rc_cu_0007.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "rc_cu_0008", + "module": "rc", + "archetype": "common", + "tier": "easy", + "path": "app/common/rc_cu_0008.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "rc_cu_0009", + "module": "rc", + "archetype": "common", + "tier": "medium", + "path": "app/common/rc_cu_0009.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "rc_cu_0010", + "module": "rc", + "archetype": "common", + "tier": "easy", + "path": "app/common/rc_cu_0010.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "rc_cu_0011", + "module": "rc", + "archetype": "common", + "tier": "medium", + "path": "app/common/rc_cu_0011.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "st_cu_0001", + "module": "st", + "archetype": "common", + "tier": "easy", + "path": "app/common/st_cu_0001.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "st_cu_0002", + "module": "st", + "archetype": "common", + "tier": "medium", + "path": "app/common/st_cu_0002.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "st_cu_0003", + "module": "st", + "archetype": "common", + "tier": "easy", + "path": "app/common/st_cu_0003.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "st_cu_0004", + "module": "st", + "archetype": "common", + "tier": "hard", + "path": "app/common/st_cu_0004.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "st_cu_0005", + "module": "st", + "archetype": "common", + "tier": "easy", + "path": "app/common/st_cu_0005.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "st_cu_0006", + "module": "st", + "archetype": "common", + "tier": "easy", + "path": "app/common/st_cu_0006.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "st_cu_0007", + "module": "st", + "archetype": "common", + "tier": "medium", + "path": "app/common/st_cu_0007.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "st_cu_0008", + "module": "st", + "archetype": "common", + "tier": "easy", + "path": "app/common/st_cu_0008.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "st_cu_0009", + "module": "st", + "archetype": "common", + "tier": "medium", + "path": "app/common/st_cu_0009.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "st_cu_0010", + "module": "st", + "archetype": "common", + "tier": "easy", + "path": "app/common/st_cu_0010.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "st_cu_0011", + "module": "st", + "archetype": "common", + "tier": "medium", + "path": "app/common/st_cu_0011.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "vl_cu_0001", + "module": "vl", + "archetype": "common", + "tier": "easy", + "path": "app/common/vl_cu_0001.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "vl_cu_0002", + "module": "vl", + "archetype": "common", + "tier": "medium", + "path": "app/common/vl_cu_0002.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "vl_cu_0003", + "module": "vl", + "archetype": "common", + "tier": "easy", + "path": "app/common/vl_cu_0003.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "vl_cu_0004", + "module": "vl", + "archetype": "common", + "tier": "hard", + "path": "app/common/vl_cu_0004.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "vl_cu_0005", + "module": "vl", + "archetype": "common", + "tier": "easy", + "path": "app/common/vl_cu_0005.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "vl_cu_0006", + "module": "vl", + "archetype": "common", + "tier": "hard", + "path": "app/common/vl_cu_0006.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "vl_cu_0007", + "module": "vl", + "archetype": "common", + "tier": "easy", + "path": "app/common/vl_cu_0007.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "vl_cu_0008", + "module": "vl", + "archetype": "common", + "tier": "easy", + "path": "app/common/vl_cu_0008.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "vl_cu_0009", + "module": "vl", + "archetype": "common", + "tier": "medium", + "path": "app/common/vl_cu_0009.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "vl_cu_0010", + "module": "vl", + "archetype": "common", + "tier": "easy", + "path": "app/common/vl_cu_0010.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "vl_cu_0011", + "module": "vl", + "archetype": "common", + "tier": "medium", + "path": "app/common/vl_cu_0011.c", + "loc": 37, + "sqlCount": 0 + }, + { + "id": "ac_dbio_main", + "module": "ac", + "archetype": "dbio", + "tier": "medium", + "path": "app/dbio/ac_dbio_main.pgc", + "loc": 202, + "sqlCount": 20 + }, + { + "id": "ac_io_0001", + "module": "ac", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/ac_io_0001.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "ac_io_0002", + "module": "ac", + "archetype": "dbio", + "tier": "medium", + "path": "app/dbio/ac_io_0002.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "ac_io_0003", + "module": "ac", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/ac_io_0003.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "ac_io_0004", + "module": "ac", + "archetype": "dbio", + "tier": "medium", + "path": "app/dbio/ac_io_0004.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "ac_io_0005", + "module": "ac", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/ac_io_0005.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "ac_io_0006", + "module": "ac", + "archetype": "dbio", + "tier": "hard", + "path": "app/dbio/ac_io_0006.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "ac_io_0007", + "module": "ac", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/ac_io_0007.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "ac_io_0008", + "module": "ac", + "archetype": "dbio", + "tier": "hard", + "path": "app/dbio/ac_io_0008.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "ac_io_0009", + "module": "ac", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/ac_io_0009.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "ac_io_0010", + "module": "ac", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/ac_io_0010.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "ac_io_0011", + "module": "ac", + "archetype": "dbio", + "tier": "medium", + "path": "app/dbio/ac_io_0011.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "ac_io_0012", + "module": "ac", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/ac_io_0012.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "ac_io_0013", + "module": "ac", + "archetype": "dbio", + "tier": "medium", + "path": "app/dbio/ac_io_0013.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "ac_io_0014", + "module": "ac", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/ac_io_0014.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "ac_io_0015", + "module": "ac", + "archetype": "dbio", + "tier": "medium", + "path": "app/dbio/ac_io_0015.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "ac_io_0016", + "module": "ac", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/ac_io_0016.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "ac_io_0017", + "module": "ac", + "archetype": "dbio", + "tier": "hard", + "path": "app/dbio/ac_io_0017.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "ac_io_0018", + "module": "ac", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/ac_io_0018.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "ac_io_0019", + "module": "ac", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/ac_io_0019.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "ac_io_0020", + "module": "ac", + "archetype": "dbio", + "tier": "medium", + "path": "app/dbio/ac_io_0020.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "ac_io_0021", + "module": "ac", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/ac_io_0021.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "ac_io_0022", + "module": "ac", + "archetype": "dbio", + "tier": "medium", + "path": "app/dbio/ac_io_0022.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "ac_io_0023", + "module": "ac", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/ac_io_0023.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "ac_io_0024", + "module": "ac", + "archetype": "dbio", + "tier": "medium", + "path": "app/dbio/ac_io_0024.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "ac_io_0025", + "module": "ac", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/ac_io_0025.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "ac_io_0026", + "module": "ac", + "archetype": "dbio", + "tier": "hard", + "path": "app/dbio/ac_io_0026.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "ac_io_0027", + "module": "ac", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/ac_io_0027.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "au_dbio_main", + "module": "au", + "archetype": "dbio", + "tier": "medium", + "path": "app/dbio/au_dbio_main.pgc", + "loc": 202, + "sqlCount": 20 + }, + { + "id": "au_io_0001", + "module": "au", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/au_io_0001.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "au_io_0002", + "module": "au", + "archetype": "dbio", + "tier": "medium", + "path": "app/dbio/au_io_0002.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "au_io_0003", + "module": "au", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/au_io_0003.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "au_io_0004", + "module": "au", + "archetype": "dbio", + "tier": "medium", + "path": "app/dbio/au_io_0004.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "au_io_0005", + "module": "au", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/au_io_0005.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "au_io_0006", + "module": "au", + "archetype": "dbio", + "tier": "medium", + "path": "app/dbio/au_io_0006.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "au_io_0007", + "module": "au", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/au_io_0007.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "au_io_0008", + "module": "au", + "archetype": "dbio", + "tier": "hard", + "path": "app/dbio/au_io_0008.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "au_io_0009", + "module": "au", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/au_io_0009.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "au_io_0010", + "module": "au", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/au_io_0010.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "au_io_0011", + "module": "au", + "archetype": "dbio", + "tier": "medium", + "path": "app/dbio/au_io_0011.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "au_io_0012", + "module": "au", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/au_io_0012.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "au_io_0013", + "module": "au", + "archetype": "dbio", + "tier": "medium", + "path": "app/dbio/au_io_0013.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "au_io_0014", + "module": "au", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/au_io_0014.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "au_io_0015", + "module": "au", + "archetype": "dbio", + "tier": "medium", + "path": "app/dbio/au_io_0015.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "au_io_0016", + "module": "au", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/au_io_0016.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "au_io_0017", + "module": "au", + "archetype": "dbio", + "tier": "hard", + "path": "app/dbio/au_io_0017.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "au_io_0018", + "module": "au", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/au_io_0018.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "au_io_0019", + "module": "au", + "archetype": "dbio", + "tier": "hard", + "path": "app/dbio/au_io_0019.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "au_io_0020", + "module": "au", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/au_io_0020.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "au_io_0021", + "module": "au", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/au_io_0021.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "au_io_0022", + "module": "au", + "archetype": "dbio", + "tier": "medium", + "path": "app/dbio/au_io_0022.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "au_io_0023", + "module": "au", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/au_io_0023.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "au_io_0024", + "module": "au", + "archetype": "dbio", + "tier": "medium", + "path": "app/dbio/au_io_0024.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "au_io_0025", + "module": "au", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/au_io_0025.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "au_io_0026", + "module": "au", + "archetype": "dbio", + "tier": "medium", + "path": "app/dbio/au_io_0026.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "au_io_0027", + "module": "au", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/au_io_0027.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "cl_dbio_main", + "module": "cl", + "archetype": "dbio", + "tier": "medium", + "path": "app/dbio/cl_dbio_main.pgc", + "loc": 202, + "sqlCount": 20 + }, + { + "id": "cl_io_0001", + "module": "cl", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/cl_io_0001.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "cl_io_0002", + "module": "cl", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/cl_io_0002.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "cl_io_0003", + "module": "cl", + "archetype": "dbio", + "tier": "medium", + "path": "app/dbio/cl_io_0003.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "cl_io_0004", + "module": "cl", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/cl_io_0004.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "cl_io_0005", + "module": "cl", + "archetype": "dbio", + "tier": "medium", + "path": "app/dbio/cl_io_0005.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "cl_io_0006", + "module": "cl", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/cl_io_0006.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "cl_io_0007", + "module": "cl", + "archetype": "dbio", + "tier": "medium", + "path": "app/dbio/cl_io_0007.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "cl_io_0008", + "module": "cl", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/cl_io_0008.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "cl_io_0009", + "module": "cl", + "archetype": "dbio", + "tier": "hard", + "path": "app/dbio/cl_io_0009.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "cl_io_0010", + "module": "cl", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/cl_io_0010.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "cl_io_0011", + "module": "cl", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/cl_io_0011.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "cl_io_0012", + "module": "cl", + "archetype": "dbio", + "tier": "medium", + "path": "app/dbio/cl_io_0012.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "cl_io_0013", + "module": "cl", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/cl_io_0013.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "cl_io_0014", + "module": "cl", + "archetype": "dbio", + "tier": "medium", + "path": "app/dbio/cl_io_0014.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "cl_io_0015", + "module": "cl", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/cl_io_0015.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "cl_io_0016", + "module": "cl", + "archetype": "dbio", + "tier": "medium", + "path": "app/dbio/cl_io_0016.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "cl_io_0017", + "module": "cl", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/cl_io_0017.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "cl_io_0018", + "module": "cl", + "archetype": "dbio", + "tier": "hard", + "path": "app/dbio/cl_io_0018.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "cl_io_0019", + "module": "cl", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/cl_io_0019.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "cl_io_0020", + "module": "cl", + "archetype": "dbio", + "tier": "hard", + "path": "app/dbio/cl_io_0020.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "cl_io_0021", + "module": "cl", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/cl_io_0021.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "cl_io_0022", + "module": "cl", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/cl_io_0022.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "cl_io_0023", + "module": "cl", + "archetype": "dbio", + "tier": "medium", + "path": "app/dbio/cl_io_0023.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "cl_io_0024", + "module": "cl", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/cl_io_0024.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "cl_io_0025", + "module": "cl", + "archetype": "dbio", + "tier": "medium", + "path": "app/dbio/cl_io_0025.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "cl_io_0026", + "module": "cl", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/cl_io_0026.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "cm_dbio_main", + "module": "cm", + "archetype": "dbio", + "tier": "medium", + "path": "app/dbio/cm_dbio_main.pgc", + "loc": 202, + "sqlCount": 20 + }, + { + "id": "cm_io_0001", + "module": "cm", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/cm_io_0001.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "cm_io_0002", + "module": "cm", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/cm_io_0002.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "cm_io_0003", + "module": "cm", + "archetype": "dbio", + "tier": "medium", + "path": "app/dbio/cm_io_0003.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "cm_io_0004", + "module": "cm", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/cm_io_0004.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "cm_io_0005", + "module": "cm", + "archetype": "dbio", + "tier": "medium", + "path": "app/dbio/cm_io_0005.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "cm_io_0006", + "module": "cm", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/cm_io_0006.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "cm_io_0007", + "module": "cm", + "archetype": "dbio", + "tier": "medium", + "path": "app/dbio/cm_io_0007.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "cm_io_0008", + "module": "cm", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/cm_io_0008.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "cm_io_0009", + "module": "cm", + "archetype": "dbio", + "tier": "hard", + "path": "app/dbio/cm_io_0009.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "cm_io_0010", + "module": "cm", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/cm_io_0010.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "cm_io_0011", + "module": "cm", + "archetype": "dbio", + "tier": "hard", + "path": "app/dbio/cm_io_0011.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "cm_io_0012", + "module": "cm", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/cm_io_0012.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "cm_io_0013", + "module": "cm", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/cm_io_0013.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "cm_io_0014", + "module": "cm", + "archetype": "dbio", + "tier": "medium", + "path": "app/dbio/cm_io_0014.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "cm_io_0015", + "module": "cm", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/cm_io_0015.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "cm_io_0016", + "module": "cm", + "archetype": "dbio", + "tier": "medium", + "path": "app/dbio/cm_io_0016.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "cm_io_0017", + "module": "cm", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/cm_io_0017.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "cm_io_0018", + "module": "cm", + "archetype": "dbio", + "tier": "medium", + "path": "app/dbio/cm_io_0018.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "cm_io_0019", + "module": "cm", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/cm_io_0019.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "cm_io_0020", + "module": "cm", + "archetype": "dbio", + "tier": "hard", + "path": "app/dbio/cm_io_0020.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "cm_io_0021", + "module": "cm", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/cm_io_0021.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "cm_io_0022", + "module": "cm", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/cm_io_0022.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "cm_io_0023", + "module": "cm", + "archetype": "dbio", + "tier": "medium", + "path": "app/dbio/cm_io_0023.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "cm_io_0024", + "module": "cm", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/cm_io_0024.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "cm_io_0025", + "module": "cm", + "archetype": "dbio", + "tier": "medium", + "path": "app/dbio/cm_io_0025.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "cm_io_0026", + "module": "cm", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/cm_io_0026.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "lg_dbio_main", + "module": "lg", + "archetype": "dbio", + "tier": "medium", + "path": "app/dbio/lg_dbio_main.pgc", + "loc": 202, + "sqlCount": 20 + }, + { + "id": "lg_io_0001", + "module": "lg", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/lg_io_0001.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "lg_io_0002", + "module": "lg", + "archetype": "dbio", + "tier": "hard", + "path": "app/dbio/lg_io_0002.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "lg_io_0003", + "module": "lg", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/lg_io_0003.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "lg_io_0004", + "module": "lg", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/lg_io_0004.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "lg_io_0005", + "module": "lg", + "archetype": "dbio", + "tier": "medium", + "path": "app/dbio/lg_io_0005.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "lg_io_0006", + "module": "lg", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/lg_io_0006.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "lg_io_0007", + "module": "lg", + "archetype": "dbio", + "tier": "medium", + "path": "app/dbio/lg_io_0007.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "lg_io_0008", + "module": "lg", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/lg_io_0008.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "lg_io_0009", + "module": "lg", + "archetype": "dbio", + "tier": "medium", + "path": "app/dbio/lg_io_0009.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "lg_io_0010", + "module": "lg", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/lg_io_0010.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "lg_io_0011", + "module": "lg", + "archetype": "dbio", + "tier": "hard", + "path": "app/dbio/lg_io_0011.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "lg_io_0012", + "module": "lg", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/lg_io_0012.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "lg_io_0013", + "module": "lg", + "archetype": "dbio", + "tier": "hard", + "path": "app/dbio/lg_io_0013.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "lg_io_0014", + "module": "lg", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/lg_io_0014.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "lg_io_0015", + "module": "lg", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/lg_io_0015.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "lg_io_0016", + "module": "lg", + "archetype": "dbio", + "tier": "medium", + "path": "app/dbio/lg_io_0016.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "lg_io_0017", + "module": "lg", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/lg_io_0017.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "lg_io_0018", + "module": "lg", + "archetype": "dbio", + "tier": "medium", + "path": "app/dbio/lg_io_0018.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "lg_io_0019", + "module": "lg", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/lg_io_0019.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "lg_io_0020", + "module": "lg", + "archetype": "dbio", + "tier": "medium", + "path": "app/dbio/lg_io_0020.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "lg_io_0021", + "module": "lg", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/lg_io_0021.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "lg_io_0022", + "module": "lg", + "archetype": "dbio", + "tier": "hard", + "path": "app/dbio/lg_io_0022.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "lg_io_0023", + "module": "lg", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/lg_io_0023.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "lg_io_0024", + "module": "lg", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/lg_io_0024.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "lg_io_0025", + "module": "lg", + "archetype": "dbio", + "tier": "medium", + "path": "app/dbio/lg_io_0025.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "lg_io_0026", + "module": "lg", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/lg_io_0026.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "mg_dbio_main", + "module": "mg", + "archetype": "dbio", + "tier": "medium", + "path": "app/dbio/mg_dbio_main.pgc", + "loc": 202, + "sqlCount": 20 + }, + { + "id": "mg_io_0001", + "module": "mg", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/mg_io_0001.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "mg_io_0002", + "module": "mg", + "archetype": "dbio", + "tier": "medium", + "path": "app/dbio/mg_io_0002.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "mg_io_0003", + "module": "mg", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/mg_io_0003.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "mg_io_0004", + "module": "mg", + "archetype": "dbio", + "tier": "medium", + "path": "app/dbio/mg_io_0004.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "mg_io_0005", + "module": "mg", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/mg_io_0005.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "mg_io_0006", + "module": "mg", + "archetype": "dbio", + "tier": "medium", + "path": "app/dbio/mg_io_0006.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "mg_io_0007", + "module": "mg", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/mg_io_0007.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "mg_io_0008", + "module": "mg", + "archetype": "dbio", + "tier": "hard", + "path": "app/dbio/mg_io_0008.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "mg_io_0009", + "module": "mg", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/mg_io_0009.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "mg_io_0010", + "module": "mg", + "archetype": "dbio", + "tier": "hard", + "path": "app/dbio/mg_io_0010.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "mg_io_0011", + "module": "mg", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/mg_io_0011.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "mg_io_0012", + "module": "mg", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/mg_io_0012.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "mg_io_0013", + "module": "mg", + "archetype": "dbio", + "tier": "medium", + "path": "app/dbio/mg_io_0013.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "mg_io_0014", + "module": "mg", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/mg_io_0014.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "mg_io_0015", + "module": "mg", + "archetype": "dbio", + "tier": "medium", + "path": "app/dbio/mg_io_0015.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "mg_io_0016", + "module": "mg", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/mg_io_0016.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "mg_io_0017", + "module": "mg", + "archetype": "dbio", + "tier": "medium", + "path": "app/dbio/mg_io_0017.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "mg_io_0018", + "module": "mg", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/mg_io_0018.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "mg_io_0019", + "module": "mg", + "archetype": "dbio", + "tier": "hard", + "path": "app/dbio/mg_io_0019.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "mg_io_0020", + "module": "mg", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/mg_io_0020.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "mg_io_0021", + "module": "mg", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/mg_io_0021.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "mg_io_0022", + "module": "mg", + "archetype": "dbio", + "tier": "medium", + "path": "app/dbio/mg_io_0022.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "mg_io_0023", + "module": "mg", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/mg_io_0023.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "mg_io_0024", + "module": "mg", + "archetype": "dbio", + "tier": "medium", + "path": "app/dbio/mg_io_0024.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "mg_io_0025", + "module": "mg", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/mg_io_0025.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "mg_io_0026", + "module": "mg", + "archetype": "dbio", + "tier": "medium", + "path": "app/dbio/mg_io_0026.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "mg_io_0027", + "module": "mg", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/mg_io_0027.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "mm_dbio_main", + "module": "mm", + "archetype": "dbio", + "tier": "medium", + "path": "app/dbio/mm_dbio_main.pgc", + "loc": 202, + "sqlCount": 20 + }, + { + "id": "mm_io_0001", + "module": "mm", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/mm_io_0001.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "mm_io_0002", + "module": "mm", + "archetype": "dbio", + "tier": "hard", + "path": "app/dbio/mm_io_0002.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "mm_io_0003", + "module": "mm", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/mm_io_0003.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "mm_io_0004", + "module": "mm", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/mm_io_0004.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "mm_io_0005", + "module": "mm", + "archetype": "dbio", + "tier": "medium", + "path": "app/dbio/mm_io_0005.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "mm_io_0006", + "module": "mm", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/mm_io_0006.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "mm_io_0007", + "module": "mm", + "archetype": "dbio", + "tier": "medium", + "path": "app/dbio/mm_io_0007.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "mm_io_0008", + "module": "mm", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/mm_io_0008.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "mm_io_0009", + "module": "mm", + "archetype": "dbio", + "tier": "medium", + "path": "app/dbio/mm_io_0009.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "mm_io_0010", + "module": "mm", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/mm_io_0010.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "mm_io_0011", + "module": "mm", + "archetype": "dbio", + "tier": "hard", + "path": "app/dbio/mm_io_0011.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "mm_io_0012", + "module": "mm", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/mm_io_0012.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "mm_io_0013", + "module": "mm", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/mm_io_0013.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "mm_io_0014", + "module": "mm", + "archetype": "dbio", + "tier": "medium", + "path": "app/dbio/mm_io_0014.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "mm_io_0015", + "module": "mm", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/mm_io_0015.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "mm_io_0016", + "module": "mm", + "archetype": "dbio", + "tier": "medium", + "path": "app/dbio/mm_io_0016.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "mm_io_0017", + "module": "mm", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/mm_io_0017.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "mm_io_0018", + "module": "mm", + "archetype": "dbio", + "tier": "medium", + "path": "app/dbio/mm_io_0018.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "mm_io_0019", + "module": "mm", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/mm_io_0019.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "mm_io_0020", + "module": "mm", + "archetype": "dbio", + "tier": "hard", + "path": "app/dbio/mm_io_0020.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "mm_io_0021", + "module": "mm", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/mm_io_0021.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "mm_io_0022", + "module": "mm", + "archetype": "dbio", + "tier": "hard", + "path": "app/dbio/mm_io_0022.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "mm_io_0023", + "module": "mm", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/mm_io_0023.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "mm_io_0024", + "module": "mm", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/mm_io_0024.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "mm_io_0025", + "module": "mm", + "archetype": "dbio", + "tier": "medium", + "path": "app/dbio/mm_io_0025.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "mm_io_0026", + "module": "mm", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/mm_io_0026.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "py_dbio_main", + "module": "py", + "archetype": "dbio", + "tier": "medium", + "path": "app/dbio/py_dbio_main.pgc", + "loc": 202, + "sqlCount": 20 + }, + { + "id": "py_io_0001", + "module": "py", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/py_io_0001.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "py_io_0002", + "module": "py", + "archetype": "dbio", + "tier": "hard", + "path": "app/dbio/py_io_0002.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "py_io_0003", + "module": "py", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/py_io_0003.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "py_io_0004", + "module": "py", + "archetype": "dbio", + "tier": "hard", + "path": "app/dbio/py_io_0004.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "py_io_0005", + "module": "py", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/py_io_0005.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "py_io_0006", + "module": "py", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/py_io_0006.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "py_io_0007", + "module": "py", + "archetype": "dbio", + "tier": "medium", + "path": "app/dbio/py_io_0007.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "py_io_0008", + "module": "py", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/py_io_0008.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "py_io_0009", + "module": "py", + "archetype": "dbio", + "tier": "medium", + "path": "app/dbio/py_io_0009.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "py_io_0010", + "module": "py", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/py_io_0010.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "py_io_0011", + "module": "py", + "archetype": "dbio", + "tier": "medium", + "path": "app/dbio/py_io_0011.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "py_io_0012", + "module": "py", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/py_io_0012.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "py_io_0013", + "module": "py", + "archetype": "dbio", + "tier": "hard", + "path": "app/dbio/py_io_0013.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "py_io_0014", + "module": "py", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/py_io_0014.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "py_io_0015", + "module": "py", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/py_io_0015.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "py_io_0016", + "module": "py", + "archetype": "dbio", + "tier": "medium", + "path": "app/dbio/py_io_0016.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "py_io_0017", + "module": "py", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/py_io_0017.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "py_io_0018", + "module": "py", + "archetype": "dbio", + "tier": "medium", + "path": "app/dbio/py_io_0018.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "py_io_0019", + "module": "py", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/py_io_0019.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "py_io_0020", + "module": "py", + "archetype": "dbio", + "tier": "medium", + "path": "app/dbio/py_io_0020.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "py_io_0021", + "module": "py", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/py_io_0021.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "py_io_0022", + "module": "py", + "archetype": "dbio", + "tier": "hard", + "path": "app/dbio/py_io_0022.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "py_io_0023", + "module": "py", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/py_io_0023.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "py_io_0024", + "module": "py", + "archetype": "dbio", + "tier": "hard", + "path": "app/dbio/py_io_0024.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "py_io_0025", + "module": "py", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/py_io_0025.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "py_io_0026", + "module": "py", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/py_io_0026.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "rc_dbio_main", + "module": "rc", + "archetype": "dbio", + "tier": "medium", + "path": "app/dbio/rc_dbio_main.pgc", + "loc": 202, + "sqlCount": 20 + }, + { + "id": "rc_io_0001", + "module": "rc", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/rc_io_0001.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "rc_io_0002", + "module": "rc", + "archetype": "dbio", + "tier": "medium", + "path": "app/dbio/rc_io_0002.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "rc_io_0003", + "module": "rc", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/rc_io_0003.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "rc_io_0004", + "module": "rc", + "archetype": "dbio", + "tier": "medium", + "path": "app/dbio/rc_io_0004.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "rc_io_0005", + "module": "rc", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/rc_io_0005.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "rc_io_0006", + "module": "rc", + "archetype": "dbio", + "tier": "hard", + "path": "app/dbio/rc_io_0006.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "rc_io_0007", + "module": "rc", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/rc_io_0007.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "rc_io_0008", + "module": "rc", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/rc_io_0008.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "rc_io_0009", + "module": "rc", + "archetype": "dbio", + "tier": "medium", + "path": "app/dbio/rc_io_0009.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "rc_io_0010", + "module": "rc", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/rc_io_0010.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "rc_io_0011", + "module": "rc", + "archetype": "dbio", + "tier": "medium", + "path": "app/dbio/rc_io_0011.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "rc_io_0012", + "module": "rc", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/rc_io_0012.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "rc_io_0013", + "module": "rc", + "archetype": "dbio", + "tier": "medium", + "path": "app/dbio/rc_io_0013.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "rc_io_0014", + "module": "rc", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/rc_io_0014.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "rc_io_0015", + "module": "rc", + "archetype": "dbio", + "tier": "hard", + "path": "app/dbio/rc_io_0015.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "rc_io_0016", + "module": "rc", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/rc_io_0016.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "rc_io_0017", + "module": "rc", + "archetype": "dbio", + "tier": "hard", + "path": "app/dbio/rc_io_0017.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "rc_io_0018", + "module": "rc", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/rc_io_0018.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "rc_io_0019", + "module": "rc", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/rc_io_0019.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "rc_io_0020", + "module": "rc", + "archetype": "dbio", + "tier": "medium", + "path": "app/dbio/rc_io_0020.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "rc_io_0021", + "module": "rc", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/rc_io_0021.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "rc_io_0022", + "module": "rc", + "archetype": "dbio", + "tier": "medium", + "path": "app/dbio/rc_io_0022.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "rc_io_0023", + "module": "rc", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/rc_io_0023.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "rc_io_0024", + "module": "rc", + "archetype": "dbio", + "tier": "medium", + "path": "app/dbio/rc_io_0024.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "rc_io_0025", + "module": "rc", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/rc_io_0025.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "rc_io_0026", + "module": "rc", + "archetype": "dbio", + "tier": "hard", + "path": "app/dbio/rc_io_0026.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "st_dbio_main", + "module": "st", + "archetype": "dbio", + "tier": "medium", + "path": "app/dbio/st_dbio_main.pgc", + "loc": 202, + "sqlCount": 20 + }, + { + "id": "st_io_0001", + "module": "st", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/st_io_0001.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "st_io_0002", + "module": "st", + "archetype": "dbio", + "tier": "medium", + "path": "app/dbio/st_io_0002.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "st_io_0003", + "module": "st", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/st_io_0003.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "st_io_0004", + "module": "st", + "archetype": "dbio", + "tier": "hard", + "path": "app/dbio/st_io_0004.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "st_io_0005", + "module": "st", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/st_io_0005.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "st_io_0006", + "module": "st", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/st_io_0006.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "st_io_0007", + "module": "st", + "archetype": "dbio", + "tier": "medium", + "path": "app/dbio/st_io_0007.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "st_io_0008", + "module": "st", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/st_io_0008.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "st_io_0009", + "module": "st", + "archetype": "dbio", + "tier": "medium", + "path": "app/dbio/st_io_0009.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "st_io_0010", + "module": "st", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/st_io_0010.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "st_io_0011", + "module": "st", + "archetype": "dbio", + "tier": "medium", + "path": "app/dbio/st_io_0011.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "st_io_0012", + "module": "st", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/st_io_0012.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "st_io_0013", + "module": "st", + "archetype": "dbio", + "tier": "hard", + "path": "app/dbio/st_io_0013.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "st_io_0014", + "module": "st", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/st_io_0014.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "st_io_0015", + "module": "st", + "archetype": "dbio", + "tier": "hard", + "path": "app/dbio/st_io_0015.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "st_io_0016", + "module": "st", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/st_io_0016.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "st_io_0017", + "module": "st", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/st_io_0017.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "st_io_0018", + "module": "st", + "archetype": "dbio", + "tier": "medium", + "path": "app/dbio/st_io_0018.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "st_io_0019", + "module": "st", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/st_io_0019.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "st_io_0020", + "module": "st", + "archetype": "dbio", + "tier": "medium", + "path": "app/dbio/st_io_0020.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "st_io_0021", + "module": "st", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/st_io_0021.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "st_io_0022", + "module": "st", + "archetype": "dbio", + "tier": "medium", + "path": "app/dbio/st_io_0022.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "st_io_0023", + "module": "st", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/st_io_0023.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "st_io_0024", + "module": "st", + "archetype": "dbio", + "tier": "hard", + "path": "app/dbio/st_io_0024.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "st_io_0025", + "module": "st", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/st_io_0025.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "st_io_0026", + "module": "st", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/st_io_0026.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "vl_dbio_main", + "module": "vl", + "archetype": "dbio", + "tier": "medium", + "path": "app/dbio/vl_dbio_main.pgc", + "loc": 202, + "sqlCount": 20 + }, + { + "id": "vl_io_0001", + "module": "vl", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/vl_io_0001.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "vl_io_0002", + "module": "vl", + "archetype": "dbio", + "tier": "medium", + "path": "app/dbio/vl_io_0002.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "vl_io_0003", + "module": "vl", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/vl_io_0003.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "vl_io_0004", + "module": "vl", + "archetype": "dbio", + "tier": "hard", + "path": "app/dbio/vl_io_0004.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "vl_io_0005", + "module": "vl", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/vl_io_0005.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "vl_io_0006", + "module": "vl", + "archetype": "dbio", + "tier": "hard", + "path": "app/dbio/vl_io_0006.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "vl_io_0007", + "module": "vl", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/vl_io_0007.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "vl_io_0008", + "module": "vl", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/vl_io_0008.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "vl_io_0009", + "module": "vl", + "archetype": "dbio", + "tier": "medium", + "path": "app/dbio/vl_io_0009.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "vl_io_0010", + "module": "vl", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/vl_io_0010.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "vl_io_0011", + "module": "vl", + "archetype": "dbio", + "tier": "medium", + "path": "app/dbio/vl_io_0011.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "vl_io_0012", + "module": "vl", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/vl_io_0012.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "vl_io_0013", + "module": "vl", + "archetype": "dbio", + "tier": "medium", + "path": "app/dbio/vl_io_0013.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "vl_io_0014", + "module": "vl", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/vl_io_0014.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "vl_io_0015", + "module": "vl", + "archetype": "dbio", + "tier": "hard", + "path": "app/dbio/vl_io_0015.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "vl_io_0016", + "module": "vl", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/vl_io_0016.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "vl_io_0017", + "module": "vl", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/vl_io_0017.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "vl_io_0018", + "module": "vl", + "archetype": "dbio", + "tier": "medium", + "path": "app/dbio/vl_io_0018.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "vl_io_0019", + "module": "vl", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/vl_io_0019.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "vl_io_0020", + "module": "vl", + "archetype": "dbio", + "tier": "medium", + "path": "app/dbio/vl_io_0020.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "vl_io_0021", + "module": "vl", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/vl_io_0021.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "vl_io_0022", + "module": "vl", + "archetype": "dbio", + "tier": "medium", + "path": "app/dbio/vl_io_0022.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "vl_io_0023", + "module": "vl", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/vl_io_0023.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "vl_io_0024", + "module": "vl", + "archetype": "dbio", + "tier": "hard", + "path": "app/dbio/vl_io_0024.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "vl_io_0025", + "module": "vl", + "archetype": "dbio", + "tier": "easy", + "path": "app/dbio/vl_io_0025.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "vl_io_0026", + "module": "vl", + "archetype": "dbio", + "tier": "hard", + "path": "app/dbio/vl_io_0026.pgc", + "loc": 92, + "sqlCount": 10 + }, + { + "id": "ac_ol_0001", + "module": "ac", + "archetype": "online", + "tier": "easy", + "path": "app/online/ac_ol_0001.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "ac_ol_0002", + "module": "ac", + "archetype": "online", + "tier": "medium", + "path": "app/online/ac_ol_0002.pgc", + "loc": 70, + "sqlCount": 1 + }, + { + "id": "ac_ol_0003", + "module": "ac", + "archetype": "online", + "tier": "easy", + "path": "app/online/ac_ol_0003.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "ac_ol_0004", + "module": "ac", + "archetype": "online", + "tier": "medium", + "path": "app/online/ac_ol_0004.pgc", + "loc": 70, + "sqlCount": 1 + }, + { + "id": "ac_ol_0005", + "module": "ac", + "archetype": "online", + "tier": "easy", + "path": "app/online/ac_ol_0005.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "ac_ol_0006", + "module": "ac", + "archetype": "online", + "tier": "hard", + "path": "app/online/ac_ol_0006.pgc", + "loc": 98, + "sqlCount": 1 + }, + { + "id": "ac_ol_0007", + "module": "ac", + "archetype": "online", + "tier": "easy", + "path": "app/online/ac_ol_0007.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "ac_ol_0008", + "module": "ac", + "archetype": "online", + "tier": "hard", + "path": "app/online/ac_ol_0008.pgc", + "loc": 98, + "sqlCount": 1 + }, + { + "id": "ac_ol_0009", + "module": "ac", + "archetype": "online", + "tier": "easy", + "path": "app/online/ac_ol_0009.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "ac_ol_0010", + "module": "ac", + "archetype": "online", + "tier": "easy", + "path": "app/online/ac_ol_0010.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "ac_ol_0011", + "module": "ac", + "archetype": "online", + "tier": "medium", + "path": "app/online/ac_ol_0011.pgc", + "loc": 70, + "sqlCount": 1 + }, + { + "id": "ac_ol_0012", + "module": "ac", + "archetype": "online", + "tier": "easy", + "path": "app/online/ac_ol_0012.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "ac_ol_0013", + "module": "ac", + "archetype": "online", + "tier": "medium", + "path": "app/online/ac_ol_0013.pgc", + "loc": 70, + "sqlCount": 1 + }, + { + "id": "ac_ol_0014", + "module": "ac", + "archetype": "online", + "tier": "easy", + "path": "app/online/ac_ol_0014.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "ac_ol_0015", + "module": "ac", + "archetype": "online", + "tier": "medium", + "path": "app/online/ac_ol_0015.pgc", + "loc": 70, + "sqlCount": 1 + }, + { + "id": "ac_ol_0016", + "module": "ac", + "archetype": "online", + "tier": "easy", + "path": "app/online/ac_ol_0016.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "ac_ol_0017", + "module": "ac", + "archetype": "online", + "tier": "hard", + "path": "app/online/ac_ol_0017.pgc", + "loc": 98, + "sqlCount": 1 + }, + { + "id": "ac_ol_0018", + "module": "ac", + "archetype": "online", + "tier": "easy", + "path": "app/online/ac_ol_0018.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "ac_ol_0019", + "module": "ac", + "archetype": "online", + "tier": "easy", + "path": "app/online/ac_ol_0019.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "ac_ol_0020", + "module": "ac", + "archetype": "online", + "tier": "medium", + "path": "app/online/ac_ol_0020.pgc", + "loc": 70, + "sqlCount": 1 + }, + { + "id": "ac_ol_0021", + "module": "ac", + "archetype": "online", + "tier": "easy", + "path": "app/online/ac_ol_0021.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "ac_ol_0022", + "module": "ac", + "archetype": "online", + "tier": "medium", + "path": "app/online/ac_ol_0022.pgc", + "loc": 70, + "sqlCount": 1 + }, + { + "id": "ac_ol_0023", + "module": "ac", + "archetype": "online", + "tier": "easy", + "path": "app/online/ac_ol_0023.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "ac_ol_0024", + "module": "ac", + "archetype": "online", + "tier": "medium", + "path": "app/online/ac_ol_0024.pgc", + "loc": 70, + "sqlCount": 1 + }, + { + "id": "ac_ol_0025", + "module": "ac", + "archetype": "online", + "tier": "easy", + "path": "app/online/ac_ol_0025.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "ac_ol_0026", + "module": "ac", + "archetype": "online", + "tier": "hard", + "path": "app/online/ac_ol_0026.pgc", + "loc": 98, + "sqlCount": 1 + }, + { + "id": "ac_ol_0027", + "module": "ac", + "archetype": "online", + "tier": "easy", + "path": "app/online/ac_ol_0027.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "ac_ol_0028", + "module": "ac", + "archetype": "online", + "tier": "hard", + "path": "app/online/ac_ol_0028.pgc", + "loc": 98, + "sqlCount": 1 + }, + { + "id": "ac_ol_0029", + "module": "ac", + "archetype": "online", + "tier": "easy", + "path": "app/online/ac_ol_0029.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "ac_ol_0030", + "module": "ac", + "archetype": "online", + "tier": "easy", + "path": "app/online/ac_ol_0030.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "ac_ol_0031", + "module": "ac", + "archetype": "online", + "tier": "medium", + "path": "app/online/ac_ol_0031.pgc", + "loc": 70, + "sqlCount": 1 + }, + { + "id": "ac_ol_0032", + "module": "ac", + "archetype": "online", + "tier": "easy", + "path": "app/online/ac_ol_0032.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "au_ol_0001", + "module": "au", + "archetype": "online", + "tier": "easy", + "path": "app/online/au_ol_0001.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "au_ol_0002", + "module": "au", + "archetype": "online", + "tier": "medium", + "path": "app/online/au_ol_0002.pgc", + "loc": 70, + "sqlCount": 1 + }, + { + "id": "au_ol_0003", + "module": "au", + "archetype": "online", + "tier": "easy", + "path": "app/online/au_ol_0003.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "au_ol_0004", + "module": "au", + "archetype": "online", + "tier": "medium", + "path": "app/online/au_ol_0004.pgc", + "loc": 70, + "sqlCount": 1 + }, + { + "id": "au_ol_0005", + "module": "au", + "archetype": "online", + "tier": "easy", + "path": "app/online/au_ol_0005.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "au_ol_0006", + "module": "au", + "archetype": "online", + "tier": "medium", + "path": "app/online/au_ol_0006.pgc", + "loc": 70, + "sqlCount": 1 + }, + { + "id": "au_ol_0007", + "module": "au", + "archetype": "online", + "tier": "easy", + "path": "app/online/au_ol_0007.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "au_ol_0008", + "module": "au", + "archetype": "online", + "tier": "hard", + "path": "app/online/au_ol_0008.pgc", + "loc": 98, + "sqlCount": 1 + }, + { + "id": "au_ol_0009", + "module": "au", + "archetype": "online", + "tier": "easy", + "path": "app/online/au_ol_0009.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "au_ol_0010", + "module": "au", + "archetype": "online", + "tier": "easy", + "path": "app/online/au_ol_0010.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "au_ol_0011", + "module": "au", + "archetype": "online", + "tier": "medium", + "path": "app/online/au_ol_0011.pgc", + "loc": 70, + "sqlCount": 1 + }, + { + "id": "au_ol_0012", + "module": "au", + "archetype": "online", + "tier": "easy", + "path": "app/online/au_ol_0012.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "au_ol_0013", + "module": "au", + "archetype": "online", + "tier": "medium", + "path": "app/online/au_ol_0013.pgc", + "loc": 70, + "sqlCount": 1 + }, + { + "id": "au_ol_0014", + "module": "au", + "archetype": "online", + "tier": "easy", + "path": "app/online/au_ol_0014.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "au_ol_0015", + "module": "au", + "archetype": "online", + "tier": "medium", + "path": "app/online/au_ol_0015.pgc", + "loc": 70, + "sqlCount": 1 + }, + { + "id": "au_ol_0016", + "module": "au", + "archetype": "online", + "tier": "easy", + "path": "app/online/au_ol_0016.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "au_ol_0017", + "module": "au", + "archetype": "online", + "tier": "hard", + "path": "app/online/au_ol_0017.pgc", + "loc": 98, + "sqlCount": 1 + }, + { + "id": "au_ol_0018", + "module": "au", + "archetype": "online", + "tier": "easy", + "path": "app/online/au_ol_0018.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "au_ol_0019", + "module": "au", + "archetype": "online", + "tier": "hard", + "path": "app/online/au_ol_0019.pgc", + "loc": 98, + "sqlCount": 1 + }, + { + "id": "au_ol_0020", + "module": "au", + "archetype": "online", + "tier": "easy", + "path": "app/online/au_ol_0020.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "au_ol_0021", + "module": "au", + "archetype": "online", + "tier": "easy", + "path": "app/online/au_ol_0021.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "au_ol_0022", + "module": "au", + "archetype": "online", + "tier": "medium", + "path": "app/online/au_ol_0022.pgc", + "loc": 70, + "sqlCount": 1 + }, + { + "id": "au_ol_0023", + "module": "au", + "archetype": "online", + "tier": "easy", + "path": "app/online/au_ol_0023.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "au_ol_0024", + "module": "au", + "archetype": "online", + "tier": "medium", + "path": "app/online/au_ol_0024.pgc", + "loc": 70, + "sqlCount": 1 + }, + { + "id": "au_ol_0025", + "module": "au", + "archetype": "online", + "tier": "easy", + "path": "app/online/au_ol_0025.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "au_ol_0026", + "module": "au", + "archetype": "online", + "tier": "medium", + "path": "app/online/au_ol_0026.pgc", + "loc": 70, + "sqlCount": 1 + }, + { + "id": "au_ol_0027", + "module": "au", + "archetype": "online", + "tier": "easy", + "path": "app/online/au_ol_0027.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "au_ol_0028", + "module": "au", + "archetype": "online", + "tier": "hard", + "path": "app/online/au_ol_0028.pgc", + "loc": 98, + "sqlCount": 1 + }, + { + "id": "au_ol_0029", + "module": "au", + "archetype": "online", + "tier": "easy", + "path": "app/online/au_ol_0029.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "au_ol_0030", + "module": "au", + "archetype": "online", + "tier": "easy", + "path": "app/online/au_ol_0030.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "au_ol_0031", + "module": "au", + "archetype": "online", + "tier": "medium", + "path": "app/online/au_ol_0031.pgc", + "loc": 70, + "sqlCount": 1 + }, + { + "id": "au_ol_0032", + "module": "au", + "archetype": "online", + "tier": "easy", + "path": "app/online/au_ol_0032.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "cl_ol_0001", + "module": "cl", + "archetype": "online", + "tier": "easy", + "path": "app/online/cl_ol_0001.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "cl_ol_0002", + "module": "cl", + "archetype": "online", + "tier": "easy", + "path": "app/online/cl_ol_0002.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "cl_ol_0003", + "module": "cl", + "archetype": "online", + "tier": "medium", + "path": "app/online/cl_ol_0003.pgc", + "loc": 70, + "sqlCount": 1 + }, + { + "id": "cl_ol_0004", + "module": "cl", + "archetype": "online", + "tier": "easy", + "path": "app/online/cl_ol_0004.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "cl_ol_0005", + "module": "cl", + "archetype": "online", + "tier": "medium", + "path": "app/online/cl_ol_0005.pgc", + "loc": 70, + "sqlCount": 1 + }, + { + "id": "cl_ol_0006", + "module": "cl", + "archetype": "online", + "tier": "easy", + "path": "app/online/cl_ol_0006.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "cl_ol_0007", + "module": "cl", + "archetype": "online", + "tier": "medium", + "path": "app/online/cl_ol_0007.pgc", + "loc": 70, + "sqlCount": 1 + }, + { + "id": "cl_ol_0008", + "module": "cl", + "archetype": "online", + "tier": "easy", + "path": "app/online/cl_ol_0008.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "cl_ol_0009", + "module": "cl", + "archetype": "online", + "tier": "hard", + "path": "app/online/cl_ol_0009.pgc", + "loc": 98, + "sqlCount": 1 + }, + { + "id": "cl_ol_0010", + "module": "cl", + "archetype": "online", + "tier": "easy", + "path": "app/online/cl_ol_0010.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "cl_ol_0011", + "module": "cl", + "archetype": "online", + "tier": "easy", + "path": "app/online/cl_ol_0011.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "cl_ol_0012", + "module": "cl", + "archetype": "online", + "tier": "medium", + "path": "app/online/cl_ol_0012.pgc", + "loc": 70, + "sqlCount": 1 + }, + { + "id": "cl_ol_0013", + "module": "cl", + "archetype": "online", + "tier": "easy", + "path": "app/online/cl_ol_0013.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "cl_ol_0014", + "module": "cl", + "archetype": "online", + "tier": "medium", + "path": "app/online/cl_ol_0014.pgc", + "loc": 70, + "sqlCount": 1 + }, + { + "id": "cl_ol_0015", + "module": "cl", + "archetype": "online", + "tier": "easy", + "path": "app/online/cl_ol_0015.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "cl_ol_0016", + "module": "cl", + "archetype": "online", + "tier": "medium", + "path": "app/online/cl_ol_0016.pgc", + "loc": 70, + "sqlCount": 1 + }, + { + "id": "cl_ol_0017", + "module": "cl", + "archetype": "online", + "tier": "easy", + "path": "app/online/cl_ol_0017.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "cl_ol_0018", + "module": "cl", + "archetype": "online", + "tier": "hard", + "path": "app/online/cl_ol_0018.pgc", + "loc": 98, + "sqlCount": 1 + }, + { + "id": "cl_ol_0019", + "module": "cl", + "archetype": "online", + "tier": "easy", + "path": "app/online/cl_ol_0019.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "cl_ol_0020", + "module": "cl", + "archetype": "online", + "tier": "hard", + "path": "app/online/cl_ol_0020.pgc", + "loc": 98, + "sqlCount": 1 + }, + { + "id": "cl_ol_0021", + "module": "cl", + "archetype": "online", + "tier": "easy", + "path": "app/online/cl_ol_0021.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "cl_ol_0022", + "module": "cl", + "archetype": "online", + "tier": "easy", + "path": "app/online/cl_ol_0022.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "cl_ol_0023", + "module": "cl", + "archetype": "online", + "tier": "medium", + "path": "app/online/cl_ol_0023.pgc", + "loc": 70, + "sqlCount": 1 + }, + { + "id": "cl_ol_0024", + "module": "cl", + "archetype": "online", + "tier": "easy", + "path": "app/online/cl_ol_0024.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "cl_ol_0025", + "module": "cl", + "archetype": "online", + "tier": "medium", + "path": "app/online/cl_ol_0025.pgc", + "loc": 70, + "sqlCount": 1 + }, + { + "id": "cl_ol_0026", + "module": "cl", + "archetype": "online", + "tier": "easy", + "path": "app/online/cl_ol_0026.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "cl_ol_0027", + "module": "cl", + "archetype": "online", + "tier": "medium", + "path": "app/online/cl_ol_0027.pgc", + "loc": 70, + "sqlCount": 1 + }, + { + "id": "cl_ol_0028", + "module": "cl", + "archetype": "online", + "tier": "easy", + "path": "app/online/cl_ol_0028.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "cl_ol_0029", + "module": "cl", + "archetype": "online", + "tier": "hard", + "path": "app/online/cl_ol_0029.pgc", + "loc": 98, + "sqlCount": 1 + }, + { + "id": "cl_ol_0030", + "module": "cl", + "archetype": "online", + "tier": "easy", + "path": "app/online/cl_ol_0030.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "cl_ol_0031", + "module": "cl", + "archetype": "online", + "tier": "easy", + "path": "app/online/cl_ol_0031.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "cm_ol_0001", + "module": "cm", + "archetype": "online", + "tier": "easy", + "path": "app/online/cm_ol_0001.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "cm_ol_0002", + "module": "cm", + "archetype": "online", + "tier": "easy", + "path": "app/online/cm_ol_0002.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "cm_ol_0003", + "module": "cm", + "archetype": "online", + "tier": "medium", + "path": "app/online/cm_ol_0003.pgc", + "loc": 70, + "sqlCount": 1 + }, + { + "id": "cm_ol_0004", + "module": "cm", + "archetype": "online", + "tier": "easy", + "path": "app/online/cm_ol_0004.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "cm_ol_0005", + "module": "cm", + "archetype": "online", + "tier": "medium", + "path": "app/online/cm_ol_0005.pgc", + "loc": 70, + "sqlCount": 1 + }, + { + "id": "cm_ol_0006", + "module": "cm", + "archetype": "online", + "tier": "easy", + "path": "app/online/cm_ol_0006.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "cm_ol_0007", + "module": "cm", + "archetype": "online", + "tier": "medium", + "path": "app/online/cm_ol_0007.pgc", + "loc": 70, + "sqlCount": 1 + }, + { + "id": "cm_ol_0008", + "module": "cm", + "archetype": "online", + "tier": "easy", + "path": "app/online/cm_ol_0008.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "cm_ol_0009", + "module": "cm", + "archetype": "online", + "tier": "hard", + "path": "app/online/cm_ol_0009.pgc", + "loc": 98, + "sqlCount": 1 + }, + { + "id": "cm_ol_0010", + "module": "cm", + "archetype": "online", + "tier": "easy", + "path": "app/online/cm_ol_0010.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "cm_ol_0011", + "module": "cm", + "archetype": "online", + "tier": "hard", + "path": "app/online/cm_ol_0011.pgc", + "loc": 98, + "sqlCount": 1 + }, + { + "id": "cm_ol_0012", + "module": "cm", + "archetype": "online", + "tier": "easy", + "path": "app/online/cm_ol_0012.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "cm_ol_0013", + "module": "cm", + "archetype": "online", + "tier": "easy", + "path": "app/online/cm_ol_0013.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "cm_ol_0014", + "module": "cm", + "archetype": "online", + "tier": "medium", + "path": "app/online/cm_ol_0014.pgc", + "loc": 70, + "sqlCount": 1 + }, + { + "id": "cm_ol_0015", + "module": "cm", + "archetype": "online", + "tier": "easy", + "path": "app/online/cm_ol_0015.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "cm_ol_0016", + "module": "cm", + "archetype": "online", + "tier": "medium", + "path": "app/online/cm_ol_0016.pgc", + "loc": 70, + "sqlCount": 1 + }, + { + "id": "cm_ol_0017", + "module": "cm", + "archetype": "online", + "tier": "easy", + "path": "app/online/cm_ol_0017.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "cm_ol_0018", + "module": "cm", + "archetype": "online", + "tier": "medium", + "path": "app/online/cm_ol_0018.pgc", + "loc": 70, + "sqlCount": 1 + }, + { + "id": "cm_ol_0019", + "module": "cm", + "archetype": "online", + "tier": "easy", + "path": "app/online/cm_ol_0019.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "cm_ol_0020", + "module": "cm", + "archetype": "online", + "tier": "hard", + "path": "app/online/cm_ol_0020.pgc", + "loc": 98, + "sqlCount": 1 + }, + { + "id": "cm_ol_0021", + "module": "cm", + "archetype": "online", + "tier": "easy", + "path": "app/online/cm_ol_0021.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "cm_ol_0022", + "module": "cm", + "archetype": "online", + "tier": "easy", + "path": "app/online/cm_ol_0022.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "cm_ol_0023", + "module": "cm", + "archetype": "online", + "tier": "medium", + "path": "app/online/cm_ol_0023.pgc", + "loc": 70, + "sqlCount": 1 + }, + { + "id": "cm_ol_0024", + "module": "cm", + "archetype": "online", + "tier": "easy", + "path": "app/online/cm_ol_0024.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "cm_ol_0025", + "module": "cm", + "archetype": "online", + "tier": "medium", + "path": "app/online/cm_ol_0025.pgc", + "loc": 70, + "sqlCount": 1 + }, + { + "id": "cm_ol_0026", + "module": "cm", + "archetype": "online", + "tier": "easy", + "path": "app/online/cm_ol_0026.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "cm_ol_0027", + "module": "cm", + "archetype": "online", + "tier": "medium", + "path": "app/online/cm_ol_0027.pgc", + "loc": 70, + "sqlCount": 1 + }, + { + "id": "cm_ol_0028", + "module": "cm", + "archetype": "online", + "tier": "easy", + "path": "app/online/cm_ol_0028.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "cm_ol_0029", + "module": "cm", + "archetype": "online", + "tier": "hard", + "path": "app/online/cm_ol_0029.pgc", + "loc": 98, + "sqlCount": 1 + }, + { + "id": "cm_ol_0030", + "module": "cm", + "archetype": "online", + "tier": "easy", + "path": "app/online/cm_ol_0030.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "cm_ol_0031", + "module": "cm", + "archetype": "online", + "tier": "hard", + "path": "app/online/cm_ol_0031.pgc", + "loc": 98, + "sqlCount": 1 + }, + { + "id": "lg_ol_0001", + "module": "lg", + "archetype": "online", + "tier": "easy", + "path": "app/online/lg_ol_0001.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "lg_ol_0002", + "module": "lg", + "archetype": "online", + "tier": "hard", + "path": "app/online/lg_ol_0002.pgc", + "loc": 98, + "sqlCount": 1 + }, + { + "id": "lg_ol_0003", + "module": "lg", + "archetype": "online", + "tier": "easy", + "path": "app/online/lg_ol_0003.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "lg_ol_0004", + "module": "lg", + "archetype": "online", + "tier": "easy", + "path": "app/online/lg_ol_0004.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "lg_ol_0005", + "module": "lg", + "archetype": "online", + "tier": "medium", + "path": "app/online/lg_ol_0005.pgc", + "loc": 70, + "sqlCount": 1 + }, + { + "id": "lg_ol_0006", + "module": "lg", + "archetype": "online", + "tier": "easy", + "path": "app/online/lg_ol_0006.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "lg_ol_0007", + "module": "lg", + "archetype": "online", + "tier": "medium", + "path": "app/online/lg_ol_0007.pgc", + "loc": 70, + "sqlCount": 1 + }, + { + "id": "lg_ol_0008", + "module": "lg", + "archetype": "online", + "tier": "easy", + "path": "app/online/lg_ol_0008.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "lg_ol_0009", + "module": "lg", + "archetype": "online", + "tier": "medium", + "path": "app/online/lg_ol_0009.pgc", + "loc": 70, + "sqlCount": 1 + }, + { + "id": "lg_ol_0010", + "module": "lg", + "archetype": "online", + "tier": "easy", + "path": "app/online/lg_ol_0010.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "lg_ol_0011", + "module": "lg", + "archetype": "online", + "tier": "hard", + "path": "app/online/lg_ol_0011.pgc", + "loc": 98, + "sqlCount": 1 + }, + { + "id": "lg_ol_0012", + "module": "lg", + "archetype": "online", + "tier": "easy", + "path": "app/online/lg_ol_0012.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "lg_ol_0013", + "module": "lg", + "archetype": "online", + "tier": "hard", + "path": "app/online/lg_ol_0013.pgc", + "loc": 98, + "sqlCount": 1 + }, + { + "id": "lg_ol_0014", + "module": "lg", + "archetype": "online", + "tier": "easy", + "path": "app/online/lg_ol_0014.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "lg_ol_0015", + "module": "lg", + "archetype": "online", + "tier": "easy", + "path": "app/online/lg_ol_0015.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "lg_ol_0016", + "module": "lg", + "archetype": "online", + "tier": "medium", + "path": "app/online/lg_ol_0016.pgc", + "loc": 70, + "sqlCount": 1 + }, + { + "id": "lg_ol_0017", + "module": "lg", + "archetype": "online", + "tier": "easy", + "path": "app/online/lg_ol_0017.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "lg_ol_0018", + "module": "lg", + "archetype": "online", + "tier": "medium", + "path": "app/online/lg_ol_0018.pgc", + "loc": 70, + "sqlCount": 1 + }, + { + "id": "lg_ol_0019", + "module": "lg", + "archetype": "online", + "tier": "easy", + "path": "app/online/lg_ol_0019.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "lg_ol_0020", + "module": "lg", + "archetype": "online", + "tier": "medium", + "path": "app/online/lg_ol_0020.pgc", + "loc": 70, + "sqlCount": 1 + }, + { + "id": "lg_ol_0021", + "module": "lg", + "archetype": "online", + "tier": "easy", + "path": "app/online/lg_ol_0021.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "lg_ol_0022", + "module": "lg", + "archetype": "online", + "tier": "hard", + "path": "app/online/lg_ol_0022.pgc", + "loc": 98, + "sqlCount": 1 + }, + { + "id": "lg_ol_0023", + "module": "lg", + "archetype": "online", + "tier": "easy", + "path": "app/online/lg_ol_0023.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "lg_ol_0024", + "module": "lg", + "archetype": "online", + "tier": "easy", + "path": "app/online/lg_ol_0024.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "lg_ol_0025", + "module": "lg", + "archetype": "online", + "tier": "medium", + "path": "app/online/lg_ol_0025.pgc", + "loc": 70, + "sqlCount": 1 + }, + { + "id": "lg_ol_0026", + "module": "lg", + "archetype": "online", + "tier": "easy", + "path": "app/online/lg_ol_0026.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "lg_ol_0027", + "module": "lg", + "archetype": "online", + "tier": "medium", + "path": "app/online/lg_ol_0027.pgc", + "loc": 70, + "sqlCount": 1 + }, + { + "id": "lg_ol_0028", + "module": "lg", + "archetype": "online", + "tier": "easy", + "path": "app/online/lg_ol_0028.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "lg_ol_0029", + "module": "lg", + "archetype": "online", + "tier": "medium", + "path": "app/online/lg_ol_0029.pgc", + "loc": 70, + "sqlCount": 1 + }, + { + "id": "lg_ol_0030", + "module": "lg", + "archetype": "online", + "tier": "easy", + "path": "app/online/lg_ol_0030.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "lg_ol_0031", + "module": "lg", + "archetype": "online", + "tier": "hard", + "path": "app/online/lg_ol_0031.pgc", + "loc": 98, + "sqlCount": 1 + }, + { + "id": "lg_ol_0032", + "module": "lg", + "archetype": "online", + "tier": "easy", + "path": "app/online/lg_ol_0032.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "mg_ol_0001", + "module": "mg", + "archetype": "online", + "tier": "easy", + "path": "app/online/mg_ol_0001.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "mg_ol_0002", + "module": "mg", + "archetype": "online", + "tier": "medium", + "path": "app/online/mg_ol_0002.pgc", + "loc": 70, + "sqlCount": 1 + }, + { + "id": "mg_ol_0003", + "module": "mg", + "archetype": "online", + "tier": "easy", + "path": "app/online/mg_ol_0003.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "mg_ol_0004", + "module": "mg", + "archetype": "online", + "tier": "medium", + "path": "app/online/mg_ol_0004.pgc", + "loc": 70, + "sqlCount": 1 + }, + { + "id": "mg_ol_0005", + "module": "mg", + "archetype": "online", + "tier": "easy", + "path": "app/online/mg_ol_0005.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "mg_ol_0006", + "module": "mg", + "archetype": "online", + "tier": "medium", + "path": "app/online/mg_ol_0006.pgc", + "loc": 70, + "sqlCount": 1 + }, + { + "id": "mg_ol_0007", + "module": "mg", + "archetype": "online", + "tier": "easy", + "path": "app/online/mg_ol_0007.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "mg_ol_0008", + "module": "mg", + "archetype": "online", + "tier": "hard", + "path": "app/online/mg_ol_0008.pgc", + "loc": 98, + "sqlCount": 1 + }, + { + "id": "mg_ol_0009", + "module": "mg", + "archetype": "online", + "tier": "easy", + "path": "app/online/mg_ol_0009.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "mg_ol_0010", + "module": "mg", + "archetype": "online", + "tier": "hard", + "path": "app/online/mg_ol_0010.pgc", + "loc": 98, + "sqlCount": 1 + }, + { + "id": "mg_ol_0011", + "module": "mg", + "archetype": "online", + "tier": "easy", + "path": "app/online/mg_ol_0011.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "mg_ol_0012", + "module": "mg", + "archetype": "online", + "tier": "easy", + "path": "app/online/mg_ol_0012.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "mg_ol_0013", + "module": "mg", + "archetype": "online", + "tier": "medium", + "path": "app/online/mg_ol_0013.pgc", + "loc": 70, + "sqlCount": 1 + }, + { + "id": "mg_ol_0014", + "module": "mg", + "archetype": "online", + "tier": "easy", + "path": "app/online/mg_ol_0014.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "mg_ol_0015", + "module": "mg", + "archetype": "online", + "tier": "medium", + "path": "app/online/mg_ol_0015.pgc", + "loc": 70, + "sqlCount": 1 + }, + { + "id": "mg_ol_0016", + "module": "mg", + "archetype": "online", + "tier": "easy", + "path": "app/online/mg_ol_0016.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "mg_ol_0017", + "module": "mg", + "archetype": "online", + "tier": "medium", + "path": "app/online/mg_ol_0017.pgc", + "loc": 70, + "sqlCount": 1 + }, + { + "id": "mg_ol_0018", + "module": "mg", + "archetype": "online", + "tier": "easy", + "path": "app/online/mg_ol_0018.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "mg_ol_0019", + "module": "mg", + "archetype": "online", + "tier": "hard", + "path": "app/online/mg_ol_0019.pgc", + "loc": 98, + "sqlCount": 1 + }, + { + "id": "mg_ol_0020", + "module": "mg", + "archetype": "online", + "tier": "easy", + "path": "app/online/mg_ol_0020.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "mg_ol_0021", + "module": "mg", + "archetype": "online", + "tier": "easy", + "path": "app/online/mg_ol_0021.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "mg_ol_0022", + "module": "mg", + "archetype": "online", + "tier": "medium", + "path": "app/online/mg_ol_0022.pgc", + "loc": 70, + "sqlCount": 1 + }, + { + "id": "mg_ol_0023", + "module": "mg", + "archetype": "online", + "tier": "easy", + "path": "app/online/mg_ol_0023.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "mg_ol_0024", + "module": "mg", + "archetype": "online", + "tier": "medium", + "path": "app/online/mg_ol_0024.pgc", + "loc": 70, + "sqlCount": 1 + }, + { + "id": "mg_ol_0025", + "module": "mg", + "archetype": "online", + "tier": "easy", + "path": "app/online/mg_ol_0025.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "mg_ol_0026", + "module": "mg", + "archetype": "online", + "tier": "medium", + "path": "app/online/mg_ol_0026.pgc", + "loc": 70, + "sqlCount": 1 + }, + { + "id": "mg_ol_0027", + "module": "mg", + "archetype": "online", + "tier": "easy", + "path": "app/online/mg_ol_0027.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "mg_ol_0028", + "module": "mg", + "archetype": "online", + "tier": "hard", + "path": "app/online/mg_ol_0028.pgc", + "loc": 98, + "sqlCount": 1 + }, + { + "id": "mg_ol_0029", + "module": "mg", + "archetype": "online", + "tier": "easy", + "path": "app/online/mg_ol_0029.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "mg_ol_0030", + "module": "mg", + "archetype": "online", + "tier": "hard", + "path": "app/online/mg_ol_0030.pgc", + "loc": 98, + "sqlCount": 1 + }, + { + "id": "mg_ol_0031", + "module": "mg", + "archetype": "online", + "tier": "easy", + "path": "app/online/mg_ol_0031.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "mg_ol_0032", + "module": "mg", + "archetype": "online", + "tier": "easy", + "path": "app/online/mg_ol_0032.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "mm_ol_0001", + "module": "mm", + "archetype": "online", + "tier": "easy", + "path": "app/online/mm_ol_0001.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "mm_ol_0002", + "module": "mm", + "archetype": "online", + "tier": "hard", + "path": "app/online/mm_ol_0002.pgc", + "loc": 98, + "sqlCount": 1 + }, + { + "id": "mm_ol_0003", + "module": "mm", + "archetype": "online", + "tier": "easy", + "path": "app/online/mm_ol_0003.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "mm_ol_0004", + "module": "mm", + "archetype": "online", + "tier": "easy", + "path": "app/online/mm_ol_0004.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "mm_ol_0005", + "module": "mm", + "archetype": "online", + "tier": "medium", + "path": "app/online/mm_ol_0005.pgc", + "loc": 70, + "sqlCount": 1 + }, + { + "id": "mm_ol_0006", + "module": "mm", + "archetype": "online", + "tier": "easy", + "path": "app/online/mm_ol_0006.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "mm_ol_0007", + "module": "mm", + "archetype": "online", + "tier": "medium", + "path": "app/online/mm_ol_0007.pgc", + "loc": 70, + "sqlCount": 1 + }, + { + "id": "mm_ol_0008", + "module": "mm", + "archetype": "online", + "tier": "easy", + "path": "app/online/mm_ol_0008.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "mm_ol_0009", + "module": "mm", + "archetype": "online", + "tier": "medium", + "path": "app/online/mm_ol_0009.pgc", + "loc": 70, + "sqlCount": 1 + }, + { + "id": "mm_ol_0010", + "module": "mm", + "archetype": "online", + "tier": "easy", + "path": "app/online/mm_ol_0010.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "mm_ol_0011", + "module": "mm", + "archetype": "online", + "tier": "hard", + "path": "app/online/mm_ol_0011.pgc", + "loc": 98, + "sqlCount": 1 + }, + { + "id": "mm_ol_0012", + "module": "mm", + "archetype": "online", + "tier": "easy", + "path": "app/online/mm_ol_0012.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "mm_ol_0013", + "module": "mm", + "archetype": "online", + "tier": "easy", + "path": "app/online/mm_ol_0013.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "mm_ol_0014", + "module": "mm", + "archetype": "online", + "tier": "medium", + "path": "app/online/mm_ol_0014.pgc", + "loc": 70, + "sqlCount": 1 + }, + { + "id": "mm_ol_0015", + "module": "mm", + "archetype": "online", + "tier": "easy", + "path": "app/online/mm_ol_0015.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "mm_ol_0016", + "module": "mm", + "archetype": "online", + "tier": "medium", + "path": "app/online/mm_ol_0016.pgc", + "loc": 70, + "sqlCount": 1 + }, + { + "id": "mm_ol_0017", + "module": "mm", + "archetype": "online", + "tier": "easy", + "path": "app/online/mm_ol_0017.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "mm_ol_0018", + "module": "mm", + "archetype": "online", + "tier": "medium", + "path": "app/online/mm_ol_0018.pgc", + "loc": 70, + "sqlCount": 1 + }, + { + "id": "mm_ol_0019", + "module": "mm", + "archetype": "online", + "tier": "easy", + "path": "app/online/mm_ol_0019.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "mm_ol_0020", + "module": "mm", + "archetype": "online", + "tier": "hard", + "path": "app/online/mm_ol_0020.pgc", + "loc": 98, + "sqlCount": 1 + }, + { + "id": "mm_ol_0021", + "module": "mm", + "archetype": "online", + "tier": "easy", + "path": "app/online/mm_ol_0021.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "mm_ol_0022", + "module": "mm", + "archetype": "online", + "tier": "hard", + "path": "app/online/mm_ol_0022.pgc", + "loc": 98, + "sqlCount": 1 + }, + { + "id": "mm_ol_0023", + "module": "mm", + "archetype": "online", + "tier": "easy", + "path": "app/online/mm_ol_0023.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "mm_ol_0024", + "module": "mm", + "archetype": "online", + "tier": "easy", + "path": "app/online/mm_ol_0024.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "mm_ol_0025", + "module": "mm", + "archetype": "online", + "tier": "medium", + "path": "app/online/mm_ol_0025.pgc", + "loc": 70, + "sqlCount": 1 + }, + { + "id": "mm_ol_0026", + "module": "mm", + "archetype": "online", + "tier": "easy", + "path": "app/online/mm_ol_0026.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "mm_ol_0027", + "module": "mm", + "archetype": "online", + "tier": "medium", + "path": "app/online/mm_ol_0027.pgc", + "loc": 70, + "sqlCount": 1 + }, + { + "id": "mm_ol_0028", + "module": "mm", + "archetype": "online", + "tier": "easy", + "path": "app/online/mm_ol_0028.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "mm_ol_0029", + "module": "mm", + "archetype": "online", + "tier": "medium", + "path": "app/online/mm_ol_0029.pgc", + "loc": 70, + "sqlCount": 1 + }, + { + "id": "mm_ol_0030", + "module": "mm", + "archetype": "online", + "tier": "easy", + "path": "app/online/mm_ol_0030.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "mm_ol_0031", + "module": "mm", + "archetype": "online", + "tier": "hard", + "path": "app/online/mm_ol_0031.pgc", + "loc": 98, + "sqlCount": 1 + }, + { + "id": "mm_ol_0032", + "module": "mm", + "archetype": "online", + "tier": "easy", + "path": "app/online/mm_ol_0032.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "py_ol_0001", + "module": "py", + "archetype": "online", + "tier": "easy", + "path": "app/online/py_ol_0001.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "py_ol_0002", + "module": "py", + "archetype": "online", + "tier": "hard", + "path": "app/online/py_ol_0002.pgc", + "loc": 98, + "sqlCount": 1 + }, + { + "id": "py_ol_0003", + "module": "py", + "archetype": "online", + "tier": "easy", + "path": "app/online/py_ol_0003.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "py_ol_0004", + "module": "py", + "archetype": "online", + "tier": "hard", + "path": "app/online/py_ol_0004.pgc", + "loc": 98, + "sqlCount": 1 + }, + { + "id": "py_ol_0005", + "module": "py", + "archetype": "online", + "tier": "easy", + "path": "app/online/py_ol_0005.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "py_ol_0006", + "module": "py", + "archetype": "online", + "tier": "easy", + "path": "app/online/py_ol_0006.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "py_ol_0007", + "module": "py", + "archetype": "online", + "tier": "medium", + "path": "app/online/py_ol_0007.pgc", + "loc": 70, + "sqlCount": 1 + }, + { + "id": "py_ol_0008", + "module": "py", + "archetype": "online", + "tier": "easy", + "path": "app/online/py_ol_0008.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "py_ol_0009", + "module": "py", + "archetype": "online", + "tier": "medium", + "path": "app/online/py_ol_0009.pgc", + "loc": 70, + "sqlCount": 1 + }, + { + "id": "py_ol_0010", + "module": "py", + "archetype": "online", + "tier": "easy", + "path": "app/online/py_ol_0010.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "py_ol_0011", + "module": "py", + "archetype": "online", + "tier": "medium", + "path": "app/online/py_ol_0011.pgc", + "loc": 70, + "sqlCount": 1 + }, + { + "id": "py_ol_0012", + "module": "py", + "archetype": "online", + "tier": "easy", + "path": "app/online/py_ol_0012.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "py_ol_0013", + "module": "py", + "archetype": "online", + "tier": "hard", + "path": "app/online/py_ol_0013.pgc", + "loc": 98, + "sqlCount": 1 + }, + { + "id": "py_ol_0014", + "module": "py", + "archetype": "online", + "tier": "easy", + "path": "app/online/py_ol_0014.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "py_ol_0015", + "module": "py", + "archetype": "online", + "tier": "easy", + "path": "app/online/py_ol_0015.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "py_ol_0016", + "module": "py", + "archetype": "online", + "tier": "medium", + "path": "app/online/py_ol_0016.pgc", + "loc": 70, + "sqlCount": 1 + }, + { + "id": "py_ol_0017", + "module": "py", + "archetype": "online", + "tier": "easy", + "path": "app/online/py_ol_0017.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "py_ol_0018", + "module": "py", + "archetype": "online", + "tier": "medium", + "path": "app/online/py_ol_0018.pgc", + "loc": 70, + "sqlCount": 1 + }, + { + "id": "py_ol_0019", + "module": "py", + "archetype": "online", + "tier": "easy", + "path": "app/online/py_ol_0019.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "py_ol_0020", + "module": "py", + "archetype": "online", + "tier": "medium", + "path": "app/online/py_ol_0020.pgc", + "loc": 70, + "sqlCount": 1 + }, + { + "id": "py_ol_0021", + "module": "py", + "archetype": "online", + "tier": "easy", + "path": "app/online/py_ol_0021.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "py_ol_0022", + "module": "py", + "archetype": "online", + "tier": "hard", + "path": "app/online/py_ol_0022.pgc", + "loc": 98, + "sqlCount": 1 + }, + { + "id": "py_ol_0023", + "module": "py", + "archetype": "online", + "tier": "easy", + "path": "app/online/py_ol_0023.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "py_ol_0024", + "module": "py", + "archetype": "online", + "tier": "hard", + "path": "app/online/py_ol_0024.pgc", + "loc": 98, + "sqlCount": 1 + }, + { + "id": "py_ol_0025", + "module": "py", + "archetype": "online", + "tier": "easy", + "path": "app/online/py_ol_0025.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "py_ol_0026", + "module": "py", + "archetype": "online", + "tier": "easy", + "path": "app/online/py_ol_0026.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "py_ol_0027", + "module": "py", + "archetype": "online", + "tier": "medium", + "path": "app/online/py_ol_0027.pgc", + "loc": 70, + "sqlCount": 1 + }, + { + "id": "py_ol_0028", + "module": "py", + "archetype": "online", + "tier": "easy", + "path": "app/online/py_ol_0028.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "py_ol_0029", + "module": "py", + "archetype": "online", + "tier": "medium", + "path": "app/online/py_ol_0029.pgc", + "loc": 70, + "sqlCount": 1 + }, + { + "id": "py_ol_0030", + "module": "py", + "archetype": "online", + "tier": "easy", + "path": "app/online/py_ol_0030.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "py_ol_0031", + "module": "py", + "archetype": "online", + "tier": "medium", + "path": "app/online/py_ol_0031.pgc", + "loc": 70, + "sqlCount": 1 + }, + { + "id": "py_ol_0032", + "module": "py", + "archetype": "online", + "tier": "easy", + "path": "app/online/py_ol_0032.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "rc_ol_0001", + "module": "rc", + "archetype": "online", + "tier": "easy", + "path": "app/online/rc_ol_0001.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "rc_ol_0002", + "module": "rc", + "archetype": "online", + "tier": "medium", + "path": "app/online/rc_ol_0002.pgc", + "loc": 70, + "sqlCount": 1 + }, + { + "id": "rc_ol_0003", + "module": "rc", + "archetype": "online", + "tier": "easy", + "path": "app/online/rc_ol_0003.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "rc_ol_0004", + "module": "rc", + "archetype": "online", + "tier": "medium", + "path": "app/online/rc_ol_0004.pgc", + "loc": 70, + "sqlCount": 1 + }, + { + "id": "rc_ol_0005", + "module": "rc", + "archetype": "online", + "tier": "easy", + "path": "app/online/rc_ol_0005.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "rc_ol_0006", + "module": "rc", + "archetype": "online", + "tier": "hard", + "path": "app/online/rc_ol_0006.pgc", + "loc": 98, + "sqlCount": 1 + }, + { + "id": "rc_ol_0007", + "module": "rc", + "archetype": "online", + "tier": "easy", + "path": "app/online/rc_ol_0007.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "rc_ol_0008", + "module": "rc", + "archetype": "online", + "tier": "easy", + "path": "app/online/rc_ol_0008.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "rc_ol_0009", + "module": "rc", + "archetype": "online", + "tier": "medium", + "path": "app/online/rc_ol_0009.pgc", + "loc": 70, + "sqlCount": 1 + }, + { + "id": "rc_ol_0010", + "module": "rc", + "archetype": "online", + "tier": "easy", + "path": "app/online/rc_ol_0010.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "rc_ol_0011", + "module": "rc", + "archetype": "online", + "tier": "medium", + "path": "app/online/rc_ol_0011.pgc", + "loc": 70, + "sqlCount": 1 + }, + { + "id": "rc_ol_0012", + "module": "rc", + "archetype": "online", + "tier": "easy", + "path": "app/online/rc_ol_0012.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "rc_ol_0013", + "module": "rc", + "archetype": "online", + "tier": "medium", + "path": "app/online/rc_ol_0013.pgc", + "loc": 70, + "sqlCount": 1 + }, + { + "id": "rc_ol_0014", + "module": "rc", + "archetype": "online", + "tier": "easy", + "path": "app/online/rc_ol_0014.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "rc_ol_0015", + "module": "rc", + "archetype": "online", + "tier": "hard", + "path": "app/online/rc_ol_0015.pgc", + "loc": 98, + "sqlCount": 1 + }, + { + "id": "rc_ol_0016", + "module": "rc", + "archetype": "online", + "tier": "easy", + "path": "app/online/rc_ol_0016.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "rc_ol_0017", + "module": "rc", + "archetype": "online", + "tier": "hard", + "path": "app/online/rc_ol_0017.pgc", + "loc": 98, + "sqlCount": 1 + }, + { + "id": "rc_ol_0018", + "module": "rc", + "archetype": "online", + "tier": "easy", + "path": "app/online/rc_ol_0018.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "rc_ol_0019", + "module": "rc", + "archetype": "online", + "tier": "easy", + "path": "app/online/rc_ol_0019.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "rc_ol_0020", + "module": "rc", + "archetype": "online", + "tier": "medium", + "path": "app/online/rc_ol_0020.pgc", + "loc": 70, + "sqlCount": 1 + }, + { + "id": "rc_ol_0021", + "module": "rc", + "archetype": "online", + "tier": "easy", + "path": "app/online/rc_ol_0021.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "rc_ol_0022", + "module": "rc", + "archetype": "online", + "tier": "medium", + "path": "app/online/rc_ol_0022.pgc", + "loc": 70, + "sqlCount": 1 + }, + { + "id": "rc_ol_0023", + "module": "rc", + "archetype": "online", + "tier": "easy", + "path": "app/online/rc_ol_0023.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "rc_ol_0024", + "module": "rc", + "archetype": "online", + "tier": "medium", + "path": "app/online/rc_ol_0024.pgc", + "loc": 70, + "sqlCount": 1 + }, + { + "id": "rc_ol_0025", + "module": "rc", + "archetype": "online", + "tier": "easy", + "path": "app/online/rc_ol_0025.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "rc_ol_0026", + "module": "rc", + "archetype": "online", + "tier": "hard", + "path": "app/online/rc_ol_0026.pgc", + "loc": 98, + "sqlCount": 1 + }, + { + "id": "rc_ol_0027", + "module": "rc", + "archetype": "online", + "tier": "easy", + "path": "app/online/rc_ol_0027.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "rc_ol_0028", + "module": "rc", + "archetype": "online", + "tier": "easy", + "path": "app/online/rc_ol_0028.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "rc_ol_0029", + "module": "rc", + "archetype": "online", + "tier": "medium", + "path": "app/online/rc_ol_0029.pgc", + "loc": 70, + "sqlCount": 1 + }, + { + "id": "rc_ol_0030", + "module": "rc", + "archetype": "online", + "tier": "easy", + "path": "app/online/rc_ol_0030.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "rc_ol_0031", + "module": "rc", + "archetype": "online", + "tier": "medium", + "path": "app/online/rc_ol_0031.pgc", + "loc": 70, + "sqlCount": 1 + }, + { + "id": "rc_ol_0032", + "module": "rc", + "archetype": "online", + "tier": "easy", + "path": "app/online/rc_ol_0032.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "st_ol_0001", + "module": "st", + "archetype": "online", + "tier": "easy", + "path": "app/online/st_ol_0001.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "st_ol_0002", + "module": "st", + "archetype": "online", + "tier": "medium", + "path": "app/online/st_ol_0002.pgc", + "loc": 70, + "sqlCount": 1 + }, + { + "id": "st_ol_0003", + "module": "st", + "archetype": "online", + "tier": "easy", + "path": "app/online/st_ol_0003.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "st_ol_0004", + "module": "st", + "archetype": "online", + "tier": "hard", + "path": "app/online/st_ol_0004.pgc", + "loc": 98, + "sqlCount": 1 + }, + { + "id": "st_ol_0005", + "module": "st", + "archetype": "online", + "tier": "easy", + "path": "app/online/st_ol_0005.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "st_ol_0006", + "module": "st", + "archetype": "online", + "tier": "easy", + "path": "app/online/st_ol_0006.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "st_ol_0007", + "module": "st", + "archetype": "online", + "tier": "medium", + "path": "app/online/st_ol_0007.pgc", + "loc": 70, + "sqlCount": 1 + }, + { + "id": "st_ol_0008", + "module": "st", + "archetype": "online", + "tier": "easy", + "path": "app/online/st_ol_0008.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "st_ol_0009", + "module": "st", + "archetype": "online", + "tier": "medium", + "path": "app/online/st_ol_0009.pgc", + "loc": 70, + "sqlCount": 1 + }, + { + "id": "st_ol_0010", + "module": "st", + "archetype": "online", + "tier": "easy", + "path": "app/online/st_ol_0010.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "st_ol_0011", + "module": "st", + "archetype": "online", + "tier": "medium", + "path": "app/online/st_ol_0011.pgc", + "loc": 70, + "sqlCount": 1 + }, + { + "id": "st_ol_0012", + "module": "st", + "archetype": "online", + "tier": "easy", + "path": "app/online/st_ol_0012.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "st_ol_0013", + "module": "st", + "archetype": "online", + "tier": "hard", + "path": "app/online/st_ol_0013.pgc", + "loc": 98, + "sqlCount": 1 + }, + { + "id": "st_ol_0014", + "module": "st", + "archetype": "online", + "tier": "easy", + "path": "app/online/st_ol_0014.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "st_ol_0015", + "module": "st", + "archetype": "online", + "tier": "hard", + "path": "app/online/st_ol_0015.pgc", + "loc": 98, + "sqlCount": 1 + }, + { + "id": "st_ol_0016", + "module": "st", + "archetype": "online", + "tier": "easy", + "path": "app/online/st_ol_0016.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "st_ol_0017", + "module": "st", + "archetype": "online", + "tier": "easy", + "path": "app/online/st_ol_0017.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "st_ol_0018", + "module": "st", + "archetype": "online", + "tier": "medium", + "path": "app/online/st_ol_0018.pgc", + "loc": 70, + "sqlCount": 1 + }, + { + "id": "st_ol_0019", + "module": "st", + "archetype": "online", + "tier": "easy", + "path": "app/online/st_ol_0019.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "st_ol_0020", + "module": "st", + "archetype": "online", + "tier": "medium", + "path": "app/online/st_ol_0020.pgc", + "loc": 70, + "sqlCount": 1 + }, + { + "id": "st_ol_0021", + "module": "st", + "archetype": "online", + "tier": "easy", + "path": "app/online/st_ol_0021.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "st_ol_0022", + "module": "st", + "archetype": "online", + "tier": "medium", + "path": "app/online/st_ol_0022.pgc", + "loc": 70, + "sqlCount": 1 + }, + { + "id": "st_ol_0023", + "module": "st", + "archetype": "online", + "tier": "easy", + "path": "app/online/st_ol_0023.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "st_ol_0024", + "module": "st", + "archetype": "online", + "tier": "hard", + "path": "app/online/st_ol_0024.pgc", + "loc": 98, + "sqlCount": 1 + }, + { + "id": "st_ol_0025", + "module": "st", + "archetype": "online", + "tier": "easy", + "path": "app/online/st_ol_0025.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "st_ol_0026", + "module": "st", + "archetype": "online", + "tier": "easy", + "path": "app/online/st_ol_0026.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "st_ol_0027", + "module": "st", + "archetype": "online", + "tier": "medium", + "path": "app/online/st_ol_0027.pgc", + "loc": 70, + "sqlCount": 1 + }, + { + "id": "st_ol_0028", + "module": "st", + "archetype": "online", + "tier": "easy", + "path": "app/online/st_ol_0028.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "st_ol_0029", + "module": "st", + "archetype": "online", + "tier": "medium", + "path": "app/online/st_ol_0029.pgc", + "loc": 70, + "sqlCount": 1 + }, + { + "id": "st_ol_0030", + "module": "st", + "archetype": "online", + "tier": "easy", + "path": "app/online/st_ol_0030.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "st_ol_0031", + "module": "st", + "archetype": "online", + "tier": "medium", + "path": "app/online/st_ol_0031.pgc", + "loc": 70, + "sqlCount": 1 + }, + { + "id": "st_ol_0032", + "module": "st", + "archetype": "online", + "tier": "easy", + "path": "app/online/st_ol_0032.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "vl_ol_0001", + "module": "vl", + "archetype": "online", + "tier": "easy", + "path": "app/online/vl_ol_0001.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "vl_ol_0002", + "module": "vl", + "archetype": "online", + "tier": "medium", + "path": "app/online/vl_ol_0002.pgc", + "loc": 70, + "sqlCount": 1 + }, + { + "id": "vl_ol_0003", + "module": "vl", + "archetype": "online", + "tier": "easy", + "path": "app/online/vl_ol_0003.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "vl_ol_0004", + "module": "vl", + "archetype": "online", + "tier": "hard", + "path": "app/online/vl_ol_0004.pgc", + "loc": 98, + "sqlCount": 1 + }, + { + "id": "vl_ol_0005", + "module": "vl", + "archetype": "online", + "tier": "easy", + "path": "app/online/vl_ol_0005.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "vl_ol_0006", + "module": "vl", + "archetype": "online", + "tier": "hard", + "path": "app/online/vl_ol_0006.pgc", + "loc": 98, + "sqlCount": 1 + }, + { + "id": "vl_ol_0007", + "module": "vl", + "archetype": "online", + "tier": "easy", + "path": "app/online/vl_ol_0007.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "vl_ol_0008", + "module": "vl", + "archetype": "online", + "tier": "easy", + "path": "app/online/vl_ol_0008.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "vl_ol_0009", + "module": "vl", + "archetype": "online", + "tier": "medium", + "path": "app/online/vl_ol_0009.pgc", + "loc": 70, + "sqlCount": 1 + }, + { + "id": "vl_ol_0010", + "module": "vl", + "archetype": "online", + "tier": "easy", + "path": "app/online/vl_ol_0010.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "vl_ol_0011", + "module": "vl", + "archetype": "online", + "tier": "medium", + "path": "app/online/vl_ol_0011.pgc", + "loc": 70, + "sqlCount": 1 + }, + { + "id": "vl_ol_0012", + "module": "vl", + "archetype": "online", + "tier": "easy", + "path": "app/online/vl_ol_0012.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "vl_ol_0013", + "module": "vl", + "archetype": "online", + "tier": "medium", + "path": "app/online/vl_ol_0013.pgc", + "loc": 70, + "sqlCount": 1 + }, + { + "id": "vl_ol_0014", + "module": "vl", + "archetype": "online", + "tier": "easy", + "path": "app/online/vl_ol_0014.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "vl_ol_0015", + "module": "vl", + "archetype": "online", + "tier": "hard", + "path": "app/online/vl_ol_0015.pgc", + "loc": 98, + "sqlCount": 1 + }, + { + "id": "vl_ol_0016", + "module": "vl", + "archetype": "online", + "tier": "easy", + "path": "app/online/vl_ol_0016.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "vl_ol_0017", + "module": "vl", + "archetype": "online", + "tier": "easy", + "path": "app/online/vl_ol_0017.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "vl_ol_0018", + "module": "vl", + "archetype": "online", + "tier": "medium", + "path": "app/online/vl_ol_0018.pgc", + "loc": 70, + "sqlCount": 1 + }, + { + "id": "vl_ol_0019", + "module": "vl", + "archetype": "online", + "tier": "easy", + "path": "app/online/vl_ol_0019.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "vl_ol_0020", + "module": "vl", + "archetype": "online", + "tier": "medium", + "path": "app/online/vl_ol_0020.pgc", + "loc": 70, + "sqlCount": 1 + }, + { + "id": "vl_ol_0021", + "module": "vl", + "archetype": "online", + "tier": "easy", + "path": "app/online/vl_ol_0021.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "vl_ol_0022", + "module": "vl", + "archetype": "online", + "tier": "medium", + "path": "app/online/vl_ol_0022.pgc", + "loc": 70, + "sqlCount": 1 + }, + { + "id": "vl_ol_0023", + "module": "vl", + "archetype": "online", + "tier": "easy", + "path": "app/online/vl_ol_0023.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "vl_ol_0024", + "module": "vl", + "archetype": "online", + "tier": "hard", + "path": "app/online/vl_ol_0024.pgc", + "loc": 98, + "sqlCount": 1 + }, + { + "id": "vl_ol_0025", + "module": "vl", + "archetype": "online", + "tier": "easy", + "path": "app/online/vl_ol_0025.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "vl_ol_0026", + "module": "vl", + "archetype": "online", + "tier": "hard", + "path": "app/online/vl_ol_0026.pgc", + "loc": 98, + "sqlCount": 1 + }, + { + "id": "vl_ol_0027", + "module": "vl", + "archetype": "online", + "tier": "easy", + "path": "app/online/vl_ol_0027.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "vl_ol_0028", + "module": "vl", + "archetype": "online", + "tier": "easy", + "path": "app/online/vl_ol_0028.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "vl_ol_0029", + "module": "vl", + "archetype": "online", + "tier": "medium", + "path": "app/online/vl_ol_0029.pgc", + "loc": 70, + "sqlCount": 1 + }, + { + "id": "vl_ol_0030", + "module": "vl", + "archetype": "online", + "tier": "easy", + "path": "app/online/vl_ol_0030.pgc", + "loc": 47, + "sqlCount": 1 + }, + { + "id": "vl_ol_0031", + "module": "vl", + "archetype": "online", + "tier": "medium", + "path": "app/online/vl_ol_0031.pgc", + "loc": 70, + "sqlCount": 1 + }, + { + "id": "vl_ol_0032", + "module": "vl", + "archetype": "online", + "tier": "easy", + "path": "app/online/vl_ol_0032.pgc", + "loc": 47, + "sqlCount": 1 + } + ] +} \ No newline at end of file diff --git a/mk/ac_frag_0001.mk b/mk/ac_frag_0001.mk new file mode 100644 index 0000000..fbdf78f --- /dev/null +++ b/mk/ac_frag_0001.mk @@ -0,0 +1,10 @@ +# ac_frag_0001.mk - 매입 빌드 조각 (참고용 include 단편) +# 이 조각은 상위 Makefile 이 아카이브/배포 시 참조하는 메타데이터다. +AC_FRAG_0001_MODULE := ac +AC_FRAG_0001_TIER := easy +AC_FRAG_0001_SRC := app/online/ac_ol_0001.pgc +AC_FRAG_0001_DESC := 매입 acquire 처리 단위 + +.PHONY: ac_frag_0001-info +ac_frag_0001-info: + @echo "ac_frag_0001 module=ac tier=easy transform=acquire" diff --git a/mk/ac_frag_0002.mk b/mk/ac_frag_0002.mk new file mode 100644 index 0000000..fd9ba38 --- /dev/null +++ b/mk/ac_frag_0002.mk @@ -0,0 +1,10 @@ +# ac_frag_0002.mk - 매입 빌드 조각 (참고용 include 단편) +# 이 조각은 상위 Makefile 이 아카이브/배포 시 참조하는 메타데이터다. +AC_FRAG_0002_MODULE := ac +AC_FRAG_0002_TIER := medium +AC_FRAG_0002_SRC := app/online/ac_ol_0001.pgc +AC_FRAG_0002_DESC := 매입 acquire 처리 단위 + +.PHONY: ac_frag_0002-info +ac_frag_0002-info: + @echo "ac_frag_0002 module=ac tier=medium transform=acquire" diff --git a/mk/ac_frag_0003.mk b/mk/ac_frag_0003.mk new file mode 100644 index 0000000..450c76b --- /dev/null +++ b/mk/ac_frag_0003.mk @@ -0,0 +1,10 @@ +# ac_frag_0003.mk - 매입 빌드 조각 (참고용 include 단편) +# 이 조각은 상위 Makefile 이 아카이브/배포 시 참조하는 메타데이터다. +AC_FRAG_0003_MODULE := ac +AC_FRAG_0003_TIER := easy +AC_FRAG_0003_SRC := app/online/ac_ol_0001.pgc +AC_FRAG_0003_DESC := 매입 acquire 처리 단위 + +.PHONY: ac_frag_0003-info +ac_frag_0003-info: + @echo "ac_frag_0003 module=ac tier=easy transform=acquire" diff --git a/mk/ac_frag_0004.mk b/mk/ac_frag_0004.mk new file mode 100644 index 0000000..0d6cd2b --- /dev/null +++ b/mk/ac_frag_0004.mk @@ -0,0 +1,10 @@ +# ac_frag_0004.mk - 매입 빌드 조각 (참고용 include 단편) +# 이 조각은 상위 Makefile 이 아카이브/배포 시 참조하는 메타데이터다. +AC_FRAG_0004_MODULE := ac +AC_FRAG_0004_TIER := medium +AC_FRAG_0004_SRC := app/online/ac_ol_0001.pgc +AC_FRAG_0004_DESC := 매입 acquire 처리 단위 + +.PHONY: ac_frag_0004-info +ac_frag_0004-info: + @echo "ac_frag_0004 module=ac tier=medium transform=acquire" diff --git a/mk/ac_frag_0005.mk b/mk/ac_frag_0005.mk new file mode 100644 index 0000000..695b61d --- /dev/null +++ b/mk/ac_frag_0005.mk @@ -0,0 +1,10 @@ +# ac_frag_0005.mk - 매입 빌드 조각 (참고용 include 단편) +# 이 조각은 상위 Makefile 이 아카이브/배포 시 참조하는 메타데이터다. +AC_FRAG_0005_MODULE := ac +AC_FRAG_0005_TIER := easy +AC_FRAG_0005_SRC := app/online/ac_ol_0001.pgc +AC_FRAG_0005_DESC := 매입 acquire 처리 단위 + +.PHONY: ac_frag_0005-info +ac_frag_0005-info: + @echo "ac_frag_0005 module=ac tier=easy transform=acquire" diff --git a/mk/ac_frag_0006.mk b/mk/ac_frag_0006.mk new file mode 100644 index 0000000..19c7e33 --- /dev/null +++ b/mk/ac_frag_0006.mk @@ -0,0 +1,10 @@ +# ac_frag_0006.mk - 매입 빌드 조각 (참고용 include 단편) +# 이 조각은 상위 Makefile 이 아카이브/배포 시 참조하는 메타데이터다. +AC_FRAG_0006_MODULE := ac +AC_FRAG_0006_TIER := hard +AC_FRAG_0006_SRC := app/online/ac_ol_0001.pgc +AC_FRAG_0006_DESC := 매입 acquire 처리 단위 + +.PHONY: ac_frag_0006-info +ac_frag_0006-info: + @echo "ac_frag_0006 module=ac tier=hard transform=acquire" diff --git a/mk/ac_frag_0007.mk b/mk/ac_frag_0007.mk new file mode 100644 index 0000000..56adf96 --- /dev/null +++ b/mk/ac_frag_0007.mk @@ -0,0 +1,10 @@ +# ac_frag_0007.mk - 매입 빌드 조각 (참고용 include 단편) +# 이 조각은 상위 Makefile 이 아카이브/배포 시 참조하는 메타데이터다. +AC_FRAG_0007_MODULE := ac +AC_FRAG_0007_TIER := easy +AC_FRAG_0007_SRC := app/online/ac_ol_0001.pgc +AC_FRAG_0007_DESC := 매입 acquire 처리 단위 + +.PHONY: ac_frag_0007-info +ac_frag_0007-info: + @echo "ac_frag_0007 module=ac tier=easy transform=acquire" diff --git a/mk/ac_frag_0008.mk b/mk/ac_frag_0008.mk new file mode 100644 index 0000000..bab5960 --- /dev/null +++ b/mk/ac_frag_0008.mk @@ -0,0 +1,10 @@ +# ac_frag_0008.mk - 매입 빌드 조각 (참고용 include 단편) +# 이 조각은 상위 Makefile 이 아카이브/배포 시 참조하는 메타데이터다. +AC_FRAG_0008_MODULE := ac +AC_FRAG_0008_TIER := hard +AC_FRAG_0008_SRC := app/online/ac_ol_0001.pgc +AC_FRAG_0008_DESC := 매입 acquire 처리 단위 + +.PHONY: ac_frag_0008-info +ac_frag_0008-info: + @echo "ac_frag_0008 module=ac tier=hard transform=acquire" diff --git a/mk/au_frag_0001.mk b/mk/au_frag_0001.mk new file mode 100644 index 0000000..af2b2c1 --- /dev/null +++ b/mk/au_frag_0001.mk @@ -0,0 +1,10 @@ +# au_frag_0001.mk - 승인한도 빌드 조각 (참고용 include 단편) +# 이 조각은 상위 Makefile 이 아카이브/배포 시 참조하는 메타데이터다. +AU_FRAG_0001_MODULE := au +AU_FRAG_0001_TIER := easy +AU_FRAG_0001_SRC := app/online/au_ol_0001.pgc +AU_FRAG_0001_DESC := 승인한도 authorization 처리 단위 + +.PHONY: au_frag_0001-info +au_frag_0001-info: + @echo "au_frag_0001 module=au tier=easy transform=authorization" diff --git a/mk/au_frag_0002.mk b/mk/au_frag_0002.mk new file mode 100644 index 0000000..c6536ac --- /dev/null +++ b/mk/au_frag_0002.mk @@ -0,0 +1,10 @@ +# au_frag_0002.mk - 승인한도 빌드 조각 (참고용 include 단편) +# 이 조각은 상위 Makefile 이 아카이브/배포 시 참조하는 메타데이터다. +AU_FRAG_0002_MODULE := au +AU_FRAG_0002_TIER := medium +AU_FRAG_0002_SRC := app/online/au_ol_0001.pgc +AU_FRAG_0002_DESC := 승인한도 authorization 처리 단위 + +.PHONY: au_frag_0002-info +au_frag_0002-info: + @echo "au_frag_0002 module=au tier=medium transform=authorization" diff --git a/mk/au_frag_0003.mk b/mk/au_frag_0003.mk new file mode 100644 index 0000000..a8bebb0 --- /dev/null +++ b/mk/au_frag_0003.mk @@ -0,0 +1,10 @@ +# au_frag_0003.mk - 승인한도 빌드 조각 (참고용 include 단편) +# 이 조각은 상위 Makefile 이 아카이브/배포 시 참조하는 메타데이터다. +AU_FRAG_0003_MODULE := au +AU_FRAG_0003_TIER := easy +AU_FRAG_0003_SRC := app/online/au_ol_0001.pgc +AU_FRAG_0003_DESC := 승인한도 authorization 처리 단위 + +.PHONY: au_frag_0003-info +au_frag_0003-info: + @echo "au_frag_0003 module=au tier=easy transform=authorization" diff --git a/mk/au_frag_0004.mk b/mk/au_frag_0004.mk new file mode 100644 index 0000000..3f31f52 --- /dev/null +++ b/mk/au_frag_0004.mk @@ -0,0 +1,10 @@ +# au_frag_0004.mk - 승인한도 빌드 조각 (참고용 include 단편) +# 이 조각은 상위 Makefile 이 아카이브/배포 시 참조하는 메타데이터다. +AU_FRAG_0004_MODULE := au +AU_FRAG_0004_TIER := medium +AU_FRAG_0004_SRC := app/online/au_ol_0001.pgc +AU_FRAG_0004_DESC := 승인한도 authorization 처리 단위 + +.PHONY: au_frag_0004-info +au_frag_0004-info: + @echo "au_frag_0004 module=au tier=medium transform=authorization" diff --git a/mk/au_frag_0005.mk b/mk/au_frag_0005.mk new file mode 100644 index 0000000..3292f7b --- /dev/null +++ b/mk/au_frag_0005.mk @@ -0,0 +1,10 @@ +# au_frag_0005.mk - 승인한도 빌드 조각 (참고용 include 단편) +# 이 조각은 상위 Makefile 이 아카이브/배포 시 참조하는 메타데이터다. +AU_FRAG_0005_MODULE := au +AU_FRAG_0005_TIER := easy +AU_FRAG_0005_SRC := app/online/au_ol_0001.pgc +AU_FRAG_0005_DESC := 승인한도 authorization 처리 단위 + +.PHONY: au_frag_0005-info +au_frag_0005-info: + @echo "au_frag_0005 module=au tier=easy transform=authorization" diff --git a/mk/au_frag_0006.mk b/mk/au_frag_0006.mk new file mode 100644 index 0000000..a052f56 --- /dev/null +++ b/mk/au_frag_0006.mk @@ -0,0 +1,10 @@ +# au_frag_0006.mk - 승인한도 빌드 조각 (참고용 include 단편) +# 이 조각은 상위 Makefile 이 아카이브/배포 시 참조하는 메타데이터다. +AU_FRAG_0006_MODULE := au +AU_FRAG_0006_TIER := medium +AU_FRAG_0006_SRC := app/online/au_ol_0001.pgc +AU_FRAG_0006_DESC := 승인한도 authorization 처리 단위 + +.PHONY: au_frag_0006-info +au_frag_0006-info: + @echo "au_frag_0006 module=au tier=medium transform=authorization" diff --git a/mk/au_frag_0007.mk b/mk/au_frag_0007.mk new file mode 100644 index 0000000..083084b --- /dev/null +++ b/mk/au_frag_0007.mk @@ -0,0 +1,10 @@ +# au_frag_0007.mk - 승인한도 빌드 조각 (참고용 include 단편) +# 이 조각은 상위 Makefile 이 아카이브/배포 시 참조하는 메타데이터다. +AU_FRAG_0007_MODULE := au +AU_FRAG_0007_TIER := easy +AU_FRAG_0007_SRC := app/online/au_ol_0001.pgc +AU_FRAG_0007_DESC := 승인한도 authorization 처리 단위 + +.PHONY: au_frag_0007-info +au_frag_0007-info: + @echo "au_frag_0007 module=au tier=easy transform=authorization" diff --git a/mk/au_frag_0008.mk b/mk/au_frag_0008.mk new file mode 100644 index 0000000..8963f3e --- /dev/null +++ b/mk/au_frag_0008.mk @@ -0,0 +1,10 @@ +# au_frag_0008.mk - 승인한도 빌드 조각 (참고용 include 단편) +# 이 조각은 상위 Makefile 이 아카이브/배포 시 참조하는 메타데이터다. +AU_FRAG_0008_MODULE := au +AU_FRAG_0008_TIER := hard +AU_FRAG_0008_SRC := app/online/au_ol_0001.pgc +AU_FRAG_0008_DESC := 승인한도 authorization 처리 단위 + +.PHONY: au_frag_0008-info +au_frag_0008-info: + @echo "au_frag_0008 module=au tier=hard transform=authorization" diff --git a/mk/au_frag_0009.mk b/mk/au_frag_0009.mk new file mode 100644 index 0000000..0e6ea83 --- /dev/null +++ b/mk/au_frag_0009.mk @@ -0,0 +1,10 @@ +# au_frag_0009.mk - 승인한도 빌드 조각 (참고용 include 단편) +# 이 조각은 상위 Makefile 이 아카이브/배포 시 참조하는 메타데이터다. +AU_FRAG_0009_MODULE := au +AU_FRAG_0009_TIER := easy +AU_FRAG_0009_SRC := app/online/au_ol_0001.pgc +AU_FRAG_0009_DESC := 승인한도 authorization 처리 단위 + +.PHONY: au_frag_0009-info +au_frag_0009-info: + @echo "au_frag_0009 module=au tier=easy transform=authorization" diff --git a/mk/cl_frag_0001.mk b/mk/cl_frag_0001.mk new file mode 100644 index 0000000..32780cf --- /dev/null +++ b/mk/cl_frag_0001.mk @@ -0,0 +1,10 @@ +# cl_frag_0001.mk - 마감 빌드 조각 (참고용 include 단편) +# 이 조각은 상위 Makefile 이 아카이브/배포 시 참조하는 메타데이터다. +CL_FRAG_0001_MODULE := cl +CL_FRAG_0001_TIER := easy +CL_FRAG_0001_SRC := app/online/cl_ol_0001.pgc +CL_FRAG_0001_DESC := 마감 closing 처리 단위 + +.PHONY: cl_frag_0001-info +cl_frag_0001-info: + @echo "cl_frag_0001 module=cl tier=easy transform=closing" diff --git a/mk/cl_frag_0002.mk b/mk/cl_frag_0002.mk new file mode 100644 index 0000000..72fe9a0 --- /dev/null +++ b/mk/cl_frag_0002.mk @@ -0,0 +1,10 @@ +# cl_frag_0002.mk - 마감 빌드 조각 (참고용 include 단편) +# 이 조각은 상위 Makefile 이 아카이브/배포 시 참조하는 메타데이터다. +CL_FRAG_0002_MODULE := cl +CL_FRAG_0002_TIER := easy +CL_FRAG_0002_SRC := app/online/cl_ol_0001.pgc +CL_FRAG_0002_DESC := 마감 closing 처리 단위 + +.PHONY: cl_frag_0002-info +cl_frag_0002-info: + @echo "cl_frag_0002 module=cl tier=easy transform=closing" diff --git a/mk/cl_frag_0003.mk b/mk/cl_frag_0003.mk new file mode 100644 index 0000000..6c542d8 --- /dev/null +++ b/mk/cl_frag_0003.mk @@ -0,0 +1,10 @@ +# cl_frag_0003.mk - 마감 빌드 조각 (참고용 include 단편) +# 이 조각은 상위 Makefile 이 아카이브/배포 시 참조하는 메타데이터다. +CL_FRAG_0003_MODULE := cl +CL_FRAG_0003_TIER := medium +CL_FRAG_0003_SRC := app/online/cl_ol_0001.pgc +CL_FRAG_0003_DESC := 마감 closing 처리 단위 + +.PHONY: cl_frag_0003-info +cl_frag_0003-info: + @echo "cl_frag_0003 module=cl tier=medium transform=closing" diff --git a/mk/cl_frag_0004.mk b/mk/cl_frag_0004.mk new file mode 100644 index 0000000..c68b4c3 --- /dev/null +++ b/mk/cl_frag_0004.mk @@ -0,0 +1,10 @@ +# cl_frag_0004.mk - 마감 빌드 조각 (참고용 include 단편) +# 이 조각은 상위 Makefile 이 아카이브/배포 시 참조하는 메타데이터다. +CL_FRAG_0004_MODULE := cl +CL_FRAG_0004_TIER := easy +CL_FRAG_0004_SRC := app/online/cl_ol_0001.pgc +CL_FRAG_0004_DESC := 마감 closing 처리 단위 + +.PHONY: cl_frag_0004-info +cl_frag_0004-info: + @echo "cl_frag_0004 module=cl tier=easy transform=closing" diff --git a/mk/cl_frag_0005.mk b/mk/cl_frag_0005.mk new file mode 100644 index 0000000..7191938 --- /dev/null +++ b/mk/cl_frag_0005.mk @@ -0,0 +1,10 @@ +# cl_frag_0005.mk - 마감 빌드 조각 (참고용 include 단편) +# 이 조각은 상위 Makefile 이 아카이브/배포 시 참조하는 메타데이터다. +CL_FRAG_0005_MODULE := cl +CL_FRAG_0005_TIER := medium +CL_FRAG_0005_SRC := app/online/cl_ol_0001.pgc +CL_FRAG_0005_DESC := 마감 closing 처리 단위 + +.PHONY: cl_frag_0005-info +cl_frag_0005-info: + @echo "cl_frag_0005 module=cl tier=medium transform=closing" diff --git a/mk/cl_frag_0006.mk b/mk/cl_frag_0006.mk new file mode 100644 index 0000000..792a179 --- /dev/null +++ b/mk/cl_frag_0006.mk @@ -0,0 +1,10 @@ +# cl_frag_0006.mk - 마감 빌드 조각 (참고용 include 단편) +# 이 조각은 상위 Makefile 이 아카이브/배포 시 참조하는 메타데이터다. +CL_FRAG_0006_MODULE := cl +CL_FRAG_0006_TIER := easy +CL_FRAG_0006_SRC := app/online/cl_ol_0001.pgc +CL_FRAG_0006_DESC := 마감 closing 처리 단위 + +.PHONY: cl_frag_0006-info +cl_frag_0006-info: + @echo "cl_frag_0006 module=cl tier=easy transform=closing" diff --git a/mk/cl_frag_0007.mk b/mk/cl_frag_0007.mk new file mode 100644 index 0000000..8e47300 --- /dev/null +++ b/mk/cl_frag_0007.mk @@ -0,0 +1,10 @@ +# cl_frag_0007.mk - 마감 빌드 조각 (참고용 include 단편) +# 이 조각은 상위 Makefile 이 아카이브/배포 시 참조하는 메타데이터다. +CL_FRAG_0007_MODULE := cl +CL_FRAG_0007_TIER := medium +CL_FRAG_0007_SRC := app/online/cl_ol_0001.pgc +CL_FRAG_0007_DESC := 마감 closing 처리 단위 + +.PHONY: cl_frag_0007-info +cl_frag_0007-info: + @echo "cl_frag_0007 module=cl tier=medium transform=closing" diff --git a/mk/cl_frag_0008.mk b/mk/cl_frag_0008.mk new file mode 100644 index 0000000..a0e9728 --- /dev/null +++ b/mk/cl_frag_0008.mk @@ -0,0 +1,10 @@ +# cl_frag_0008.mk - 마감 빌드 조각 (참고용 include 단편) +# 이 조각은 상위 Makefile 이 아카이브/배포 시 참조하는 메타데이터다. +CL_FRAG_0008_MODULE := cl +CL_FRAG_0008_TIER := easy +CL_FRAG_0008_SRC := app/online/cl_ol_0001.pgc +CL_FRAG_0008_DESC := 마감 closing 처리 단위 + +.PHONY: cl_frag_0008-info +cl_frag_0008-info: + @echo "cl_frag_0008 module=cl tier=easy transform=closing" diff --git a/mk/cm_frag_0001.mk b/mk/cm_frag_0001.mk new file mode 100644 index 0000000..24bf8c0 --- /dev/null +++ b/mk/cm_frag_0001.mk @@ -0,0 +1,10 @@ +# cm_frag_0001.mk - 공통 빌드 조각 (참고용 include 단편) +# 이 조각은 상위 Makefile 이 아카이브/배포 시 참조하는 메타데이터다. +CM_FRAG_0001_MODULE := cm +CM_FRAG_0001_TIER := easy +CM_FRAG_0001_SRC := app/online/cm_ol_0001.pgc +CM_FRAG_0001_DESC := 공통 common 처리 단위 + +.PHONY: cm_frag_0001-info +cm_frag_0001-info: + @echo "cm_frag_0001 module=cm tier=easy transform=common" diff --git a/mk/cm_frag_0002.mk b/mk/cm_frag_0002.mk new file mode 100644 index 0000000..20a3d6a --- /dev/null +++ b/mk/cm_frag_0002.mk @@ -0,0 +1,10 @@ +# cm_frag_0002.mk - 공통 빌드 조각 (참고용 include 단편) +# 이 조각은 상위 Makefile 이 아카이브/배포 시 참조하는 메타데이터다. +CM_FRAG_0002_MODULE := cm +CM_FRAG_0002_TIER := easy +CM_FRAG_0002_SRC := app/online/cm_ol_0001.pgc +CM_FRAG_0002_DESC := 공통 common 처리 단위 + +.PHONY: cm_frag_0002-info +cm_frag_0002-info: + @echo "cm_frag_0002 module=cm tier=easy transform=common" diff --git a/mk/cm_frag_0003.mk b/mk/cm_frag_0003.mk new file mode 100644 index 0000000..35a7ee5 --- /dev/null +++ b/mk/cm_frag_0003.mk @@ -0,0 +1,10 @@ +# cm_frag_0003.mk - 공통 빌드 조각 (참고용 include 단편) +# 이 조각은 상위 Makefile 이 아카이브/배포 시 참조하는 메타데이터다. +CM_FRAG_0003_MODULE := cm +CM_FRAG_0003_TIER := medium +CM_FRAG_0003_SRC := app/online/cm_ol_0001.pgc +CM_FRAG_0003_DESC := 공통 common 처리 단위 + +.PHONY: cm_frag_0003-info +cm_frag_0003-info: + @echo "cm_frag_0003 module=cm tier=medium transform=common" diff --git a/mk/cm_frag_0004.mk b/mk/cm_frag_0004.mk new file mode 100644 index 0000000..c620c64 --- /dev/null +++ b/mk/cm_frag_0004.mk @@ -0,0 +1,10 @@ +# cm_frag_0004.mk - 공통 빌드 조각 (참고용 include 단편) +# 이 조각은 상위 Makefile 이 아카이브/배포 시 참조하는 메타데이터다. +CM_FRAG_0004_MODULE := cm +CM_FRAG_0004_TIER := easy +CM_FRAG_0004_SRC := app/online/cm_ol_0001.pgc +CM_FRAG_0004_DESC := 공통 common 처리 단위 + +.PHONY: cm_frag_0004-info +cm_frag_0004-info: + @echo "cm_frag_0004 module=cm tier=easy transform=common" diff --git a/mk/cm_frag_0005.mk b/mk/cm_frag_0005.mk new file mode 100644 index 0000000..4651581 --- /dev/null +++ b/mk/cm_frag_0005.mk @@ -0,0 +1,10 @@ +# cm_frag_0005.mk - 공통 빌드 조각 (참고용 include 단편) +# 이 조각은 상위 Makefile 이 아카이브/배포 시 참조하는 메타데이터다. +CM_FRAG_0005_MODULE := cm +CM_FRAG_0005_TIER := medium +CM_FRAG_0005_SRC := app/online/cm_ol_0001.pgc +CM_FRAG_0005_DESC := 공통 common 처리 단위 + +.PHONY: cm_frag_0005-info +cm_frag_0005-info: + @echo "cm_frag_0005 module=cm tier=medium transform=common" diff --git a/mk/cm_frag_0006.mk b/mk/cm_frag_0006.mk new file mode 100644 index 0000000..a4bc692 --- /dev/null +++ b/mk/cm_frag_0006.mk @@ -0,0 +1,10 @@ +# cm_frag_0006.mk - 공통 빌드 조각 (참고용 include 단편) +# 이 조각은 상위 Makefile 이 아카이브/배포 시 참조하는 메타데이터다. +CM_FRAG_0006_MODULE := cm +CM_FRAG_0006_TIER := easy +CM_FRAG_0006_SRC := app/online/cm_ol_0001.pgc +CM_FRAG_0006_DESC := 공통 common 처리 단위 + +.PHONY: cm_frag_0006-info +cm_frag_0006-info: + @echo "cm_frag_0006 module=cm tier=easy transform=common" diff --git a/mk/cm_frag_0007.mk b/mk/cm_frag_0007.mk new file mode 100644 index 0000000..f9fb1d6 --- /dev/null +++ b/mk/cm_frag_0007.mk @@ -0,0 +1,10 @@ +# cm_frag_0007.mk - 공통 빌드 조각 (참고용 include 단편) +# 이 조각은 상위 Makefile 이 아카이브/배포 시 참조하는 메타데이터다. +CM_FRAG_0007_MODULE := cm +CM_FRAG_0007_TIER := medium +CM_FRAG_0007_SRC := app/online/cm_ol_0001.pgc +CM_FRAG_0007_DESC := 공통 common 처리 단위 + +.PHONY: cm_frag_0007-info +cm_frag_0007-info: + @echo "cm_frag_0007 module=cm tier=medium transform=common" diff --git a/mk/cm_frag_0008.mk b/mk/cm_frag_0008.mk new file mode 100644 index 0000000..9240798 --- /dev/null +++ b/mk/cm_frag_0008.mk @@ -0,0 +1,10 @@ +# cm_frag_0008.mk - 공통 빌드 조각 (참고용 include 단편) +# 이 조각은 상위 Makefile 이 아카이브/배포 시 참조하는 메타데이터다. +CM_FRAG_0008_MODULE := cm +CM_FRAG_0008_TIER := easy +CM_FRAG_0008_SRC := app/online/cm_ol_0001.pgc +CM_FRAG_0008_DESC := 공통 common 처리 단위 + +.PHONY: cm_frag_0008-info +cm_frag_0008-info: + @echo "cm_frag_0008 module=cm tier=easy transform=common" diff --git a/mk/lg_frag_0001.mk b/mk/lg_frag_0001.mk new file mode 100644 index 0000000..76f9fa6 --- /dev/null +++ b/mk/lg_frag_0001.mk @@ -0,0 +1,10 @@ +# lg_frag_0001.mk - 원장 빌드 조각 (참고용 include 단편) +# 이 조각은 상위 Makefile 이 아카이브/배포 시 참조하는 메타데이터다. +LG_FRAG_0001_MODULE := lg +LG_FRAG_0001_TIER := easy +LG_FRAG_0001_SRC := app/online/lg_ol_0001.pgc +LG_FRAG_0001_DESC := 원장 ledger 처리 단위 + +.PHONY: lg_frag_0001-info +lg_frag_0001-info: + @echo "lg_frag_0001 module=lg tier=easy transform=ledger" diff --git a/mk/lg_frag_0002.mk b/mk/lg_frag_0002.mk new file mode 100644 index 0000000..e4391ab --- /dev/null +++ b/mk/lg_frag_0002.mk @@ -0,0 +1,10 @@ +# lg_frag_0002.mk - 원장 빌드 조각 (참고용 include 단편) +# 이 조각은 상위 Makefile 이 아카이브/배포 시 참조하는 메타데이터다. +LG_FRAG_0002_MODULE := lg +LG_FRAG_0002_TIER := hard +LG_FRAG_0002_SRC := app/online/lg_ol_0001.pgc +LG_FRAG_0002_DESC := 원장 ledger 처리 단위 + +.PHONY: lg_frag_0002-info +lg_frag_0002-info: + @echo "lg_frag_0002 module=lg tier=hard transform=ledger" diff --git a/mk/lg_frag_0003.mk b/mk/lg_frag_0003.mk new file mode 100644 index 0000000..de272a2 --- /dev/null +++ b/mk/lg_frag_0003.mk @@ -0,0 +1,10 @@ +# lg_frag_0003.mk - 원장 빌드 조각 (참고용 include 단편) +# 이 조각은 상위 Makefile 이 아카이브/배포 시 참조하는 메타데이터다. +LG_FRAG_0003_MODULE := lg +LG_FRAG_0003_TIER := easy +LG_FRAG_0003_SRC := app/online/lg_ol_0001.pgc +LG_FRAG_0003_DESC := 원장 ledger 처리 단위 + +.PHONY: lg_frag_0003-info +lg_frag_0003-info: + @echo "lg_frag_0003 module=lg tier=easy transform=ledger" diff --git a/mk/lg_frag_0004.mk b/mk/lg_frag_0004.mk new file mode 100644 index 0000000..6210982 --- /dev/null +++ b/mk/lg_frag_0004.mk @@ -0,0 +1,10 @@ +# lg_frag_0004.mk - 원장 빌드 조각 (참고용 include 단편) +# 이 조각은 상위 Makefile 이 아카이브/배포 시 참조하는 메타데이터다. +LG_FRAG_0004_MODULE := lg +LG_FRAG_0004_TIER := easy +LG_FRAG_0004_SRC := app/online/lg_ol_0001.pgc +LG_FRAG_0004_DESC := 원장 ledger 처리 단위 + +.PHONY: lg_frag_0004-info +lg_frag_0004-info: + @echo "lg_frag_0004 module=lg tier=easy transform=ledger" diff --git a/mk/lg_frag_0005.mk b/mk/lg_frag_0005.mk new file mode 100644 index 0000000..3355780 --- /dev/null +++ b/mk/lg_frag_0005.mk @@ -0,0 +1,10 @@ +# lg_frag_0005.mk - 원장 빌드 조각 (참고용 include 단편) +# 이 조각은 상위 Makefile 이 아카이브/배포 시 참조하는 메타데이터다. +LG_FRAG_0005_MODULE := lg +LG_FRAG_0005_TIER := medium +LG_FRAG_0005_SRC := app/online/lg_ol_0001.pgc +LG_FRAG_0005_DESC := 원장 ledger 처리 단위 + +.PHONY: lg_frag_0005-info +lg_frag_0005-info: + @echo "lg_frag_0005 module=lg tier=medium transform=ledger" diff --git a/mk/lg_frag_0006.mk b/mk/lg_frag_0006.mk new file mode 100644 index 0000000..7151ad0 --- /dev/null +++ b/mk/lg_frag_0006.mk @@ -0,0 +1,10 @@ +# lg_frag_0006.mk - 원장 빌드 조각 (참고용 include 단편) +# 이 조각은 상위 Makefile 이 아카이브/배포 시 참조하는 메타데이터다. +LG_FRAG_0006_MODULE := lg +LG_FRAG_0006_TIER := easy +LG_FRAG_0006_SRC := app/online/lg_ol_0001.pgc +LG_FRAG_0006_DESC := 원장 ledger 처리 단위 + +.PHONY: lg_frag_0006-info +lg_frag_0006-info: + @echo "lg_frag_0006 module=lg tier=easy transform=ledger" diff --git a/mk/lg_frag_0007.mk b/mk/lg_frag_0007.mk new file mode 100644 index 0000000..36cd841 --- /dev/null +++ b/mk/lg_frag_0007.mk @@ -0,0 +1,10 @@ +# lg_frag_0007.mk - 원장 빌드 조각 (참고용 include 단편) +# 이 조각은 상위 Makefile 이 아카이브/배포 시 참조하는 메타데이터다. +LG_FRAG_0007_MODULE := lg +LG_FRAG_0007_TIER := medium +LG_FRAG_0007_SRC := app/online/lg_ol_0001.pgc +LG_FRAG_0007_DESC := 원장 ledger 처리 단위 + +.PHONY: lg_frag_0007-info +lg_frag_0007-info: + @echo "lg_frag_0007 module=lg tier=medium transform=ledger" diff --git a/mk/lg_frag_0008.mk b/mk/lg_frag_0008.mk new file mode 100644 index 0000000..a905d20 --- /dev/null +++ b/mk/lg_frag_0008.mk @@ -0,0 +1,10 @@ +# lg_frag_0008.mk - 원장 빌드 조각 (참고용 include 단편) +# 이 조각은 상위 Makefile 이 아카이브/배포 시 참조하는 메타데이터다. +LG_FRAG_0008_MODULE := lg +LG_FRAG_0008_TIER := easy +LG_FRAG_0008_SRC := app/online/lg_ol_0001.pgc +LG_FRAG_0008_DESC := 원장 ledger 처리 단위 + +.PHONY: lg_frag_0008-info +lg_frag_0008-info: + @echo "lg_frag_0008 module=lg tier=easy transform=ledger" diff --git a/mk/mg_frag_0001.mk b/mk/mg_frag_0001.mk new file mode 100644 index 0000000..6908f89 --- /dev/null +++ b/mk/mg_frag_0001.mk @@ -0,0 +1,10 @@ +# mg_frag_0001.mk - 전문게이트웨이 빌드 조각 (참고용 include 단편) +# 이 조각은 상위 Makefile 이 아카이브/배포 시 참조하는 메타데이터다. +MG_FRAG_0001_MODULE := mg +MG_FRAG_0001_TIER := easy +MG_FRAG_0001_SRC := app/online/mg_ol_0001.pgc +MG_FRAG_0001_DESC := 전문게이트웨이 msg-gateway 처리 단위 + +.PHONY: mg_frag_0001-info +mg_frag_0001-info: + @echo "mg_frag_0001 module=mg tier=easy transform=msg-gateway" diff --git a/mk/mg_frag_0002.mk b/mk/mg_frag_0002.mk new file mode 100644 index 0000000..1ff93d5 --- /dev/null +++ b/mk/mg_frag_0002.mk @@ -0,0 +1,10 @@ +# mg_frag_0002.mk - 전문게이트웨이 빌드 조각 (참고용 include 단편) +# 이 조각은 상위 Makefile 이 아카이브/배포 시 참조하는 메타데이터다. +MG_FRAG_0002_MODULE := mg +MG_FRAG_0002_TIER := medium +MG_FRAG_0002_SRC := app/online/mg_ol_0001.pgc +MG_FRAG_0002_DESC := 전문게이트웨이 msg-gateway 처리 단위 + +.PHONY: mg_frag_0002-info +mg_frag_0002-info: + @echo "mg_frag_0002 module=mg tier=medium transform=msg-gateway" diff --git a/mk/mg_frag_0003.mk b/mk/mg_frag_0003.mk new file mode 100644 index 0000000..c39ee3b --- /dev/null +++ b/mk/mg_frag_0003.mk @@ -0,0 +1,10 @@ +# mg_frag_0003.mk - 전문게이트웨이 빌드 조각 (참고용 include 단편) +# 이 조각은 상위 Makefile 이 아카이브/배포 시 참조하는 메타데이터다. +MG_FRAG_0003_MODULE := mg +MG_FRAG_0003_TIER := easy +MG_FRAG_0003_SRC := app/online/mg_ol_0001.pgc +MG_FRAG_0003_DESC := 전문게이트웨이 msg-gateway 처리 단위 + +.PHONY: mg_frag_0003-info +mg_frag_0003-info: + @echo "mg_frag_0003 module=mg tier=easy transform=msg-gateway" diff --git a/mk/mg_frag_0004.mk b/mk/mg_frag_0004.mk new file mode 100644 index 0000000..0ea045d --- /dev/null +++ b/mk/mg_frag_0004.mk @@ -0,0 +1,10 @@ +# mg_frag_0004.mk - 전문게이트웨이 빌드 조각 (참고용 include 단편) +# 이 조각은 상위 Makefile 이 아카이브/배포 시 참조하는 메타데이터다. +MG_FRAG_0004_MODULE := mg +MG_FRAG_0004_TIER := medium +MG_FRAG_0004_SRC := app/online/mg_ol_0001.pgc +MG_FRAG_0004_DESC := 전문게이트웨이 msg-gateway 처리 단위 + +.PHONY: mg_frag_0004-info +mg_frag_0004-info: + @echo "mg_frag_0004 module=mg tier=medium transform=msg-gateway" diff --git a/mk/mg_frag_0005.mk b/mk/mg_frag_0005.mk new file mode 100644 index 0000000..60c208d --- /dev/null +++ b/mk/mg_frag_0005.mk @@ -0,0 +1,10 @@ +# mg_frag_0005.mk - 전문게이트웨이 빌드 조각 (참고용 include 단편) +# 이 조각은 상위 Makefile 이 아카이브/배포 시 참조하는 메타데이터다. +MG_FRAG_0005_MODULE := mg +MG_FRAG_0005_TIER := easy +MG_FRAG_0005_SRC := app/online/mg_ol_0001.pgc +MG_FRAG_0005_DESC := 전문게이트웨이 msg-gateway 처리 단위 + +.PHONY: mg_frag_0005-info +mg_frag_0005-info: + @echo "mg_frag_0005 module=mg tier=easy transform=msg-gateway" diff --git a/mk/mg_frag_0006.mk b/mk/mg_frag_0006.mk new file mode 100644 index 0000000..bfd924f --- /dev/null +++ b/mk/mg_frag_0006.mk @@ -0,0 +1,10 @@ +# mg_frag_0006.mk - 전문게이트웨이 빌드 조각 (참고용 include 단편) +# 이 조각은 상위 Makefile 이 아카이브/배포 시 참조하는 메타데이터다. +MG_FRAG_0006_MODULE := mg +MG_FRAG_0006_TIER := medium +MG_FRAG_0006_SRC := app/online/mg_ol_0001.pgc +MG_FRAG_0006_DESC := 전문게이트웨이 msg-gateway 처리 단위 + +.PHONY: mg_frag_0006-info +mg_frag_0006-info: + @echo "mg_frag_0006 module=mg tier=medium transform=msg-gateway" diff --git a/mk/mg_frag_0007.mk b/mk/mg_frag_0007.mk new file mode 100644 index 0000000..f131fc9 --- /dev/null +++ b/mk/mg_frag_0007.mk @@ -0,0 +1,10 @@ +# mg_frag_0007.mk - 전문게이트웨이 빌드 조각 (참고용 include 단편) +# 이 조각은 상위 Makefile 이 아카이브/배포 시 참조하는 메타데이터다. +MG_FRAG_0007_MODULE := mg +MG_FRAG_0007_TIER := easy +MG_FRAG_0007_SRC := app/online/mg_ol_0001.pgc +MG_FRAG_0007_DESC := 전문게이트웨이 msg-gateway 처리 단위 + +.PHONY: mg_frag_0007-info +mg_frag_0007-info: + @echo "mg_frag_0007 module=mg tier=easy transform=msg-gateway" diff --git a/mk/mg_frag_0008.mk b/mk/mg_frag_0008.mk new file mode 100644 index 0000000..db974d9 --- /dev/null +++ b/mk/mg_frag_0008.mk @@ -0,0 +1,10 @@ +# mg_frag_0008.mk - 전문게이트웨이 빌드 조각 (참고용 include 단편) +# 이 조각은 상위 Makefile 이 아카이브/배포 시 참조하는 메타데이터다. +MG_FRAG_0008_MODULE := mg +MG_FRAG_0008_TIER := hard +MG_FRAG_0008_SRC := app/online/mg_ol_0001.pgc +MG_FRAG_0008_DESC := 전문게이트웨이 msg-gateway 처리 단위 + +.PHONY: mg_frag_0008-info +mg_frag_0008-info: + @echo "mg_frag_0008 module=mg tier=hard transform=msg-gateway" diff --git a/mk/mg_frag_0009.mk b/mk/mg_frag_0009.mk new file mode 100644 index 0000000..4af22c4 --- /dev/null +++ b/mk/mg_frag_0009.mk @@ -0,0 +1,10 @@ +# mg_frag_0009.mk - 전문게이트웨이 빌드 조각 (참고용 include 단편) +# 이 조각은 상위 Makefile 이 아카이브/배포 시 참조하는 메타데이터다. +MG_FRAG_0009_MODULE := mg +MG_FRAG_0009_TIER := easy +MG_FRAG_0009_SRC := app/online/mg_ol_0001.pgc +MG_FRAG_0009_DESC := 전문게이트웨이 msg-gateway 처리 단위 + +.PHONY: mg_frag_0009-info +mg_frag_0009-info: + @echo "mg_frag_0009 module=mg tier=easy transform=msg-gateway" diff --git a/mk/mm_frag_0001.mk b/mk/mm_frag_0001.mk new file mode 100644 index 0000000..4f2bc52 --- /dev/null +++ b/mk/mm_frag_0001.mk @@ -0,0 +1,10 @@ +# mm_frag_0001.mk - 마스터 빌드 조각 (참고용 include 단편) +# 이 조각은 상위 Makefile 이 아카이브/배포 시 참조하는 메타데이터다. +MM_FRAG_0001_MODULE := mm +MM_FRAG_0001_TIER := easy +MM_FRAG_0001_SRC := app/online/mm_ol_0001.pgc +MM_FRAG_0001_DESC := 마스터 master 처리 단위 + +.PHONY: mm_frag_0001-info +mm_frag_0001-info: + @echo "mm_frag_0001 module=mm tier=easy transform=master" diff --git a/mk/mm_frag_0002.mk b/mk/mm_frag_0002.mk new file mode 100644 index 0000000..a052953 --- /dev/null +++ b/mk/mm_frag_0002.mk @@ -0,0 +1,10 @@ +# mm_frag_0002.mk - 마스터 빌드 조각 (참고용 include 단편) +# 이 조각은 상위 Makefile 이 아카이브/배포 시 참조하는 메타데이터다. +MM_FRAG_0002_MODULE := mm +MM_FRAG_0002_TIER := hard +MM_FRAG_0002_SRC := app/online/mm_ol_0001.pgc +MM_FRAG_0002_DESC := 마스터 master 처리 단위 + +.PHONY: mm_frag_0002-info +mm_frag_0002-info: + @echo "mm_frag_0002 module=mm tier=hard transform=master" diff --git a/mk/mm_frag_0003.mk b/mk/mm_frag_0003.mk new file mode 100644 index 0000000..6b3e704 --- /dev/null +++ b/mk/mm_frag_0003.mk @@ -0,0 +1,10 @@ +# mm_frag_0003.mk - 마스터 빌드 조각 (참고용 include 단편) +# 이 조각은 상위 Makefile 이 아카이브/배포 시 참조하는 메타데이터다. +MM_FRAG_0003_MODULE := mm +MM_FRAG_0003_TIER := easy +MM_FRAG_0003_SRC := app/online/mm_ol_0001.pgc +MM_FRAG_0003_DESC := 마스터 master 처리 단위 + +.PHONY: mm_frag_0003-info +mm_frag_0003-info: + @echo "mm_frag_0003 module=mm tier=easy transform=master" diff --git a/mk/mm_frag_0004.mk b/mk/mm_frag_0004.mk new file mode 100644 index 0000000..90be74f --- /dev/null +++ b/mk/mm_frag_0004.mk @@ -0,0 +1,10 @@ +# mm_frag_0004.mk - 마스터 빌드 조각 (참고용 include 단편) +# 이 조각은 상위 Makefile 이 아카이브/배포 시 참조하는 메타데이터다. +MM_FRAG_0004_MODULE := mm +MM_FRAG_0004_TIER := easy +MM_FRAG_0004_SRC := app/online/mm_ol_0001.pgc +MM_FRAG_0004_DESC := 마스터 master 처리 단위 + +.PHONY: mm_frag_0004-info +mm_frag_0004-info: + @echo "mm_frag_0004 module=mm tier=easy transform=master" diff --git a/mk/mm_frag_0005.mk b/mk/mm_frag_0005.mk new file mode 100644 index 0000000..da6e426 --- /dev/null +++ b/mk/mm_frag_0005.mk @@ -0,0 +1,10 @@ +# mm_frag_0005.mk - 마스터 빌드 조각 (참고용 include 단편) +# 이 조각은 상위 Makefile 이 아카이브/배포 시 참조하는 메타데이터다. +MM_FRAG_0005_MODULE := mm +MM_FRAG_0005_TIER := medium +MM_FRAG_0005_SRC := app/online/mm_ol_0001.pgc +MM_FRAG_0005_DESC := 마스터 master 처리 단위 + +.PHONY: mm_frag_0005-info +mm_frag_0005-info: + @echo "mm_frag_0005 module=mm tier=medium transform=master" diff --git a/mk/mm_frag_0006.mk b/mk/mm_frag_0006.mk new file mode 100644 index 0000000..fef7fc8 --- /dev/null +++ b/mk/mm_frag_0006.mk @@ -0,0 +1,10 @@ +# mm_frag_0006.mk - 마스터 빌드 조각 (참고용 include 단편) +# 이 조각은 상위 Makefile 이 아카이브/배포 시 참조하는 메타데이터다. +MM_FRAG_0006_MODULE := mm +MM_FRAG_0006_TIER := easy +MM_FRAG_0006_SRC := app/online/mm_ol_0001.pgc +MM_FRAG_0006_DESC := 마스터 master 처리 단위 + +.PHONY: mm_frag_0006-info +mm_frag_0006-info: + @echo "mm_frag_0006 module=mm tier=easy transform=master" diff --git a/mk/mm_frag_0007.mk b/mk/mm_frag_0007.mk new file mode 100644 index 0000000..1c4c1b8 --- /dev/null +++ b/mk/mm_frag_0007.mk @@ -0,0 +1,10 @@ +# mm_frag_0007.mk - 마스터 빌드 조각 (참고용 include 단편) +# 이 조각은 상위 Makefile 이 아카이브/배포 시 참조하는 메타데이터다. +MM_FRAG_0007_MODULE := mm +MM_FRAG_0007_TIER := medium +MM_FRAG_0007_SRC := app/online/mm_ol_0001.pgc +MM_FRAG_0007_DESC := 마스터 master 처리 단위 + +.PHONY: mm_frag_0007-info +mm_frag_0007-info: + @echo "mm_frag_0007 module=mm tier=medium transform=master" diff --git a/mk/mm_frag_0008.mk b/mk/mm_frag_0008.mk new file mode 100644 index 0000000..4644d4d --- /dev/null +++ b/mk/mm_frag_0008.mk @@ -0,0 +1,10 @@ +# mm_frag_0008.mk - 마스터 빌드 조각 (참고용 include 단편) +# 이 조각은 상위 Makefile 이 아카이브/배포 시 참조하는 메타데이터다. +MM_FRAG_0008_MODULE := mm +MM_FRAG_0008_TIER := easy +MM_FRAG_0008_SRC := app/online/mm_ol_0001.pgc +MM_FRAG_0008_DESC := 마스터 master 처리 단위 + +.PHONY: mm_frag_0008-info +mm_frag_0008-info: + @echo "mm_frag_0008 module=mm tier=easy transform=master" diff --git a/mk/py_frag_0001.mk b/mk/py_frag_0001.mk new file mode 100644 index 0000000..8e45137 --- /dev/null +++ b/mk/py_frag_0001.mk @@ -0,0 +1,10 @@ +# py_frag_0001.mk - 지급 빌드 조각 (참고용 include 단편) +# 이 조각은 상위 Makefile 이 아카이브/배포 시 참조하는 메타데이터다. +PY_FRAG_0001_MODULE := py +PY_FRAG_0001_TIER := easy +PY_FRAG_0001_SRC := app/online/py_ol_0001.pgc +PY_FRAG_0001_DESC := 지급 payment 처리 단위 + +.PHONY: py_frag_0001-info +py_frag_0001-info: + @echo "py_frag_0001 module=py tier=easy transform=payment" diff --git a/mk/py_frag_0002.mk b/mk/py_frag_0002.mk new file mode 100644 index 0000000..5db4440 --- /dev/null +++ b/mk/py_frag_0002.mk @@ -0,0 +1,10 @@ +# py_frag_0002.mk - 지급 빌드 조각 (참고용 include 단편) +# 이 조각은 상위 Makefile 이 아카이브/배포 시 참조하는 메타데이터다. +PY_FRAG_0002_MODULE := py +PY_FRAG_0002_TIER := hard +PY_FRAG_0002_SRC := app/online/py_ol_0001.pgc +PY_FRAG_0002_DESC := 지급 payment 처리 단위 + +.PHONY: py_frag_0002-info +py_frag_0002-info: + @echo "py_frag_0002 module=py tier=hard transform=payment" diff --git a/mk/py_frag_0003.mk b/mk/py_frag_0003.mk new file mode 100644 index 0000000..695502c --- /dev/null +++ b/mk/py_frag_0003.mk @@ -0,0 +1,10 @@ +# py_frag_0003.mk - 지급 빌드 조각 (참고용 include 단편) +# 이 조각은 상위 Makefile 이 아카이브/배포 시 참조하는 메타데이터다. +PY_FRAG_0003_MODULE := py +PY_FRAG_0003_TIER := easy +PY_FRAG_0003_SRC := app/online/py_ol_0001.pgc +PY_FRAG_0003_DESC := 지급 payment 처리 단위 + +.PHONY: py_frag_0003-info +py_frag_0003-info: + @echo "py_frag_0003 module=py tier=easy transform=payment" diff --git a/mk/py_frag_0004.mk b/mk/py_frag_0004.mk new file mode 100644 index 0000000..c70be79 --- /dev/null +++ b/mk/py_frag_0004.mk @@ -0,0 +1,10 @@ +# py_frag_0004.mk - 지급 빌드 조각 (참고용 include 단편) +# 이 조각은 상위 Makefile 이 아카이브/배포 시 참조하는 메타데이터다. +PY_FRAG_0004_MODULE := py +PY_FRAG_0004_TIER := hard +PY_FRAG_0004_SRC := app/online/py_ol_0001.pgc +PY_FRAG_0004_DESC := 지급 payment 처리 단위 + +.PHONY: py_frag_0004-info +py_frag_0004-info: + @echo "py_frag_0004 module=py tier=hard transform=payment" diff --git a/mk/py_frag_0005.mk b/mk/py_frag_0005.mk new file mode 100644 index 0000000..9943670 --- /dev/null +++ b/mk/py_frag_0005.mk @@ -0,0 +1,10 @@ +# py_frag_0005.mk - 지급 빌드 조각 (참고용 include 단편) +# 이 조각은 상위 Makefile 이 아카이브/배포 시 참조하는 메타데이터다. +PY_FRAG_0005_MODULE := py +PY_FRAG_0005_TIER := easy +PY_FRAG_0005_SRC := app/online/py_ol_0001.pgc +PY_FRAG_0005_DESC := 지급 payment 처리 단위 + +.PHONY: py_frag_0005-info +py_frag_0005-info: + @echo "py_frag_0005 module=py tier=easy transform=payment" diff --git a/mk/py_frag_0006.mk b/mk/py_frag_0006.mk new file mode 100644 index 0000000..d33f3a0 --- /dev/null +++ b/mk/py_frag_0006.mk @@ -0,0 +1,10 @@ +# py_frag_0006.mk - 지급 빌드 조각 (참고용 include 단편) +# 이 조각은 상위 Makefile 이 아카이브/배포 시 참조하는 메타데이터다. +PY_FRAG_0006_MODULE := py +PY_FRAG_0006_TIER := easy +PY_FRAG_0006_SRC := app/online/py_ol_0001.pgc +PY_FRAG_0006_DESC := 지급 payment 처리 단위 + +.PHONY: py_frag_0006-info +py_frag_0006-info: + @echo "py_frag_0006 module=py tier=easy transform=payment" diff --git a/mk/py_frag_0007.mk b/mk/py_frag_0007.mk new file mode 100644 index 0000000..5860cd0 --- /dev/null +++ b/mk/py_frag_0007.mk @@ -0,0 +1,10 @@ +# py_frag_0007.mk - 지급 빌드 조각 (참고용 include 단편) +# 이 조각은 상위 Makefile 이 아카이브/배포 시 참조하는 메타데이터다. +PY_FRAG_0007_MODULE := py +PY_FRAG_0007_TIER := medium +PY_FRAG_0007_SRC := app/online/py_ol_0001.pgc +PY_FRAG_0007_DESC := 지급 payment 처리 단위 + +.PHONY: py_frag_0007-info +py_frag_0007-info: + @echo "py_frag_0007 module=py tier=medium transform=payment" diff --git a/mk/py_frag_0008.mk b/mk/py_frag_0008.mk new file mode 100644 index 0000000..cdc9ac1 --- /dev/null +++ b/mk/py_frag_0008.mk @@ -0,0 +1,10 @@ +# py_frag_0008.mk - 지급 빌드 조각 (참고용 include 단편) +# 이 조각은 상위 Makefile 이 아카이브/배포 시 참조하는 메타데이터다. +PY_FRAG_0008_MODULE := py +PY_FRAG_0008_TIER := easy +PY_FRAG_0008_SRC := app/online/py_ol_0001.pgc +PY_FRAG_0008_DESC := 지급 payment 처리 단위 + +.PHONY: py_frag_0008-info +py_frag_0008-info: + @echo "py_frag_0008 module=py tier=easy transform=payment" diff --git a/mk/rc_frag_0001.mk b/mk/rc_frag_0001.mk new file mode 100644 index 0000000..89ee833 --- /dev/null +++ b/mk/rc_frag_0001.mk @@ -0,0 +1,10 @@ +# rc_frag_0001.mk - 대사 빌드 조각 (참고용 include 단편) +# 이 조각은 상위 Makefile 이 아카이브/배포 시 참조하는 메타데이터다. +RC_FRAG_0001_MODULE := rc +RC_FRAG_0001_TIER := easy +RC_FRAG_0001_SRC := app/online/rc_ol_0001.pgc +RC_FRAG_0001_DESC := 대사 reconciliation 처리 단위 + +.PHONY: rc_frag_0001-info +rc_frag_0001-info: + @echo "rc_frag_0001 module=rc tier=easy transform=reconciliation" diff --git a/mk/rc_frag_0002.mk b/mk/rc_frag_0002.mk new file mode 100644 index 0000000..46e471c --- /dev/null +++ b/mk/rc_frag_0002.mk @@ -0,0 +1,10 @@ +# rc_frag_0002.mk - 대사 빌드 조각 (참고용 include 단편) +# 이 조각은 상위 Makefile 이 아카이브/배포 시 참조하는 메타데이터다. +RC_FRAG_0002_MODULE := rc +RC_FRAG_0002_TIER := medium +RC_FRAG_0002_SRC := app/online/rc_ol_0001.pgc +RC_FRAG_0002_DESC := 대사 reconciliation 처리 단위 + +.PHONY: rc_frag_0002-info +rc_frag_0002-info: + @echo "rc_frag_0002 module=rc tier=medium transform=reconciliation" diff --git a/mk/rc_frag_0003.mk b/mk/rc_frag_0003.mk new file mode 100644 index 0000000..2b3b73b --- /dev/null +++ b/mk/rc_frag_0003.mk @@ -0,0 +1,10 @@ +# rc_frag_0003.mk - 대사 빌드 조각 (참고용 include 단편) +# 이 조각은 상위 Makefile 이 아카이브/배포 시 참조하는 메타데이터다. +RC_FRAG_0003_MODULE := rc +RC_FRAG_0003_TIER := easy +RC_FRAG_0003_SRC := app/online/rc_ol_0001.pgc +RC_FRAG_0003_DESC := 대사 reconciliation 처리 단위 + +.PHONY: rc_frag_0003-info +rc_frag_0003-info: + @echo "rc_frag_0003 module=rc tier=easy transform=reconciliation" diff --git a/mk/rc_frag_0004.mk b/mk/rc_frag_0004.mk new file mode 100644 index 0000000..1d33ba0 --- /dev/null +++ b/mk/rc_frag_0004.mk @@ -0,0 +1,10 @@ +# rc_frag_0004.mk - 대사 빌드 조각 (참고용 include 단편) +# 이 조각은 상위 Makefile 이 아카이브/배포 시 참조하는 메타데이터다. +RC_FRAG_0004_MODULE := rc +RC_FRAG_0004_TIER := medium +RC_FRAG_0004_SRC := app/online/rc_ol_0001.pgc +RC_FRAG_0004_DESC := 대사 reconciliation 처리 단위 + +.PHONY: rc_frag_0004-info +rc_frag_0004-info: + @echo "rc_frag_0004 module=rc tier=medium transform=reconciliation" diff --git a/mk/rc_frag_0005.mk b/mk/rc_frag_0005.mk new file mode 100644 index 0000000..e69084c --- /dev/null +++ b/mk/rc_frag_0005.mk @@ -0,0 +1,10 @@ +# rc_frag_0005.mk - 대사 빌드 조각 (참고용 include 단편) +# 이 조각은 상위 Makefile 이 아카이브/배포 시 참조하는 메타데이터다. +RC_FRAG_0005_MODULE := rc +RC_FRAG_0005_TIER := easy +RC_FRAG_0005_SRC := app/online/rc_ol_0001.pgc +RC_FRAG_0005_DESC := 대사 reconciliation 처리 단위 + +.PHONY: rc_frag_0005-info +rc_frag_0005-info: + @echo "rc_frag_0005 module=rc tier=easy transform=reconciliation" diff --git a/mk/rc_frag_0006.mk b/mk/rc_frag_0006.mk new file mode 100644 index 0000000..ecf5344 --- /dev/null +++ b/mk/rc_frag_0006.mk @@ -0,0 +1,10 @@ +# rc_frag_0006.mk - 대사 빌드 조각 (참고용 include 단편) +# 이 조각은 상위 Makefile 이 아카이브/배포 시 참조하는 메타데이터다. +RC_FRAG_0006_MODULE := rc +RC_FRAG_0006_TIER := hard +RC_FRAG_0006_SRC := app/online/rc_ol_0001.pgc +RC_FRAG_0006_DESC := 대사 reconciliation 처리 단위 + +.PHONY: rc_frag_0006-info +rc_frag_0006-info: + @echo "rc_frag_0006 module=rc tier=hard transform=reconciliation" diff --git a/mk/rc_frag_0007.mk b/mk/rc_frag_0007.mk new file mode 100644 index 0000000..8a1785a --- /dev/null +++ b/mk/rc_frag_0007.mk @@ -0,0 +1,10 @@ +# rc_frag_0007.mk - 대사 빌드 조각 (참고용 include 단편) +# 이 조각은 상위 Makefile 이 아카이브/배포 시 참조하는 메타데이터다. +RC_FRAG_0007_MODULE := rc +RC_FRAG_0007_TIER := easy +RC_FRAG_0007_SRC := app/online/rc_ol_0001.pgc +RC_FRAG_0007_DESC := 대사 reconciliation 처리 단위 + +.PHONY: rc_frag_0007-info +rc_frag_0007-info: + @echo "rc_frag_0007 module=rc tier=easy transform=reconciliation" diff --git a/mk/rc_frag_0008.mk b/mk/rc_frag_0008.mk new file mode 100644 index 0000000..071ccda --- /dev/null +++ b/mk/rc_frag_0008.mk @@ -0,0 +1,10 @@ +# rc_frag_0008.mk - 대사 빌드 조각 (참고용 include 단편) +# 이 조각은 상위 Makefile 이 아카이브/배포 시 참조하는 메타데이터다. +RC_FRAG_0008_MODULE := rc +RC_FRAG_0008_TIER := easy +RC_FRAG_0008_SRC := app/online/rc_ol_0001.pgc +RC_FRAG_0008_DESC := 대사 reconciliation 처리 단위 + +.PHONY: rc_frag_0008-info +rc_frag_0008-info: + @echo "rc_frag_0008 module=rc tier=easy transform=reconciliation" diff --git a/mk/st_frag_0001.mk b/mk/st_frag_0001.mk new file mode 100644 index 0000000..b42ed98 --- /dev/null +++ b/mk/st_frag_0001.mk @@ -0,0 +1,10 @@ +# st_frag_0001.mk - 정산수수료 빌드 조각 (참고용 include 단편) +# 이 조각은 상위 Makefile 이 아카이브/배포 시 참조하는 메타데이터다. +ST_FRAG_0001_MODULE := st +ST_FRAG_0001_TIER := easy +ST_FRAG_0001_SRC := app/online/st_ol_0001.pgc +ST_FRAG_0001_DESC := 정산수수료 settlement 처리 단위 + +.PHONY: st_frag_0001-info +st_frag_0001-info: + @echo "st_frag_0001 module=st tier=easy transform=settlement" diff --git a/mk/st_frag_0002.mk b/mk/st_frag_0002.mk new file mode 100644 index 0000000..e73a0bf --- /dev/null +++ b/mk/st_frag_0002.mk @@ -0,0 +1,10 @@ +# st_frag_0002.mk - 정산수수료 빌드 조각 (참고용 include 단편) +# 이 조각은 상위 Makefile 이 아카이브/배포 시 참조하는 메타데이터다. +ST_FRAG_0002_MODULE := st +ST_FRAG_0002_TIER := medium +ST_FRAG_0002_SRC := app/online/st_ol_0001.pgc +ST_FRAG_0002_DESC := 정산수수료 settlement 처리 단위 + +.PHONY: st_frag_0002-info +st_frag_0002-info: + @echo "st_frag_0002 module=st tier=medium transform=settlement" diff --git a/mk/st_frag_0003.mk b/mk/st_frag_0003.mk new file mode 100644 index 0000000..0f965a8 --- /dev/null +++ b/mk/st_frag_0003.mk @@ -0,0 +1,10 @@ +# st_frag_0003.mk - 정산수수료 빌드 조각 (참고용 include 단편) +# 이 조각은 상위 Makefile 이 아카이브/배포 시 참조하는 메타데이터다. +ST_FRAG_0003_MODULE := st +ST_FRAG_0003_TIER := easy +ST_FRAG_0003_SRC := app/online/st_ol_0001.pgc +ST_FRAG_0003_DESC := 정산수수료 settlement 처리 단위 + +.PHONY: st_frag_0003-info +st_frag_0003-info: + @echo "st_frag_0003 module=st tier=easy transform=settlement" diff --git a/mk/st_frag_0004.mk b/mk/st_frag_0004.mk new file mode 100644 index 0000000..dc61000 --- /dev/null +++ b/mk/st_frag_0004.mk @@ -0,0 +1,10 @@ +# st_frag_0004.mk - 정산수수료 빌드 조각 (참고용 include 단편) +# 이 조각은 상위 Makefile 이 아카이브/배포 시 참조하는 메타데이터다. +ST_FRAG_0004_MODULE := st +ST_FRAG_0004_TIER := hard +ST_FRAG_0004_SRC := app/online/st_ol_0001.pgc +ST_FRAG_0004_DESC := 정산수수료 settlement 처리 단위 + +.PHONY: st_frag_0004-info +st_frag_0004-info: + @echo "st_frag_0004 module=st tier=hard transform=settlement" diff --git a/mk/st_frag_0005.mk b/mk/st_frag_0005.mk new file mode 100644 index 0000000..305e566 --- /dev/null +++ b/mk/st_frag_0005.mk @@ -0,0 +1,10 @@ +# st_frag_0005.mk - 정산수수료 빌드 조각 (참고용 include 단편) +# 이 조각은 상위 Makefile 이 아카이브/배포 시 참조하는 메타데이터다. +ST_FRAG_0005_MODULE := st +ST_FRAG_0005_TIER := easy +ST_FRAG_0005_SRC := app/online/st_ol_0001.pgc +ST_FRAG_0005_DESC := 정산수수료 settlement 처리 단위 + +.PHONY: st_frag_0005-info +st_frag_0005-info: + @echo "st_frag_0005 module=st tier=easy transform=settlement" diff --git a/mk/st_frag_0006.mk b/mk/st_frag_0006.mk new file mode 100644 index 0000000..5e0f57c --- /dev/null +++ b/mk/st_frag_0006.mk @@ -0,0 +1,10 @@ +# st_frag_0006.mk - 정산수수료 빌드 조각 (참고용 include 단편) +# 이 조각은 상위 Makefile 이 아카이브/배포 시 참조하는 메타데이터다. +ST_FRAG_0006_MODULE := st +ST_FRAG_0006_TIER := easy +ST_FRAG_0006_SRC := app/online/st_ol_0001.pgc +ST_FRAG_0006_DESC := 정산수수료 settlement 처리 단위 + +.PHONY: st_frag_0006-info +st_frag_0006-info: + @echo "st_frag_0006 module=st tier=easy transform=settlement" diff --git a/mk/st_frag_0007.mk b/mk/st_frag_0007.mk new file mode 100644 index 0000000..1331cde --- /dev/null +++ b/mk/st_frag_0007.mk @@ -0,0 +1,10 @@ +# st_frag_0007.mk - 정산수수료 빌드 조각 (참고용 include 단편) +# 이 조각은 상위 Makefile 이 아카이브/배포 시 참조하는 메타데이터다. +ST_FRAG_0007_MODULE := st +ST_FRAG_0007_TIER := medium +ST_FRAG_0007_SRC := app/online/st_ol_0001.pgc +ST_FRAG_0007_DESC := 정산수수료 settlement 처리 단위 + +.PHONY: st_frag_0007-info +st_frag_0007-info: + @echo "st_frag_0007 module=st tier=medium transform=settlement" diff --git a/mk/st_frag_0008.mk b/mk/st_frag_0008.mk new file mode 100644 index 0000000..f18440e --- /dev/null +++ b/mk/st_frag_0008.mk @@ -0,0 +1,10 @@ +# st_frag_0008.mk - 정산수수료 빌드 조각 (참고용 include 단편) +# 이 조각은 상위 Makefile 이 아카이브/배포 시 참조하는 메타데이터다. +ST_FRAG_0008_MODULE := st +ST_FRAG_0008_TIER := easy +ST_FRAG_0008_SRC := app/online/st_ol_0001.pgc +ST_FRAG_0008_DESC := 정산수수료 settlement 처리 단위 + +.PHONY: st_frag_0008-info +st_frag_0008-info: + @echo "st_frag_0008 module=st tier=easy transform=settlement" diff --git a/mk/vl_frag_0001.mk b/mk/vl_frag_0001.mk new file mode 100644 index 0000000..e4c96c0 --- /dev/null +++ b/mk/vl_frag_0001.mk @@ -0,0 +1,10 @@ +# vl_frag_0001.mk - 정합성 빌드 조각 (참고용 include 단편) +# 이 조각은 상위 Makefile 이 아카이브/배포 시 참조하는 메타데이터다. +VL_FRAG_0001_MODULE := vl +VL_FRAG_0001_TIER := easy +VL_FRAG_0001_SRC := app/online/vl_ol_0001.pgc +VL_FRAG_0001_DESC := 정합성 validation 처리 단위 + +.PHONY: vl_frag_0001-info +vl_frag_0001-info: + @echo "vl_frag_0001 module=vl tier=easy transform=validation" diff --git a/mk/vl_frag_0002.mk b/mk/vl_frag_0002.mk new file mode 100644 index 0000000..d787fe1 --- /dev/null +++ b/mk/vl_frag_0002.mk @@ -0,0 +1,10 @@ +# vl_frag_0002.mk - 정합성 빌드 조각 (참고용 include 단편) +# 이 조각은 상위 Makefile 이 아카이브/배포 시 참조하는 메타데이터다. +VL_FRAG_0002_MODULE := vl +VL_FRAG_0002_TIER := medium +VL_FRAG_0002_SRC := app/online/vl_ol_0001.pgc +VL_FRAG_0002_DESC := 정합성 validation 처리 단위 + +.PHONY: vl_frag_0002-info +vl_frag_0002-info: + @echo "vl_frag_0002 module=vl tier=medium transform=validation" diff --git a/mk/vl_frag_0003.mk b/mk/vl_frag_0003.mk new file mode 100644 index 0000000..113e54c --- /dev/null +++ b/mk/vl_frag_0003.mk @@ -0,0 +1,10 @@ +# vl_frag_0003.mk - 정합성 빌드 조각 (참고용 include 단편) +# 이 조각은 상위 Makefile 이 아카이브/배포 시 참조하는 메타데이터다. +VL_FRAG_0003_MODULE := vl +VL_FRAG_0003_TIER := easy +VL_FRAG_0003_SRC := app/online/vl_ol_0001.pgc +VL_FRAG_0003_DESC := 정합성 validation 처리 단위 + +.PHONY: vl_frag_0003-info +vl_frag_0003-info: + @echo "vl_frag_0003 module=vl tier=easy transform=validation" diff --git a/mk/vl_frag_0004.mk b/mk/vl_frag_0004.mk new file mode 100644 index 0000000..6e117ec --- /dev/null +++ b/mk/vl_frag_0004.mk @@ -0,0 +1,10 @@ +# vl_frag_0004.mk - 정합성 빌드 조각 (참고용 include 단편) +# 이 조각은 상위 Makefile 이 아카이브/배포 시 참조하는 메타데이터다. +VL_FRAG_0004_MODULE := vl +VL_FRAG_0004_TIER := hard +VL_FRAG_0004_SRC := app/online/vl_ol_0001.pgc +VL_FRAG_0004_DESC := 정합성 validation 처리 단위 + +.PHONY: vl_frag_0004-info +vl_frag_0004-info: + @echo "vl_frag_0004 module=vl tier=hard transform=validation" diff --git a/mk/vl_frag_0005.mk b/mk/vl_frag_0005.mk new file mode 100644 index 0000000..0076366 --- /dev/null +++ b/mk/vl_frag_0005.mk @@ -0,0 +1,10 @@ +# vl_frag_0005.mk - 정합성 빌드 조각 (참고용 include 단편) +# 이 조각은 상위 Makefile 이 아카이브/배포 시 참조하는 메타데이터다. +VL_FRAG_0005_MODULE := vl +VL_FRAG_0005_TIER := easy +VL_FRAG_0005_SRC := app/online/vl_ol_0001.pgc +VL_FRAG_0005_DESC := 정합성 validation 처리 단위 + +.PHONY: vl_frag_0005-info +vl_frag_0005-info: + @echo "vl_frag_0005 module=vl tier=easy transform=validation" diff --git a/mk/vl_frag_0006.mk b/mk/vl_frag_0006.mk new file mode 100644 index 0000000..91a8df9 --- /dev/null +++ b/mk/vl_frag_0006.mk @@ -0,0 +1,10 @@ +# vl_frag_0006.mk - 정합성 빌드 조각 (참고용 include 단편) +# 이 조각은 상위 Makefile 이 아카이브/배포 시 참조하는 메타데이터다. +VL_FRAG_0006_MODULE := vl +VL_FRAG_0006_TIER := hard +VL_FRAG_0006_SRC := app/online/vl_ol_0001.pgc +VL_FRAG_0006_DESC := 정합성 validation 처리 단위 + +.PHONY: vl_frag_0006-info +vl_frag_0006-info: + @echo "vl_frag_0006 module=vl tier=hard transform=validation" diff --git a/mk/vl_frag_0007.mk b/mk/vl_frag_0007.mk new file mode 100644 index 0000000..57c1240 --- /dev/null +++ b/mk/vl_frag_0007.mk @@ -0,0 +1,10 @@ +# vl_frag_0007.mk - 정합성 빌드 조각 (참고용 include 단편) +# 이 조각은 상위 Makefile 이 아카이브/배포 시 참조하는 메타데이터다. +VL_FRAG_0007_MODULE := vl +VL_FRAG_0007_TIER := easy +VL_FRAG_0007_SRC := app/online/vl_ol_0001.pgc +VL_FRAG_0007_DESC := 정합성 validation 처리 단위 + +.PHONY: vl_frag_0007-info +vl_frag_0007-info: + @echo "vl_frag_0007 module=vl tier=easy transform=validation" diff --git a/mk/vl_frag_0008.mk b/mk/vl_frag_0008.mk new file mode 100644 index 0000000..b723dbe --- /dev/null +++ b/mk/vl_frag_0008.mk @@ -0,0 +1,10 @@ +# vl_frag_0008.mk - 정합성 빌드 조각 (참고용 include 단편) +# 이 조각은 상위 Makefile 이 아카이브/배포 시 참조하는 메타데이터다. +VL_FRAG_0008_MODULE := vl +VL_FRAG_0008_TIER := easy +VL_FRAG_0008_SRC := app/online/vl_ol_0001.pgc +VL_FRAG_0008_DESC := 정합성 validation 처리 단위 + +.PHONY: vl_frag_0008-info +vl_frag_0008-info: + @echo "vl_frag_0008 module=vl tier=easy transform=validation" diff --git a/scripts/ac_run_0001.sh b/scripts/ac_run_0001.sh new file mode 100755 index 0000000..1e74177 --- /dev/null +++ b/scripts/ac_run_0001.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# ac_run_0001.sh - 매입 실행 러너 (easy) +# 사용법: ac_run_0001.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/ac_run_0001_${BIZDATE}.log" + +echo "[ac_run_0001] 매입 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/ac_bt_0001" ]; then + "${BIN}/ac_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[ac_run_0001] 실행 파일 없음: ${BIN}/ac_bt_0001" >&2 + RC=0 +fi +echo "[ac_run_0001] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/ac_run_0002.sh b/scripts/ac_run_0002.sh new file mode 100755 index 0000000..db0bc92 --- /dev/null +++ b/scripts/ac_run_0002.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# ac_run_0002.sh - 매입 실행 러너 (medium) +# 사용법: ac_run_0002.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/ac_run_0002_${BIZDATE}.log" + +echo "[ac_run_0002] 매입 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/ac_bt_0001" ]; then + "${BIN}/ac_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[ac_run_0002] 실행 파일 없음: ${BIN}/ac_bt_0001" >&2 + RC=0 +fi +echo "[ac_run_0002] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/ac_run_0003.sh b/scripts/ac_run_0003.sh new file mode 100755 index 0000000..62634c5 --- /dev/null +++ b/scripts/ac_run_0003.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# ac_run_0003.sh - 매입 실행 러너 (easy) +# 사용법: ac_run_0003.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/ac_run_0003_${BIZDATE}.log" + +echo "[ac_run_0003] 매입 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/ac_bt_0001" ]; then + "${BIN}/ac_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[ac_run_0003] 실행 파일 없음: ${BIN}/ac_bt_0001" >&2 + RC=0 +fi +echo "[ac_run_0003] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/ac_run_0004.sh b/scripts/ac_run_0004.sh new file mode 100755 index 0000000..9ddac48 --- /dev/null +++ b/scripts/ac_run_0004.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# ac_run_0004.sh - 매입 실행 러너 (medium) +# 사용법: ac_run_0004.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/ac_run_0004_${BIZDATE}.log" + +echo "[ac_run_0004] 매입 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/ac_bt_0001" ]; then + "${BIN}/ac_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[ac_run_0004] 실행 파일 없음: ${BIN}/ac_bt_0001" >&2 + RC=0 +fi +echo "[ac_run_0004] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/ac_run_0005.sh b/scripts/ac_run_0005.sh new file mode 100755 index 0000000..264c43c --- /dev/null +++ b/scripts/ac_run_0005.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# ac_run_0005.sh - 매입 실행 러너 (easy) +# 사용법: ac_run_0005.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/ac_run_0005_${BIZDATE}.log" + +echo "[ac_run_0005] 매입 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/ac_bt_0001" ]; then + "${BIN}/ac_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[ac_run_0005] 실행 파일 없음: ${BIN}/ac_bt_0001" >&2 + RC=0 +fi +echo "[ac_run_0005] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/ac_run_0006.sh b/scripts/ac_run_0006.sh new file mode 100755 index 0000000..3e4e251 --- /dev/null +++ b/scripts/ac_run_0006.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# ac_run_0006.sh - 매입 실행 러너 (hard) +# 사용법: ac_run_0006.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/ac_run_0006_${BIZDATE}.log" + +echo "[ac_run_0006] 매입 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/ac_bt_0001" ]; then + "${BIN}/ac_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[ac_run_0006] 실행 파일 없음: ${BIN}/ac_bt_0001" >&2 + RC=0 +fi +echo "[ac_run_0006] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/ac_run_0007.sh b/scripts/ac_run_0007.sh new file mode 100755 index 0000000..8520ad7 --- /dev/null +++ b/scripts/ac_run_0007.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# ac_run_0007.sh - 매입 실행 러너 (easy) +# 사용법: ac_run_0007.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/ac_run_0007_${BIZDATE}.log" + +echo "[ac_run_0007] 매입 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/ac_bt_0001" ]; then + "${BIN}/ac_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[ac_run_0007] 실행 파일 없음: ${BIN}/ac_bt_0001" >&2 + RC=0 +fi +echo "[ac_run_0007] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/ac_run_0008.sh b/scripts/ac_run_0008.sh new file mode 100755 index 0000000..2d0e831 --- /dev/null +++ b/scripts/ac_run_0008.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# ac_run_0008.sh - 매입 실행 러너 (hard) +# 사용법: ac_run_0008.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/ac_run_0008_${BIZDATE}.log" + +echo "[ac_run_0008] 매입 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/ac_bt_0001" ]; then + "${BIN}/ac_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[ac_run_0008] 실행 파일 없음: ${BIN}/ac_bt_0001" >&2 + RC=0 +fi +echo "[ac_run_0008] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/ac_run_0009.sh b/scripts/ac_run_0009.sh new file mode 100755 index 0000000..068d227 --- /dev/null +++ b/scripts/ac_run_0009.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# ac_run_0009.sh - 매입 실행 러너 (easy) +# 사용법: ac_run_0009.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/ac_run_0009_${BIZDATE}.log" + +echo "[ac_run_0009] 매입 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/ac_bt_0001" ]; then + "${BIN}/ac_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[ac_run_0009] 실행 파일 없음: ${BIN}/ac_bt_0001" >&2 + RC=0 +fi +echo "[ac_run_0009] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/ac_run_0010.sh b/scripts/ac_run_0010.sh new file mode 100755 index 0000000..9a3b39c --- /dev/null +++ b/scripts/ac_run_0010.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# ac_run_0010.sh - 매입 실행 러너 (easy) +# 사용법: ac_run_0010.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/ac_run_0010_${BIZDATE}.log" + +echo "[ac_run_0010] 매입 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/ac_bt_0001" ]; then + "${BIN}/ac_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[ac_run_0010] 실행 파일 없음: ${BIN}/ac_bt_0001" >&2 + RC=0 +fi +echo "[ac_run_0010] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/ac_run_0011.sh b/scripts/ac_run_0011.sh new file mode 100755 index 0000000..0dd868e --- /dev/null +++ b/scripts/ac_run_0011.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# ac_run_0011.sh - 매입 실행 러너 (medium) +# 사용법: ac_run_0011.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/ac_run_0011_${BIZDATE}.log" + +echo "[ac_run_0011] 매입 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/ac_bt_0001" ]; then + "${BIN}/ac_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[ac_run_0011] 실행 파일 없음: ${BIN}/ac_bt_0001" >&2 + RC=0 +fi +echo "[ac_run_0011] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/ac_run_0012.sh b/scripts/ac_run_0012.sh new file mode 100755 index 0000000..24b4029 --- /dev/null +++ b/scripts/ac_run_0012.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# ac_run_0012.sh - 매입 실행 러너 (easy) +# 사용법: ac_run_0012.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/ac_run_0012_${BIZDATE}.log" + +echo "[ac_run_0012] 매입 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/ac_bt_0001" ]; then + "${BIN}/ac_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[ac_run_0012] 실행 파일 없음: ${BIN}/ac_bt_0001" >&2 + RC=0 +fi +echo "[ac_run_0012] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/ac_run_0013.sh b/scripts/ac_run_0013.sh new file mode 100755 index 0000000..04efb9c --- /dev/null +++ b/scripts/ac_run_0013.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# ac_run_0013.sh - 매입 실행 러너 (medium) +# 사용법: ac_run_0013.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/ac_run_0013_${BIZDATE}.log" + +echo "[ac_run_0013] 매입 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/ac_bt_0001" ]; then + "${BIN}/ac_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[ac_run_0013] 실행 파일 없음: ${BIN}/ac_bt_0001" >&2 + RC=0 +fi +echo "[ac_run_0013] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/ac_run_0014.sh b/scripts/ac_run_0014.sh new file mode 100755 index 0000000..3496fcc --- /dev/null +++ b/scripts/ac_run_0014.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# ac_run_0014.sh - 매입 실행 러너 (easy) +# 사용법: ac_run_0014.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/ac_run_0014_${BIZDATE}.log" + +echo "[ac_run_0014] 매입 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/ac_bt_0001" ]; then + "${BIN}/ac_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[ac_run_0014] 실행 파일 없음: ${BIN}/ac_bt_0001" >&2 + RC=0 +fi +echo "[ac_run_0014] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/ac_run_0015.sh b/scripts/ac_run_0015.sh new file mode 100755 index 0000000..7bb83a2 --- /dev/null +++ b/scripts/ac_run_0015.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# ac_run_0015.sh - 매입 실행 러너 (medium) +# 사용법: ac_run_0015.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/ac_run_0015_${BIZDATE}.log" + +echo "[ac_run_0015] 매입 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/ac_bt_0001" ]; then + "${BIN}/ac_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[ac_run_0015] 실행 파일 없음: ${BIN}/ac_bt_0001" >&2 + RC=0 +fi +echo "[ac_run_0015] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/ac_run_0016.sh b/scripts/ac_run_0016.sh new file mode 100755 index 0000000..59ed619 --- /dev/null +++ b/scripts/ac_run_0016.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# ac_run_0016.sh - 매입 실행 러너 (easy) +# 사용법: ac_run_0016.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/ac_run_0016_${BIZDATE}.log" + +echo "[ac_run_0016] 매입 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/ac_bt_0001" ]; then + "${BIN}/ac_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[ac_run_0016] 실행 파일 없음: ${BIN}/ac_bt_0001" >&2 + RC=0 +fi +echo "[ac_run_0016] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/ac_run_0017.sh b/scripts/ac_run_0017.sh new file mode 100755 index 0000000..ca85736 --- /dev/null +++ b/scripts/ac_run_0017.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# ac_run_0017.sh - 매입 실행 러너 (hard) +# 사용법: ac_run_0017.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/ac_run_0017_${BIZDATE}.log" + +echo "[ac_run_0017] 매입 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/ac_bt_0001" ]; then + "${BIN}/ac_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[ac_run_0017] 실행 파일 없음: ${BIN}/ac_bt_0001" >&2 + RC=0 +fi +echo "[ac_run_0017] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/au_run_0001.sh b/scripts/au_run_0001.sh new file mode 100755 index 0000000..fabbf60 --- /dev/null +++ b/scripts/au_run_0001.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# au_run_0001.sh - 승인한도 실행 러너 (easy) +# 사용법: au_run_0001.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/au_run_0001_${BIZDATE}.log" + +echo "[au_run_0001] 승인한도 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/au_bt_0001" ]; then + "${BIN}/au_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[au_run_0001] 실행 파일 없음: ${BIN}/au_bt_0001" >&2 + RC=0 +fi +echo "[au_run_0001] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/au_run_0002.sh b/scripts/au_run_0002.sh new file mode 100755 index 0000000..7f355b9 --- /dev/null +++ b/scripts/au_run_0002.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# au_run_0002.sh - 승인한도 실행 러너 (medium) +# 사용법: au_run_0002.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/au_run_0002_${BIZDATE}.log" + +echo "[au_run_0002] 승인한도 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/au_bt_0001" ]; then + "${BIN}/au_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[au_run_0002] 실행 파일 없음: ${BIN}/au_bt_0001" >&2 + RC=0 +fi +echo "[au_run_0002] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/au_run_0003.sh b/scripts/au_run_0003.sh new file mode 100755 index 0000000..01909d6 --- /dev/null +++ b/scripts/au_run_0003.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# au_run_0003.sh - 승인한도 실행 러너 (easy) +# 사용법: au_run_0003.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/au_run_0003_${BIZDATE}.log" + +echo "[au_run_0003] 승인한도 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/au_bt_0001" ]; then + "${BIN}/au_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[au_run_0003] 실행 파일 없음: ${BIN}/au_bt_0001" >&2 + RC=0 +fi +echo "[au_run_0003] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/au_run_0004.sh b/scripts/au_run_0004.sh new file mode 100755 index 0000000..f2ea37c --- /dev/null +++ b/scripts/au_run_0004.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# au_run_0004.sh - 승인한도 실행 러너 (medium) +# 사용법: au_run_0004.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/au_run_0004_${BIZDATE}.log" + +echo "[au_run_0004] 승인한도 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/au_bt_0001" ]; then + "${BIN}/au_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[au_run_0004] 실행 파일 없음: ${BIN}/au_bt_0001" >&2 + RC=0 +fi +echo "[au_run_0004] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/au_run_0005.sh b/scripts/au_run_0005.sh new file mode 100755 index 0000000..4716c0d --- /dev/null +++ b/scripts/au_run_0005.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# au_run_0005.sh - 승인한도 실행 러너 (easy) +# 사용법: au_run_0005.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/au_run_0005_${BIZDATE}.log" + +echo "[au_run_0005] 승인한도 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/au_bt_0001" ]; then + "${BIN}/au_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[au_run_0005] 실행 파일 없음: ${BIN}/au_bt_0001" >&2 + RC=0 +fi +echo "[au_run_0005] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/au_run_0006.sh b/scripts/au_run_0006.sh new file mode 100755 index 0000000..db51991 --- /dev/null +++ b/scripts/au_run_0006.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# au_run_0006.sh - 승인한도 실행 러너 (medium) +# 사용법: au_run_0006.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/au_run_0006_${BIZDATE}.log" + +echo "[au_run_0006] 승인한도 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/au_bt_0001" ]; then + "${BIN}/au_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[au_run_0006] 실행 파일 없음: ${BIN}/au_bt_0001" >&2 + RC=0 +fi +echo "[au_run_0006] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/au_run_0007.sh b/scripts/au_run_0007.sh new file mode 100755 index 0000000..0bd788d --- /dev/null +++ b/scripts/au_run_0007.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# au_run_0007.sh - 승인한도 실행 러너 (easy) +# 사용법: au_run_0007.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/au_run_0007_${BIZDATE}.log" + +echo "[au_run_0007] 승인한도 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/au_bt_0001" ]; then + "${BIN}/au_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[au_run_0007] 실행 파일 없음: ${BIN}/au_bt_0001" >&2 + RC=0 +fi +echo "[au_run_0007] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/au_run_0008.sh b/scripts/au_run_0008.sh new file mode 100755 index 0000000..26020e8 --- /dev/null +++ b/scripts/au_run_0008.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# au_run_0008.sh - 승인한도 실행 러너 (hard) +# 사용법: au_run_0008.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/au_run_0008_${BIZDATE}.log" + +echo "[au_run_0008] 승인한도 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/au_bt_0001" ]; then + "${BIN}/au_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[au_run_0008] 실행 파일 없음: ${BIN}/au_bt_0001" >&2 + RC=0 +fi +echo "[au_run_0008] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/au_run_0009.sh b/scripts/au_run_0009.sh new file mode 100755 index 0000000..c36b5d2 --- /dev/null +++ b/scripts/au_run_0009.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# au_run_0009.sh - 승인한도 실행 러너 (easy) +# 사용법: au_run_0009.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/au_run_0009_${BIZDATE}.log" + +echo "[au_run_0009] 승인한도 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/au_bt_0001" ]; then + "${BIN}/au_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[au_run_0009] 실행 파일 없음: ${BIN}/au_bt_0001" >&2 + RC=0 +fi +echo "[au_run_0009] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/au_run_0010.sh b/scripts/au_run_0010.sh new file mode 100755 index 0000000..42436a2 --- /dev/null +++ b/scripts/au_run_0010.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# au_run_0010.sh - 승인한도 실행 러너 (easy) +# 사용법: au_run_0010.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/au_run_0010_${BIZDATE}.log" + +echo "[au_run_0010] 승인한도 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/au_bt_0001" ]; then + "${BIN}/au_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[au_run_0010] 실행 파일 없음: ${BIN}/au_bt_0001" >&2 + RC=0 +fi +echo "[au_run_0010] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/au_run_0011.sh b/scripts/au_run_0011.sh new file mode 100755 index 0000000..a588840 --- /dev/null +++ b/scripts/au_run_0011.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# au_run_0011.sh - 승인한도 실행 러너 (medium) +# 사용법: au_run_0011.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/au_run_0011_${BIZDATE}.log" + +echo "[au_run_0011] 승인한도 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/au_bt_0001" ]; then + "${BIN}/au_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[au_run_0011] 실행 파일 없음: ${BIN}/au_bt_0001" >&2 + RC=0 +fi +echo "[au_run_0011] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/au_run_0012.sh b/scripts/au_run_0012.sh new file mode 100755 index 0000000..e135405 --- /dev/null +++ b/scripts/au_run_0012.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# au_run_0012.sh - 승인한도 실행 러너 (easy) +# 사용법: au_run_0012.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/au_run_0012_${BIZDATE}.log" + +echo "[au_run_0012] 승인한도 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/au_bt_0001" ]; then + "${BIN}/au_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[au_run_0012] 실행 파일 없음: ${BIN}/au_bt_0001" >&2 + RC=0 +fi +echo "[au_run_0012] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/au_run_0013.sh b/scripts/au_run_0013.sh new file mode 100755 index 0000000..db2f902 --- /dev/null +++ b/scripts/au_run_0013.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# au_run_0013.sh - 승인한도 실행 러너 (medium) +# 사용법: au_run_0013.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/au_run_0013_${BIZDATE}.log" + +echo "[au_run_0013] 승인한도 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/au_bt_0001" ]; then + "${BIN}/au_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[au_run_0013] 실행 파일 없음: ${BIN}/au_bt_0001" >&2 + RC=0 +fi +echo "[au_run_0013] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/au_run_0014.sh b/scripts/au_run_0014.sh new file mode 100755 index 0000000..32fe109 --- /dev/null +++ b/scripts/au_run_0014.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# au_run_0014.sh - 승인한도 실행 러너 (easy) +# 사용법: au_run_0014.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/au_run_0014_${BIZDATE}.log" + +echo "[au_run_0014] 승인한도 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/au_bt_0001" ]; then + "${BIN}/au_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[au_run_0014] 실행 파일 없음: ${BIN}/au_bt_0001" >&2 + RC=0 +fi +echo "[au_run_0014] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/au_run_0015.sh b/scripts/au_run_0015.sh new file mode 100755 index 0000000..dbde7ec --- /dev/null +++ b/scripts/au_run_0015.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# au_run_0015.sh - 승인한도 실행 러너 (medium) +# 사용법: au_run_0015.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/au_run_0015_${BIZDATE}.log" + +echo "[au_run_0015] 승인한도 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/au_bt_0001" ]; then + "${BIN}/au_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[au_run_0015] 실행 파일 없음: ${BIN}/au_bt_0001" >&2 + RC=0 +fi +echo "[au_run_0015] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/au_run_0016.sh b/scripts/au_run_0016.sh new file mode 100755 index 0000000..1adbb54 --- /dev/null +++ b/scripts/au_run_0016.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# au_run_0016.sh - 승인한도 실행 러너 (easy) +# 사용법: au_run_0016.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/au_run_0016_${BIZDATE}.log" + +echo "[au_run_0016] 승인한도 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/au_bt_0001" ]; then + "${BIN}/au_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[au_run_0016] 실행 파일 없음: ${BIN}/au_bt_0001" >&2 + RC=0 +fi +echo "[au_run_0016] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/au_run_0017.sh b/scripts/au_run_0017.sh new file mode 100755 index 0000000..3cf0c73 --- /dev/null +++ b/scripts/au_run_0017.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# au_run_0017.sh - 승인한도 실행 러너 (hard) +# 사용법: au_run_0017.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/au_run_0017_${BIZDATE}.log" + +echo "[au_run_0017] 승인한도 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/au_bt_0001" ]; then + "${BIN}/au_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[au_run_0017] 실행 파일 없음: ${BIN}/au_bt_0001" >&2 + RC=0 +fi +echo "[au_run_0017] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/cl_run_0001.sh b/scripts/cl_run_0001.sh new file mode 100755 index 0000000..1e043dd --- /dev/null +++ b/scripts/cl_run_0001.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# cl_run_0001.sh - 마감 실행 러너 (easy) +# 사용법: cl_run_0001.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/cl_run_0001_${BIZDATE}.log" + +echo "[cl_run_0001] 마감 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/demo_cl_batch" ]; then + "${BIN}/demo_cl_batch" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[cl_run_0001] 실행 파일 없음: ${BIN}/demo_cl_batch" >&2 + RC=0 +fi +echo "[cl_run_0001] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/cl_run_0002.sh b/scripts/cl_run_0002.sh new file mode 100755 index 0000000..e9f38a4 --- /dev/null +++ b/scripts/cl_run_0002.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# cl_run_0002.sh - 마감 실행 러너 (easy) +# 사용법: cl_run_0002.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/cl_run_0002_${BIZDATE}.log" + +echo "[cl_run_0002] 마감 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/demo_cl_batch" ]; then + "${BIN}/demo_cl_batch" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[cl_run_0002] 실행 파일 없음: ${BIN}/demo_cl_batch" >&2 + RC=0 +fi +echo "[cl_run_0002] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/cl_run_0003.sh b/scripts/cl_run_0003.sh new file mode 100755 index 0000000..69079ac --- /dev/null +++ b/scripts/cl_run_0003.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# cl_run_0003.sh - 마감 실행 러너 (medium) +# 사용법: cl_run_0003.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/cl_run_0003_${BIZDATE}.log" + +echo "[cl_run_0003] 마감 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/demo_cl_batch" ]; then + "${BIN}/demo_cl_batch" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[cl_run_0003] 실행 파일 없음: ${BIN}/demo_cl_batch" >&2 + RC=0 +fi +echo "[cl_run_0003] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/cl_run_0004.sh b/scripts/cl_run_0004.sh new file mode 100755 index 0000000..a444267 --- /dev/null +++ b/scripts/cl_run_0004.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# cl_run_0004.sh - 마감 실행 러너 (easy) +# 사용법: cl_run_0004.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/cl_run_0004_${BIZDATE}.log" + +echo "[cl_run_0004] 마감 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/demo_cl_batch" ]; then + "${BIN}/demo_cl_batch" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[cl_run_0004] 실행 파일 없음: ${BIN}/demo_cl_batch" >&2 + RC=0 +fi +echo "[cl_run_0004] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/cl_run_0005.sh b/scripts/cl_run_0005.sh new file mode 100755 index 0000000..69a6470 --- /dev/null +++ b/scripts/cl_run_0005.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# cl_run_0005.sh - 마감 실행 러너 (medium) +# 사용법: cl_run_0005.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/cl_run_0005_${BIZDATE}.log" + +echo "[cl_run_0005] 마감 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/demo_cl_batch" ]; then + "${BIN}/demo_cl_batch" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[cl_run_0005] 실행 파일 없음: ${BIN}/demo_cl_batch" >&2 + RC=0 +fi +echo "[cl_run_0005] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/cl_run_0006.sh b/scripts/cl_run_0006.sh new file mode 100755 index 0000000..def7817 --- /dev/null +++ b/scripts/cl_run_0006.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# cl_run_0006.sh - 마감 실행 러너 (easy) +# 사용법: cl_run_0006.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/cl_run_0006_${BIZDATE}.log" + +echo "[cl_run_0006] 마감 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/demo_cl_batch" ]; then + "${BIN}/demo_cl_batch" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[cl_run_0006] 실행 파일 없음: ${BIN}/demo_cl_batch" >&2 + RC=0 +fi +echo "[cl_run_0006] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/cl_run_0007.sh b/scripts/cl_run_0007.sh new file mode 100755 index 0000000..055f73c --- /dev/null +++ b/scripts/cl_run_0007.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# cl_run_0007.sh - 마감 실행 러너 (medium) +# 사용법: cl_run_0007.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/cl_run_0007_${BIZDATE}.log" + +echo "[cl_run_0007] 마감 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/demo_cl_batch" ]; then + "${BIN}/demo_cl_batch" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[cl_run_0007] 실행 파일 없음: ${BIN}/demo_cl_batch" >&2 + RC=0 +fi +echo "[cl_run_0007] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/cl_run_0008.sh b/scripts/cl_run_0008.sh new file mode 100755 index 0000000..a446ac3 --- /dev/null +++ b/scripts/cl_run_0008.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# cl_run_0008.sh - 마감 실행 러너 (easy) +# 사용법: cl_run_0008.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/cl_run_0008_${BIZDATE}.log" + +echo "[cl_run_0008] 마감 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/demo_cl_batch" ]; then + "${BIN}/demo_cl_batch" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[cl_run_0008] 실행 파일 없음: ${BIN}/demo_cl_batch" >&2 + RC=0 +fi +echo "[cl_run_0008] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/cl_run_0009.sh b/scripts/cl_run_0009.sh new file mode 100755 index 0000000..fe0625d --- /dev/null +++ b/scripts/cl_run_0009.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# cl_run_0009.sh - 마감 실행 러너 (hard) +# 사용법: cl_run_0009.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/cl_run_0009_${BIZDATE}.log" + +echo "[cl_run_0009] 마감 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/demo_cl_batch" ]; then + "${BIN}/demo_cl_batch" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[cl_run_0009] 실행 파일 없음: ${BIN}/demo_cl_batch" >&2 + RC=0 +fi +echo "[cl_run_0009] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/cl_run_0010.sh b/scripts/cl_run_0010.sh new file mode 100755 index 0000000..a29126c --- /dev/null +++ b/scripts/cl_run_0010.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# cl_run_0010.sh - 마감 실행 러너 (easy) +# 사용법: cl_run_0010.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/cl_run_0010_${BIZDATE}.log" + +echo "[cl_run_0010] 마감 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/demo_cl_batch" ]; then + "${BIN}/demo_cl_batch" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[cl_run_0010] 실행 파일 없음: ${BIN}/demo_cl_batch" >&2 + RC=0 +fi +echo "[cl_run_0010] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/cl_run_0011.sh b/scripts/cl_run_0011.sh new file mode 100755 index 0000000..d23e529 --- /dev/null +++ b/scripts/cl_run_0011.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# cl_run_0011.sh - 마감 실행 러너 (easy) +# 사용법: cl_run_0011.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/cl_run_0011_${BIZDATE}.log" + +echo "[cl_run_0011] 마감 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/demo_cl_batch" ]; then + "${BIN}/demo_cl_batch" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[cl_run_0011] 실행 파일 없음: ${BIN}/demo_cl_batch" >&2 + RC=0 +fi +echo "[cl_run_0011] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/cl_run_0012.sh b/scripts/cl_run_0012.sh new file mode 100755 index 0000000..68a0ea0 --- /dev/null +++ b/scripts/cl_run_0012.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# cl_run_0012.sh - 마감 실행 러너 (medium) +# 사용법: cl_run_0012.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/cl_run_0012_${BIZDATE}.log" + +echo "[cl_run_0012] 마감 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/demo_cl_batch" ]; then + "${BIN}/demo_cl_batch" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[cl_run_0012] 실행 파일 없음: ${BIN}/demo_cl_batch" >&2 + RC=0 +fi +echo "[cl_run_0012] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/cl_run_0013.sh b/scripts/cl_run_0013.sh new file mode 100755 index 0000000..973f6e0 --- /dev/null +++ b/scripts/cl_run_0013.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# cl_run_0013.sh - 마감 실행 러너 (easy) +# 사용법: cl_run_0013.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/cl_run_0013_${BIZDATE}.log" + +echo "[cl_run_0013] 마감 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/demo_cl_batch" ]; then + "${BIN}/demo_cl_batch" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[cl_run_0013] 실행 파일 없음: ${BIN}/demo_cl_batch" >&2 + RC=0 +fi +echo "[cl_run_0013] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/cl_run_0014.sh b/scripts/cl_run_0014.sh new file mode 100755 index 0000000..287c0cd --- /dev/null +++ b/scripts/cl_run_0014.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# cl_run_0014.sh - 마감 실행 러너 (medium) +# 사용법: cl_run_0014.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/cl_run_0014_${BIZDATE}.log" + +echo "[cl_run_0014] 마감 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/demo_cl_batch" ]; then + "${BIN}/demo_cl_batch" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[cl_run_0014] 실행 파일 없음: ${BIN}/demo_cl_batch" >&2 + RC=0 +fi +echo "[cl_run_0014] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/cl_run_0015.sh b/scripts/cl_run_0015.sh new file mode 100755 index 0000000..ac81b6b --- /dev/null +++ b/scripts/cl_run_0015.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# cl_run_0015.sh - 마감 실행 러너 (easy) +# 사용법: cl_run_0015.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/cl_run_0015_${BIZDATE}.log" + +echo "[cl_run_0015] 마감 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/demo_cl_batch" ]; then + "${BIN}/demo_cl_batch" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[cl_run_0015] 실행 파일 없음: ${BIN}/demo_cl_batch" >&2 + RC=0 +fi +echo "[cl_run_0015] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/cl_run_0016.sh b/scripts/cl_run_0016.sh new file mode 100755 index 0000000..53f5fc6 --- /dev/null +++ b/scripts/cl_run_0016.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# cl_run_0016.sh - 마감 실행 러너 (medium) +# 사용법: cl_run_0016.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/cl_run_0016_${BIZDATE}.log" + +echo "[cl_run_0016] 마감 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/demo_cl_batch" ]; then + "${BIN}/demo_cl_batch" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[cl_run_0016] 실행 파일 없음: ${BIN}/demo_cl_batch" >&2 + RC=0 +fi +echo "[cl_run_0016] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/cm_run_0001.sh b/scripts/cm_run_0001.sh new file mode 100755 index 0000000..3e374e6 --- /dev/null +++ b/scripts/cm_run_0001.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# cm_run_0001.sh - 공통 실행 러너 (easy) +# 사용법: cm_run_0001.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/cm_run_0001_${BIZDATE}.log" + +echo "[cm_run_0001] 공통 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/cm_bt_0001" ]; then + "${BIN}/cm_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[cm_run_0001] 실행 파일 없음: ${BIN}/cm_bt_0001" >&2 + RC=0 +fi +echo "[cm_run_0001] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/cm_run_0002.sh b/scripts/cm_run_0002.sh new file mode 100755 index 0000000..10678fc --- /dev/null +++ b/scripts/cm_run_0002.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# cm_run_0002.sh - 공통 실행 러너 (easy) +# 사용법: cm_run_0002.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/cm_run_0002_${BIZDATE}.log" + +echo "[cm_run_0002] 공통 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/cm_bt_0001" ]; then + "${BIN}/cm_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[cm_run_0002] 실행 파일 없음: ${BIN}/cm_bt_0001" >&2 + RC=0 +fi +echo "[cm_run_0002] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/cm_run_0003.sh b/scripts/cm_run_0003.sh new file mode 100755 index 0000000..666b953 --- /dev/null +++ b/scripts/cm_run_0003.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# cm_run_0003.sh - 공통 실행 러너 (medium) +# 사용법: cm_run_0003.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/cm_run_0003_${BIZDATE}.log" + +echo "[cm_run_0003] 공통 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/cm_bt_0001" ]; then + "${BIN}/cm_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[cm_run_0003] 실행 파일 없음: ${BIN}/cm_bt_0001" >&2 + RC=0 +fi +echo "[cm_run_0003] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/cm_run_0004.sh b/scripts/cm_run_0004.sh new file mode 100755 index 0000000..fe71bfb --- /dev/null +++ b/scripts/cm_run_0004.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# cm_run_0004.sh - 공통 실행 러너 (easy) +# 사용법: cm_run_0004.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/cm_run_0004_${BIZDATE}.log" + +echo "[cm_run_0004] 공통 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/cm_bt_0001" ]; then + "${BIN}/cm_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[cm_run_0004] 실행 파일 없음: ${BIN}/cm_bt_0001" >&2 + RC=0 +fi +echo "[cm_run_0004] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/cm_run_0005.sh b/scripts/cm_run_0005.sh new file mode 100755 index 0000000..97ea1eb --- /dev/null +++ b/scripts/cm_run_0005.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# cm_run_0005.sh - 공통 실행 러너 (medium) +# 사용법: cm_run_0005.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/cm_run_0005_${BIZDATE}.log" + +echo "[cm_run_0005] 공통 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/cm_bt_0001" ]; then + "${BIN}/cm_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[cm_run_0005] 실행 파일 없음: ${BIN}/cm_bt_0001" >&2 + RC=0 +fi +echo "[cm_run_0005] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/cm_run_0006.sh b/scripts/cm_run_0006.sh new file mode 100755 index 0000000..2f62584 --- /dev/null +++ b/scripts/cm_run_0006.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# cm_run_0006.sh - 공통 실행 러너 (easy) +# 사용법: cm_run_0006.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/cm_run_0006_${BIZDATE}.log" + +echo "[cm_run_0006] 공통 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/cm_bt_0001" ]; then + "${BIN}/cm_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[cm_run_0006] 실행 파일 없음: ${BIN}/cm_bt_0001" >&2 + RC=0 +fi +echo "[cm_run_0006] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/cm_run_0007.sh b/scripts/cm_run_0007.sh new file mode 100755 index 0000000..b25f9b7 --- /dev/null +++ b/scripts/cm_run_0007.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# cm_run_0007.sh - 공통 실행 러너 (medium) +# 사용법: cm_run_0007.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/cm_run_0007_${BIZDATE}.log" + +echo "[cm_run_0007] 공통 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/cm_bt_0001" ]; then + "${BIN}/cm_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[cm_run_0007] 실행 파일 없음: ${BIN}/cm_bt_0001" >&2 + RC=0 +fi +echo "[cm_run_0007] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/cm_run_0008.sh b/scripts/cm_run_0008.sh new file mode 100755 index 0000000..d28d198 --- /dev/null +++ b/scripts/cm_run_0008.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# cm_run_0008.sh - 공통 실행 러너 (easy) +# 사용법: cm_run_0008.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/cm_run_0008_${BIZDATE}.log" + +echo "[cm_run_0008] 공통 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/cm_bt_0001" ]; then + "${BIN}/cm_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[cm_run_0008] 실행 파일 없음: ${BIN}/cm_bt_0001" >&2 + RC=0 +fi +echo "[cm_run_0008] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/cm_run_0009.sh b/scripts/cm_run_0009.sh new file mode 100755 index 0000000..fcc9cc5 --- /dev/null +++ b/scripts/cm_run_0009.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# cm_run_0009.sh - 공통 실행 러너 (hard) +# 사용법: cm_run_0009.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/cm_run_0009_${BIZDATE}.log" + +echo "[cm_run_0009] 공통 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/cm_bt_0001" ]; then + "${BIN}/cm_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[cm_run_0009] 실행 파일 없음: ${BIN}/cm_bt_0001" >&2 + RC=0 +fi +echo "[cm_run_0009] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/cm_run_0010.sh b/scripts/cm_run_0010.sh new file mode 100755 index 0000000..0077201 --- /dev/null +++ b/scripts/cm_run_0010.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# cm_run_0010.sh - 공통 실행 러너 (easy) +# 사용법: cm_run_0010.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/cm_run_0010_${BIZDATE}.log" + +echo "[cm_run_0010] 공통 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/cm_bt_0001" ]; then + "${BIN}/cm_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[cm_run_0010] 실행 파일 없음: ${BIN}/cm_bt_0001" >&2 + RC=0 +fi +echo "[cm_run_0010] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/cm_run_0011.sh b/scripts/cm_run_0011.sh new file mode 100755 index 0000000..323ec6e --- /dev/null +++ b/scripts/cm_run_0011.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# cm_run_0011.sh - 공통 실행 러너 (hard) +# 사용법: cm_run_0011.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/cm_run_0011_${BIZDATE}.log" + +echo "[cm_run_0011] 공통 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/cm_bt_0001" ]; then + "${BIN}/cm_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[cm_run_0011] 실행 파일 없음: ${BIN}/cm_bt_0001" >&2 + RC=0 +fi +echo "[cm_run_0011] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/cm_run_0012.sh b/scripts/cm_run_0012.sh new file mode 100755 index 0000000..2223073 --- /dev/null +++ b/scripts/cm_run_0012.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# cm_run_0012.sh - 공통 실행 러너 (easy) +# 사용법: cm_run_0012.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/cm_run_0012_${BIZDATE}.log" + +echo "[cm_run_0012] 공통 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/cm_bt_0001" ]; then + "${BIN}/cm_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[cm_run_0012] 실행 파일 없음: ${BIN}/cm_bt_0001" >&2 + RC=0 +fi +echo "[cm_run_0012] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/cm_run_0013.sh b/scripts/cm_run_0013.sh new file mode 100755 index 0000000..9649536 --- /dev/null +++ b/scripts/cm_run_0013.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# cm_run_0013.sh - 공통 실행 러너 (easy) +# 사용법: cm_run_0013.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/cm_run_0013_${BIZDATE}.log" + +echo "[cm_run_0013] 공통 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/cm_bt_0001" ]; then + "${BIN}/cm_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[cm_run_0013] 실행 파일 없음: ${BIN}/cm_bt_0001" >&2 + RC=0 +fi +echo "[cm_run_0013] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/cm_run_0014.sh b/scripts/cm_run_0014.sh new file mode 100755 index 0000000..727ee95 --- /dev/null +++ b/scripts/cm_run_0014.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# cm_run_0014.sh - 공통 실행 러너 (medium) +# 사용법: cm_run_0014.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/cm_run_0014_${BIZDATE}.log" + +echo "[cm_run_0014] 공통 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/cm_bt_0001" ]; then + "${BIN}/cm_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[cm_run_0014] 실행 파일 없음: ${BIN}/cm_bt_0001" >&2 + RC=0 +fi +echo "[cm_run_0014] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/cm_run_0015.sh b/scripts/cm_run_0015.sh new file mode 100755 index 0000000..fedf02c --- /dev/null +++ b/scripts/cm_run_0015.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# cm_run_0015.sh - 공통 실행 러너 (easy) +# 사용법: cm_run_0015.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/cm_run_0015_${BIZDATE}.log" + +echo "[cm_run_0015] 공통 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/cm_bt_0001" ]; then + "${BIN}/cm_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[cm_run_0015] 실행 파일 없음: ${BIN}/cm_bt_0001" >&2 + RC=0 +fi +echo "[cm_run_0015] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/cm_run_0016.sh b/scripts/cm_run_0016.sh new file mode 100755 index 0000000..4ed4fd2 --- /dev/null +++ b/scripts/cm_run_0016.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# cm_run_0016.sh - 공통 실행 러너 (medium) +# 사용법: cm_run_0016.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/cm_run_0016_${BIZDATE}.log" + +echo "[cm_run_0016] 공통 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/cm_bt_0001" ]; then + "${BIN}/cm_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[cm_run_0016] 실행 파일 없음: ${BIN}/cm_bt_0001" >&2 + RC=0 +fi +echo "[cm_run_0016] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/lg_run_0001.sh b/scripts/lg_run_0001.sh new file mode 100755 index 0000000..8f39c3a --- /dev/null +++ b/scripts/lg_run_0001.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# lg_run_0001.sh - 원장 실행 러너 (easy) +# 사용법: lg_run_0001.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/lg_run_0001_${BIZDATE}.log" + +echo "[lg_run_0001] 원장 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/lg_bt_0001" ]; then + "${BIN}/lg_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[lg_run_0001] 실행 파일 없음: ${BIN}/lg_bt_0001" >&2 + RC=0 +fi +echo "[lg_run_0001] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/lg_run_0002.sh b/scripts/lg_run_0002.sh new file mode 100755 index 0000000..08ab8b6 --- /dev/null +++ b/scripts/lg_run_0002.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# lg_run_0002.sh - 원장 실행 러너 (hard) +# 사용법: lg_run_0002.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/lg_run_0002_${BIZDATE}.log" + +echo "[lg_run_0002] 원장 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/lg_bt_0001" ]; then + "${BIN}/lg_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[lg_run_0002] 실행 파일 없음: ${BIN}/lg_bt_0001" >&2 + RC=0 +fi +echo "[lg_run_0002] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/lg_run_0003.sh b/scripts/lg_run_0003.sh new file mode 100755 index 0000000..9e3d75b --- /dev/null +++ b/scripts/lg_run_0003.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# lg_run_0003.sh - 원장 실행 러너 (easy) +# 사용법: lg_run_0003.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/lg_run_0003_${BIZDATE}.log" + +echo "[lg_run_0003] 원장 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/lg_bt_0001" ]; then + "${BIN}/lg_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[lg_run_0003] 실행 파일 없음: ${BIN}/lg_bt_0001" >&2 + RC=0 +fi +echo "[lg_run_0003] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/lg_run_0004.sh b/scripts/lg_run_0004.sh new file mode 100755 index 0000000..2c52f1a --- /dev/null +++ b/scripts/lg_run_0004.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# lg_run_0004.sh - 원장 실행 러너 (easy) +# 사용법: lg_run_0004.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/lg_run_0004_${BIZDATE}.log" + +echo "[lg_run_0004] 원장 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/lg_bt_0001" ]; then + "${BIN}/lg_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[lg_run_0004] 실행 파일 없음: ${BIN}/lg_bt_0001" >&2 + RC=0 +fi +echo "[lg_run_0004] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/lg_run_0005.sh b/scripts/lg_run_0005.sh new file mode 100755 index 0000000..67e911e --- /dev/null +++ b/scripts/lg_run_0005.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# lg_run_0005.sh - 원장 실행 러너 (medium) +# 사용법: lg_run_0005.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/lg_run_0005_${BIZDATE}.log" + +echo "[lg_run_0005] 원장 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/lg_bt_0001" ]; then + "${BIN}/lg_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[lg_run_0005] 실행 파일 없음: ${BIN}/lg_bt_0001" >&2 + RC=0 +fi +echo "[lg_run_0005] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/lg_run_0006.sh b/scripts/lg_run_0006.sh new file mode 100755 index 0000000..51dfea0 --- /dev/null +++ b/scripts/lg_run_0006.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# lg_run_0006.sh - 원장 실행 러너 (easy) +# 사용법: lg_run_0006.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/lg_run_0006_${BIZDATE}.log" + +echo "[lg_run_0006] 원장 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/lg_bt_0001" ]; then + "${BIN}/lg_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[lg_run_0006] 실행 파일 없음: ${BIN}/lg_bt_0001" >&2 + RC=0 +fi +echo "[lg_run_0006] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/lg_run_0007.sh b/scripts/lg_run_0007.sh new file mode 100755 index 0000000..0c56791 --- /dev/null +++ b/scripts/lg_run_0007.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# lg_run_0007.sh - 원장 실행 러너 (medium) +# 사용법: lg_run_0007.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/lg_run_0007_${BIZDATE}.log" + +echo "[lg_run_0007] 원장 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/lg_bt_0001" ]; then + "${BIN}/lg_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[lg_run_0007] 실행 파일 없음: ${BIN}/lg_bt_0001" >&2 + RC=0 +fi +echo "[lg_run_0007] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/lg_run_0008.sh b/scripts/lg_run_0008.sh new file mode 100755 index 0000000..59ccb34 --- /dev/null +++ b/scripts/lg_run_0008.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# lg_run_0008.sh - 원장 실행 러너 (easy) +# 사용법: lg_run_0008.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/lg_run_0008_${BIZDATE}.log" + +echo "[lg_run_0008] 원장 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/lg_bt_0001" ]; then + "${BIN}/lg_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[lg_run_0008] 실행 파일 없음: ${BIN}/lg_bt_0001" >&2 + RC=0 +fi +echo "[lg_run_0008] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/lg_run_0009.sh b/scripts/lg_run_0009.sh new file mode 100755 index 0000000..b670a67 --- /dev/null +++ b/scripts/lg_run_0009.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# lg_run_0009.sh - 원장 실행 러너 (medium) +# 사용법: lg_run_0009.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/lg_run_0009_${BIZDATE}.log" + +echo "[lg_run_0009] 원장 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/lg_bt_0001" ]; then + "${BIN}/lg_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[lg_run_0009] 실행 파일 없음: ${BIN}/lg_bt_0001" >&2 + RC=0 +fi +echo "[lg_run_0009] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/lg_run_0010.sh b/scripts/lg_run_0010.sh new file mode 100755 index 0000000..7d0b286 --- /dev/null +++ b/scripts/lg_run_0010.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# lg_run_0010.sh - 원장 실행 러너 (easy) +# 사용법: lg_run_0010.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/lg_run_0010_${BIZDATE}.log" + +echo "[lg_run_0010] 원장 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/lg_bt_0001" ]; then + "${BIN}/lg_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[lg_run_0010] 실행 파일 없음: ${BIN}/lg_bt_0001" >&2 + RC=0 +fi +echo "[lg_run_0010] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/lg_run_0011.sh b/scripts/lg_run_0011.sh new file mode 100755 index 0000000..37b2373 --- /dev/null +++ b/scripts/lg_run_0011.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# lg_run_0011.sh - 원장 실행 러너 (hard) +# 사용법: lg_run_0011.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/lg_run_0011_${BIZDATE}.log" + +echo "[lg_run_0011] 원장 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/lg_bt_0001" ]; then + "${BIN}/lg_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[lg_run_0011] 실행 파일 없음: ${BIN}/lg_bt_0001" >&2 + RC=0 +fi +echo "[lg_run_0011] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/lg_run_0012.sh b/scripts/lg_run_0012.sh new file mode 100755 index 0000000..400a51d --- /dev/null +++ b/scripts/lg_run_0012.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# lg_run_0012.sh - 원장 실행 러너 (easy) +# 사용법: lg_run_0012.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/lg_run_0012_${BIZDATE}.log" + +echo "[lg_run_0012] 원장 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/lg_bt_0001" ]; then + "${BIN}/lg_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[lg_run_0012] 실행 파일 없음: ${BIN}/lg_bt_0001" >&2 + RC=0 +fi +echo "[lg_run_0012] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/lg_run_0013.sh b/scripts/lg_run_0013.sh new file mode 100755 index 0000000..d7fa355 --- /dev/null +++ b/scripts/lg_run_0013.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# lg_run_0013.sh - 원장 실행 러너 (hard) +# 사용법: lg_run_0013.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/lg_run_0013_${BIZDATE}.log" + +echo "[lg_run_0013] 원장 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/lg_bt_0001" ]; then + "${BIN}/lg_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[lg_run_0013] 실행 파일 없음: ${BIN}/lg_bt_0001" >&2 + RC=0 +fi +echo "[lg_run_0013] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/lg_run_0014.sh b/scripts/lg_run_0014.sh new file mode 100755 index 0000000..e1274f3 --- /dev/null +++ b/scripts/lg_run_0014.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# lg_run_0014.sh - 원장 실행 러너 (easy) +# 사용법: lg_run_0014.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/lg_run_0014_${BIZDATE}.log" + +echo "[lg_run_0014] 원장 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/lg_bt_0001" ]; then + "${BIN}/lg_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[lg_run_0014] 실행 파일 없음: ${BIN}/lg_bt_0001" >&2 + RC=0 +fi +echo "[lg_run_0014] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/lg_run_0015.sh b/scripts/lg_run_0015.sh new file mode 100755 index 0000000..96e8c34 --- /dev/null +++ b/scripts/lg_run_0015.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# lg_run_0015.sh - 원장 실행 러너 (easy) +# 사용법: lg_run_0015.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/lg_run_0015_${BIZDATE}.log" + +echo "[lg_run_0015] 원장 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/lg_bt_0001" ]; then + "${BIN}/lg_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[lg_run_0015] 실행 파일 없음: ${BIN}/lg_bt_0001" >&2 + RC=0 +fi +echo "[lg_run_0015] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/lg_run_0016.sh b/scripts/lg_run_0016.sh new file mode 100755 index 0000000..d324f33 --- /dev/null +++ b/scripts/lg_run_0016.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# lg_run_0016.sh - 원장 실행 러너 (medium) +# 사용법: lg_run_0016.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/lg_run_0016_${BIZDATE}.log" + +echo "[lg_run_0016] 원장 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/lg_bt_0001" ]; then + "${BIN}/lg_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[lg_run_0016] 실행 파일 없음: ${BIN}/lg_bt_0001" >&2 + RC=0 +fi +echo "[lg_run_0016] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/mg_run_0001.sh b/scripts/mg_run_0001.sh new file mode 100755 index 0000000..2933d61 --- /dev/null +++ b/scripts/mg_run_0001.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# mg_run_0001.sh - 전문게이트웨이 실행 러너 (easy) +# 사용법: mg_run_0001.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/mg_run_0001_${BIZDATE}.log" + +echo "[mg_run_0001] 전문게이트웨이 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/mg_bt_0001" ]; then + "${BIN}/mg_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[mg_run_0001] 실행 파일 없음: ${BIN}/mg_bt_0001" >&2 + RC=0 +fi +echo "[mg_run_0001] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/mg_run_0002.sh b/scripts/mg_run_0002.sh new file mode 100755 index 0000000..df08b6b --- /dev/null +++ b/scripts/mg_run_0002.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# mg_run_0002.sh - 전문게이트웨이 실행 러너 (medium) +# 사용법: mg_run_0002.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/mg_run_0002_${BIZDATE}.log" + +echo "[mg_run_0002] 전문게이트웨이 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/mg_bt_0001" ]; then + "${BIN}/mg_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[mg_run_0002] 실행 파일 없음: ${BIN}/mg_bt_0001" >&2 + RC=0 +fi +echo "[mg_run_0002] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/mg_run_0003.sh b/scripts/mg_run_0003.sh new file mode 100755 index 0000000..af45b60 --- /dev/null +++ b/scripts/mg_run_0003.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# mg_run_0003.sh - 전문게이트웨이 실행 러너 (easy) +# 사용법: mg_run_0003.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/mg_run_0003_${BIZDATE}.log" + +echo "[mg_run_0003] 전문게이트웨이 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/mg_bt_0001" ]; then + "${BIN}/mg_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[mg_run_0003] 실행 파일 없음: ${BIN}/mg_bt_0001" >&2 + RC=0 +fi +echo "[mg_run_0003] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/mg_run_0004.sh b/scripts/mg_run_0004.sh new file mode 100755 index 0000000..4d531c9 --- /dev/null +++ b/scripts/mg_run_0004.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# mg_run_0004.sh - 전문게이트웨이 실행 러너 (medium) +# 사용법: mg_run_0004.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/mg_run_0004_${BIZDATE}.log" + +echo "[mg_run_0004] 전문게이트웨이 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/mg_bt_0001" ]; then + "${BIN}/mg_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[mg_run_0004] 실행 파일 없음: ${BIN}/mg_bt_0001" >&2 + RC=0 +fi +echo "[mg_run_0004] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/mg_run_0005.sh b/scripts/mg_run_0005.sh new file mode 100755 index 0000000..c8d3838 --- /dev/null +++ b/scripts/mg_run_0005.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# mg_run_0005.sh - 전문게이트웨이 실행 러너 (easy) +# 사용법: mg_run_0005.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/mg_run_0005_${BIZDATE}.log" + +echo "[mg_run_0005] 전문게이트웨이 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/mg_bt_0001" ]; then + "${BIN}/mg_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[mg_run_0005] 실행 파일 없음: ${BIN}/mg_bt_0001" >&2 + RC=0 +fi +echo "[mg_run_0005] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/mg_run_0006.sh b/scripts/mg_run_0006.sh new file mode 100755 index 0000000..07bc522 --- /dev/null +++ b/scripts/mg_run_0006.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# mg_run_0006.sh - 전문게이트웨이 실행 러너 (medium) +# 사용법: mg_run_0006.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/mg_run_0006_${BIZDATE}.log" + +echo "[mg_run_0006] 전문게이트웨이 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/mg_bt_0001" ]; then + "${BIN}/mg_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[mg_run_0006] 실행 파일 없음: ${BIN}/mg_bt_0001" >&2 + RC=0 +fi +echo "[mg_run_0006] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/mg_run_0007.sh b/scripts/mg_run_0007.sh new file mode 100755 index 0000000..bbf3c1f --- /dev/null +++ b/scripts/mg_run_0007.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# mg_run_0007.sh - 전문게이트웨이 실행 러너 (easy) +# 사용법: mg_run_0007.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/mg_run_0007_${BIZDATE}.log" + +echo "[mg_run_0007] 전문게이트웨이 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/mg_bt_0001" ]; then + "${BIN}/mg_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[mg_run_0007] 실행 파일 없음: ${BIN}/mg_bt_0001" >&2 + RC=0 +fi +echo "[mg_run_0007] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/mg_run_0008.sh b/scripts/mg_run_0008.sh new file mode 100755 index 0000000..ff8fd7b --- /dev/null +++ b/scripts/mg_run_0008.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# mg_run_0008.sh - 전문게이트웨이 실행 러너 (hard) +# 사용법: mg_run_0008.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/mg_run_0008_${BIZDATE}.log" + +echo "[mg_run_0008] 전문게이트웨이 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/mg_bt_0001" ]; then + "${BIN}/mg_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[mg_run_0008] 실행 파일 없음: ${BIN}/mg_bt_0001" >&2 + RC=0 +fi +echo "[mg_run_0008] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/mg_run_0009.sh b/scripts/mg_run_0009.sh new file mode 100755 index 0000000..4f3bcbd --- /dev/null +++ b/scripts/mg_run_0009.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# mg_run_0009.sh - 전문게이트웨이 실행 러너 (easy) +# 사용법: mg_run_0009.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/mg_run_0009_${BIZDATE}.log" + +echo "[mg_run_0009] 전문게이트웨이 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/mg_bt_0001" ]; then + "${BIN}/mg_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[mg_run_0009] 실행 파일 없음: ${BIN}/mg_bt_0001" >&2 + RC=0 +fi +echo "[mg_run_0009] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/mg_run_0010.sh b/scripts/mg_run_0010.sh new file mode 100755 index 0000000..9d44e69 --- /dev/null +++ b/scripts/mg_run_0010.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# mg_run_0010.sh - 전문게이트웨이 실행 러너 (hard) +# 사용법: mg_run_0010.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/mg_run_0010_${BIZDATE}.log" + +echo "[mg_run_0010] 전문게이트웨이 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/mg_bt_0001" ]; then + "${BIN}/mg_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[mg_run_0010] 실행 파일 없음: ${BIN}/mg_bt_0001" >&2 + RC=0 +fi +echo "[mg_run_0010] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/mg_run_0011.sh b/scripts/mg_run_0011.sh new file mode 100755 index 0000000..a5e84d6 --- /dev/null +++ b/scripts/mg_run_0011.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# mg_run_0011.sh - 전문게이트웨이 실행 러너 (easy) +# 사용법: mg_run_0011.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/mg_run_0011_${BIZDATE}.log" + +echo "[mg_run_0011] 전문게이트웨이 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/mg_bt_0001" ]; then + "${BIN}/mg_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[mg_run_0011] 실행 파일 없음: ${BIN}/mg_bt_0001" >&2 + RC=0 +fi +echo "[mg_run_0011] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/mg_run_0012.sh b/scripts/mg_run_0012.sh new file mode 100755 index 0000000..67439b9 --- /dev/null +++ b/scripts/mg_run_0012.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# mg_run_0012.sh - 전문게이트웨이 실행 러너 (easy) +# 사용법: mg_run_0012.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/mg_run_0012_${BIZDATE}.log" + +echo "[mg_run_0012] 전문게이트웨이 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/mg_bt_0001" ]; then + "${BIN}/mg_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[mg_run_0012] 실행 파일 없음: ${BIN}/mg_bt_0001" >&2 + RC=0 +fi +echo "[mg_run_0012] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/mg_run_0013.sh b/scripts/mg_run_0013.sh new file mode 100755 index 0000000..04a9100 --- /dev/null +++ b/scripts/mg_run_0013.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# mg_run_0013.sh - 전문게이트웨이 실행 러너 (medium) +# 사용법: mg_run_0013.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/mg_run_0013_${BIZDATE}.log" + +echo "[mg_run_0013] 전문게이트웨이 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/mg_bt_0001" ]; then + "${BIN}/mg_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[mg_run_0013] 실행 파일 없음: ${BIN}/mg_bt_0001" >&2 + RC=0 +fi +echo "[mg_run_0013] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/mg_run_0014.sh b/scripts/mg_run_0014.sh new file mode 100755 index 0000000..d71d6bc --- /dev/null +++ b/scripts/mg_run_0014.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# mg_run_0014.sh - 전문게이트웨이 실행 러너 (easy) +# 사용법: mg_run_0014.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/mg_run_0014_${BIZDATE}.log" + +echo "[mg_run_0014] 전문게이트웨이 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/mg_bt_0001" ]; then + "${BIN}/mg_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[mg_run_0014] 실행 파일 없음: ${BIN}/mg_bt_0001" >&2 + RC=0 +fi +echo "[mg_run_0014] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/mg_run_0015.sh b/scripts/mg_run_0015.sh new file mode 100755 index 0000000..c61ed2b --- /dev/null +++ b/scripts/mg_run_0015.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# mg_run_0015.sh - 전문게이트웨이 실행 러너 (medium) +# 사용법: mg_run_0015.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/mg_run_0015_${BIZDATE}.log" + +echo "[mg_run_0015] 전문게이트웨이 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/mg_bt_0001" ]; then + "${BIN}/mg_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[mg_run_0015] 실행 파일 없음: ${BIN}/mg_bt_0001" >&2 + RC=0 +fi +echo "[mg_run_0015] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/mg_run_0016.sh b/scripts/mg_run_0016.sh new file mode 100755 index 0000000..4fdc37e --- /dev/null +++ b/scripts/mg_run_0016.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# mg_run_0016.sh - 전문게이트웨이 실행 러너 (easy) +# 사용법: mg_run_0016.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/mg_run_0016_${BIZDATE}.log" + +echo "[mg_run_0016] 전문게이트웨이 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/mg_bt_0001" ]; then + "${BIN}/mg_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[mg_run_0016] 실행 파일 없음: ${BIN}/mg_bt_0001" >&2 + RC=0 +fi +echo "[mg_run_0016] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/mg_run_0017.sh b/scripts/mg_run_0017.sh new file mode 100755 index 0000000..c5189a2 --- /dev/null +++ b/scripts/mg_run_0017.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# mg_run_0017.sh - 전문게이트웨이 실행 러너 (medium) +# 사용법: mg_run_0017.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/mg_run_0017_${BIZDATE}.log" + +echo "[mg_run_0017] 전문게이트웨이 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/mg_bt_0001" ]; then + "${BIN}/mg_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[mg_run_0017] 실행 파일 없음: ${BIN}/mg_bt_0001" >&2 + RC=0 +fi +echo "[mg_run_0017] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/mm_run_0001.sh b/scripts/mm_run_0001.sh new file mode 100755 index 0000000..1f91d71 --- /dev/null +++ b/scripts/mm_run_0001.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# mm_run_0001.sh - 마스터 실행 러너 (easy) +# 사용법: mm_run_0001.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/mm_run_0001_${BIZDATE}.log" + +echo "[mm_run_0001] 마스터 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/mm_bt_0001" ]; then + "${BIN}/mm_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[mm_run_0001] 실행 파일 없음: ${BIN}/mm_bt_0001" >&2 + RC=0 +fi +echo "[mm_run_0001] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/mm_run_0002.sh b/scripts/mm_run_0002.sh new file mode 100755 index 0000000..f54438a --- /dev/null +++ b/scripts/mm_run_0002.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# mm_run_0002.sh - 마스터 실행 러너 (hard) +# 사용법: mm_run_0002.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/mm_run_0002_${BIZDATE}.log" + +echo "[mm_run_0002] 마스터 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/mm_bt_0001" ]; then + "${BIN}/mm_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[mm_run_0002] 실행 파일 없음: ${BIN}/mm_bt_0001" >&2 + RC=0 +fi +echo "[mm_run_0002] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/mm_run_0003.sh b/scripts/mm_run_0003.sh new file mode 100755 index 0000000..9458572 --- /dev/null +++ b/scripts/mm_run_0003.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# mm_run_0003.sh - 마스터 실행 러너 (easy) +# 사용법: mm_run_0003.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/mm_run_0003_${BIZDATE}.log" + +echo "[mm_run_0003] 마스터 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/mm_bt_0001" ]; then + "${BIN}/mm_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[mm_run_0003] 실행 파일 없음: ${BIN}/mm_bt_0001" >&2 + RC=0 +fi +echo "[mm_run_0003] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/mm_run_0004.sh b/scripts/mm_run_0004.sh new file mode 100755 index 0000000..cebbd27 --- /dev/null +++ b/scripts/mm_run_0004.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# mm_run_0004.sh - 마스터 실행 러너 (easy) +# 사용법: mm_run_0004.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/mm_run_0004_${BIZDATE}.log" + +echo "[mm_run_0004] 마스터 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/mm_bt_0001" ]; then + "${BIN}/mm_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[mm_run_0004] 실행 파일 없음: ${BIN}/mm_bt_0001" >&2 + RC=0 +fi +echo "[mm_run_0004] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/mm_run_0005.sh b/scripts/mm_run_0005.sh new file mode 100755 index 0000000..e46e3a3 --- /dev/null +++ b/scripts/mm_run_0005.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# mm_run_0005.sh - 마스터 실행 러너 (medium) +# 사용법: mm_run_0005.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/mm_run_0005_${BIZDATE}.log" + +echo "[mm_run_0005] 마스터 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/mm_bt_0001" ]; then + "${BIN}/mm_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[mm_run_0005] 실행 파일 없음: ${BIN}/mm_bt_0001" >&2 + RC=0 +fi +echo "[mm_run_0005] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/mm_run_0006.sh b/scripts/mm_run_0006.sh new file mode 100755 index 0000000..cd9b500 --- /dev/null +++ b/scripts/mm_run_0006.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# mm_run_0006.sh - 마스터 실행 러너 (easy) +# 사용법: mm_run_0006.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/mm_run_0006_${BIZDATE}.log" + +echo "[mm_run_0006] 마스터 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/mm_bt_0001" ]; then + "${BIN}/mm_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[mm_run_0006] 실행 파일 없음: ${BIN}/mm_bt_0001" >&2 + RC=0 +fi +echo "[mm_run_0006] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/mm_run_0007.sh b/scripts/mm_run_0007.sh new file mode 100755 index 0000000..3585be1 --- /dev/null +++ b/scripts/mm_run_0007.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# mm_run_0007.sh - 마스터 실행 러너 (medium) +# 사용법: mm_run_0007.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/mm_run_0007_${BIZDATE}.log" + +echo "[mm_run_0007] 마스터 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/mm_bt_0001" ]; then + "${BIN}/mm_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[mm_run_0007] 실행 파일 없음: ${BIN}/mm_bt_0001" >&2 + RC=0 +fi +echo "[mm_run_0007] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/mm_run_0008.sh b/scripts/mm_run_0008.sh new file mode 100755 index 0000000..0fe21eb --- /dev/null +++ b/scripts/mm_run_0008.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# mm_run_0008.sh - 마스터 실행 러너 (easy) +# 사용법: mm_run_0008.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/mm_run_0008_${BIZDATE}.log" + +echo "[mm_run_0008] 마스터 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/mm_bt_0001" ]; then + "${BIN}/mm_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[mm_run_0008] 실행 파일 없음: ${BIN}/mm_bt_0001" >&2 + RC=0 +fi +echo "[mm_run_0008] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/mm_run_0009.sh b/scripts/mm_run_0009.sh new file mode 100755 index 0000000..18173e2 --- /dev/null +++ b/scripts/mm_run_0009.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# mm_run_0009.sh - 마스터 실행 러너 (medium) +# 사용법: mm_run_0009.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/mm_run_0009_${BIZDATE}.log" + +echo "[mm_run_0009] 마스터 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/mm_bt_0001" ]; then + "${BIN}/mm_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[mm_run_0009] 실행 파일 없음: ${BIN}/mm_bt_0001" >&2 + RC=0 +fi +echo "[mm_run_0009] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/mm_run_0010.sh b/scripts/mm_run_0010.sh new file mode 100755 index 0000000..92adf4f --- /dev/null +++ b/scripts/mm_run_0010.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# mm_run_0010.sh - 마스터 실행 러너 (easy) +# 사용법: mm_run_0010.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/mm_run_0010_${BIZDATE}.log" + +echo "[mm_run_0010] 마스터 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/mm_bt_0001" ]; then + "${BIN}/mm_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[mm_run_0010] 실행 파일 없음: ${BIN}/mm_bt_0001" >&2 + RC=0 +fi +echo "[mm_run_0010] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/mm_run_0011.sh b/scripts/mm_run_0011.sh new file mode 100755 index 0000000..2b2a6f7 --- /dev/null +++ b/scripts/mm_run_0011.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# mm_run_0011.sh - 마스터 실행 러너 (hard) +# 사용법: mm_run_0011.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/mm_run_0011_${BIZDATE}.log" + +echo "[mm_run_0011] 마스터 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/mm_bt_0001" ]; then + "${BIN}/mm_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[mm_run_0011] 실행 파일 없음: ${BIN}/mm_bt_0001" >&2 + RC=0 +fi +echo "[mm_run_0011] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/mm_run_0012.sh b/scripts/mm_run_0012.sh new file mode 100755 index 0000000..5b2b83c --- /dev/null +++ b/scripts/mm_run_0012.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# mm_run_0012.sh - 마스터 실행 러너 (easy) +# 사용법: mm_run_0012.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/mm_run_0012_${BIZDATE}.log" + +echo "[mm_run_0012] 마스터 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/mm_bt_0001" ]; then + "${BIN}/mm_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[mm_run_0012] 실행 파일 없음: ${BIN}/mm_bt_0001" >&2 + RC=0 +fi +echo "[mm_run_0012] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/mm_run_0013.sh b/scripts/mm_run_0013.sh new file mode 100755 index 0000000..81d2a70 --- /dev/null +++ b/scripts/mm_run_0013.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# mm_run_0013.sh - 마스터 실행 러너 (easy) +# 사용법: mm_run_0013.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/mm_run_0013_${BIZDATE}.log" + +echo "[mm_run_0013] 마스터 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/mm_bt_0001" ]; then + "${BIN}/mm_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[mm_run_0013] 실행 파일 없음: ${BIN}/mm_bt_0001" >&2 + RC=0 +fi +echo "[mm_run_0013] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/mm_run_0014.sh b/scripts/mm_run_0014.sh new file mode 100755 index 0000000..267e66d --- /dev/null +++ b/scripts/mm_run_0014.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# mm_run_0014.sh - 마스터 실행 러너 (medium) +# 사용법: mm_run_0014.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/mm_run_0014_${BIZDATE}.log" + +echo "[mm_run_0014] 마스터 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/mm_bt_0001" ]; then + "${BIN}/mm_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[mm_run_0014] 실행 파일 없음: ${BIN}/mm_bt_0001" >&2 + RC=0 +fi +echo "[mm_run_0014] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/mm_run_0015.sh b/scripts/mm_run_0015.sh new file mode 100755 index 0000000..f735ba1 --- /dev/null +++ b/scripts/mm_run_0015.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# mm_run_0015.sh - 마스터 실행 러너 (easy) +# 사용법: mm_run_0015.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/mm_run_0015_${BIZDATE}.log" + +echo "[mm_run_0015] 마스터 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/mm_bt_0001" ]; then + "${BIN}/mm_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[mm_run_0015] 실행 파일 없음: ${BIN}/mm_bt_0001" >&2 + RC=0 +fi +echo "[mm_run_0015] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/mm_run_0016.sh b/scripts/mm_run_0016.sh new file mode 100755 index 0000000..2b40375 --- /dev/null +++ b/scripts/mm_run_0016.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# mm_run_0016.sh - 마스터 실행 러너 (medium) +# 사용법: mm_run_0016.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/mm_run_0016_${BIZDATE}.log" + +echo "[mm_run_0016] 마스터 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/mm_bt_0001" ]; then + "${BIN}/mm_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[mm_run_0016] 실행 파일 없음: ${BIN}/mm_bt_0001" >&2 + RC=0 +fi +echo "[mm_run_0016] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/py_run_0001.sh b/scripts/py_run_0001.sh new file mode 100755 index 0000000..34c0dde --- /dev/null +++ b/scripts/py_run_0001.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# py_run_0001.sh - 지급 실행 러너 (easy) +# 사용법: py_run_0001.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/py_run_0001_${BIZDATE}.log" + +echo "[py_run_0001] 지급 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/py_bt_0001" ]; then + "${BIN}/py_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[py_run_0001] 실행 파일 없음: ${BIN}/py_bt_0001" >&2 + RC=0 +fi +echo "[py_run_0001] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/py_run_0002.sh b/scripts/py_run_0002.sh new file mode 100755 index 0000000..eb98532 --- /dev/null +++ b/scripts/py_run_0002.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# py_run_0002.sh - 지급 실행 러너 (hard) +# 사용법: py_run_0002.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/py_run_0002_${BIZDATE}.log" + +echo "[py_run_0002] 지급 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/py_bt_0001" ]; then + "${BIN}/py_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[py_run_0002] 실행 파일 없음: ${BIN}/py_bt_0001" >&2 + RC=0 +fi +echo "[py_run_0002] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/py_run_0003.sh b/scripts/py_run_0003.sh new file mode 100755 index 0000000..9874fd4 --- /dev/null +++ b/scripts/py_run_0003.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# py_run_0003.sh - 지급 실행 러너 (easy) +# 사용법: py_run_0003.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/py_run_0003_${BIZDATE}.log" + +echo "[py_run_0003] 지급 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/py_bt_0001" ]; then + "${BIN}/py_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[py_run_0003] 실행 파일 없음: ${BIN}/py_bt_0001" >&2 + RC=0 +fi +echo "[py_run_0003] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/py_run_0004.sh b/scripts/py_run_0004.sh new file mode 100755 index 0000000..1bbc110 --- /dev/null +++ b/scripts/py_run_0004.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# py_run_0004.sh - 지급 실행 러너 (hard) +# 사용법: py_run_0004.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/py_run_0004_${BIZDATE}.log" + +echo "[py_run_0004] 지급 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/py_bt_0001" ]; then + "${BIN}/py_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[py_run_0004] 실행 파일 없음: ${BIN}/py_bt_0001" >&2 + RC=0 +fi +echo "[py_run_0004] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/py_run_0005.sh b/scripts/py_run_0005.sh new file mode 100755 index 0000000..e0727fc --- /dev/null +++ b/scripts/py_run_0005.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# py_run_0005.sh - 지급 실행 러너 (easy) +# 사용법: py_run_0005.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/py_run_0005_${BIZDATE}.log" + +echo "[py_run_0005] 지급 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/py_bt_0001" ]; then + "${BIN}/py_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[py_run_0005] 실행 파일 없음: ${BIN}/py_bt_0001" >&2 + RC=0 +fi +echo "[py_run_0005] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/py_run_0006.sh b/scripts/py_run_0006.sh new file mode 100755 index 0000000..42e8eb9 --- /dev/null +++ b/scripts/py_run_0006.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# py_run_0006.sh - 지급 실행 러너 (easy) +# 사용법: py_run_0006.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/py_run_0006_${BIZDATE}.log" + +echo "[py_run_0006] 지급 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/py_bt_0001" ]; then + "${BIN}/py_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[py_run_0006] 실행 파일 없음: ${BIN}/py_bt_0001" >&2 + RC=0 +fi +echo "[py_run_0006] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/py_run_0007.sh b/scripts/py_run_0007.sh new file mode 100755 index 0000000..b4c6aea --- /dev/null +++ b/scripts/py_run_0007.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# py_run_0007.sh - 지급 실행 러너 (medium) +# 사용법: py_run_0007.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/py_run_0007_${BIZDATE}.log" + +echo "[py_run_0007] 지급 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/py_bt_0001" ]; then + "${BIN}/py_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[py_run_0007] 실행 파일 없음: ${BIN}/py_bt_0001" >&2 + RC=0 +fi +echo "[py_run_0007] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/py_run_0008.sh b/scripts/py_run_0008.sh new file mode 100755 index 0000000..08b03c8 --- /dev/null +++ b/scripts/py_run_0008.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# py_run_0008.sh - 지급 실행 러너 (easy) +# 사용법: py_run_0008.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/py_run_0008_${BIZDATE}.log" + +echo "[py_run_0008] 지급 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/py_bt_0001" ]; then + "${BIN}/py_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[py_run_0008] 실행 파일 없음: ${BIN}/py_bt_0001" >&2 + RC=0 +fi +echo "[py_run_0008] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/py_run_0009.sh b/scripts/py_run_0009.sh new file mode 100755 index 0000000..507dc7b --- /dev/null +++ b/scripts/py_run_0009.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# py_run_0009.sh - 지급 실행 러너 (medium) +# 사용법: py_run_0009.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/py_run_0009_${BIZDATE}.log" + +echo "[py_run_0009] 지급 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/py_bt_0001" ]; then + "${BIN}/py_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[py_run_0009] 실행 파일 없음: ${BIN}/py_bt_0001" >&2 + RC=0 +fi +echo "[py_run_0009] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/py_run_0010.sh b/scripts/py_run_0010.sh new file mode 100755 index 0000000..642814d --- /dev/null +++ b/scripts/py_run_0010.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# py_run_0010.sh - 지급 실행 러너 (easy) +# 사용법: py_run_0010.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/py_run_0010_${BIZDATE}.log" + +echo "[py_run_0010] 지급 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/py_bt_0001" ]; then + "${BIN}/py_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[py_run_0010] 실행 파일 없음: ${BIN}/py_bt_0001" >&2 + RC=0 +fi +echo "[py_run_0010] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/py_run_0011.sh b/scripts/py_run_0011.sh new file mode 100755 index 0000000..7fbd606 --- /dev/null +++ b/scripts/py_run_0011.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# py_run_0011.sh - 지급 실행 러너 (medium) +# 사용법: py_run_0011.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/py_run_0011_${BIZDATE}.log" + +echo "[py_run_0011] 지급 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/py_bt_0001" ]; then + "${BIN}/py_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[py_run_0011] 실행 파일 없음: ${BIN}/py_bt_0001" >&2 + RC=0 +fi +echo "[py_run_0011] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/py_run_0012.sh b/scripts/py_run_0012.sh new file mode 100755 index 0000000..190df27 --- /dev/null +++ b/scripts/py_run_0012.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# py_run_0012.sh - 지급 실행 러너 (easy) +# 사용법: py_run_0012.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/py_run_0012_${BIZDATE}.log" + +echo "[py_run_0012] 지급 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/py_bt_0001" ]; then + "${BIN}/py_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[py_run_0012] 실행 파일 없음: ${BIN}/py_bt_0001" >&2 + RC=0 +fi +echo "[py_run_0012] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/py_run_0013.sh b/scripts/py_run_0013.sh new file mode 100755 index 0000000..d00610a --- /dev/null +++ b/scripts/py_run_0013.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# py_run_0013.sh - 지급 실행 러너 (hard) +# 사용법: py_run_0013.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/py_run_0013_${BIZDATE}.log" + +echo "[py_run_0013] 지급 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/py_bt_0001" ]; then + "${BIN}/py_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[py_run_0013] 실행 파일 없음: ${BIN}/py_bt_0001" >&2 + RC=0 +fi +echo "[py_run_0013] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/py_run_0014.sh b/scripts/py_run_0014.sh new file mode 100755 index 0000000..8b06055 --- /dev/null +++ b/scripts/py_run_0014.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# py_run_0014.sh - 지급 실행 러너 (easy) +# 사용법: py_run_0014.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/py_run_0014_${BIZDATE}.log" + +echo "[py_run_0014] 지급 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/py_bt_0001" ]; then + "${BIN}/py_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[py_run_0014] 실행 파일 없음: ${BIN}/py_bt_0001" >&2 + RC=0 +fi +echo "[py_run_0014] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/py_run_0015.sh b/scripts/py_run_0015.sh new file mode 100755 index 0000000..389c134 --- /dev/null +++ b/scripts/py_run_0015.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# py_run_0015.sh - 지급 실행 러너 (easy) +# 사용법: py_run_0015.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/py_run_0015_${BIZDATE}.log" + +echo "[py_run_0015] 지급 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/py_bt_0001" ]; then + "${BIN}/py_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[py_run_0015] 실행 파일 없음: ${BIN}/py_bt_0001" >&2 + RC=0 +fi +echo "[py_run_0015] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/py_run_0016.sh b/scripts/py_run_0016.sh new file mode 100755 index 0000000..c905c60 --- /dev/null +++ b/scripts/py_run_0016.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# py_run_0016.sh - 지급 실행 러너 (medium) +# 사용법: py_run_0016.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/py_run_0016_${BIZDATE}.log" + +echo "[py_run_0016] 지급 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/py_bt_0001" ]; then + "${BIN}/py_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[py_run_0016] 실행 파일 없음: ${BIN}/py_bt_0001" >&2 + RC=0 +fi +echo "[py_run_0016] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/rc_run_0001.sh b/scripts/rc_run_0001.sh new file mode 100755 index 0000000..c8a248f --- /dev/null +++ b/scripts/rc_run_0001.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# rc_run_0001.sh - 대사 실행 러너 (easy) +# 사용법: rc_run_0001.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/rc_run_0001_${BIZDATE}.log" + +echo "[rc_run_0001] 대사 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/demo_rc_batch" ]; then + "${BIN}/demo_rc_batch" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[rc_run_0001] 실행 파일 없음: ${BIN}/demo_rc_batch" >&2 + RC=0 +fi +echo "[rc_run_0001] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/rc_run_0002.sh b/scripts/rc_run_0002.sh new file mode 100755 index 0000000..0ff1b0e --- /dev/null +++ b/scripts/rc_run_0002.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# rc_run_0002.sh - 대사 실행 러너 (medium) +# 사용법: rc_run_0002.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/rc_run_0002_${BIZDATE}.log" + +echo "[rc_run_0002] 대사 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/demo_rc_batch" ]; then + "${BIN}/demo_rc_batch" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[rc_run_0002] 실행 파일 없음: ${BIN}/demo_rc_batch" >&2 + RC=0 +fi +echo "[rc_run_0002] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/rc_run_0003.sh b/scripts/rc_run_0003.sh new file mode 100755 index 0000000..e83cd92 --- /dev/null +++ b/scripts/rc_run_0003.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# rc_run_0003.sh - 대사 실행 러너 (easy) +# 사용법: rc_run_0003.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/rc_run_0003_${BIZDATE}.log" + +echo "[rc_run_0003] 대사 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/demo_rc_batch" ]; then + "${BIN}/demo_rc_batch" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[rc_run_0003] 실행 파일 없음: ${BIN}/demo_rc_batch" >&2 + RC=0 +fi +echo "[rc_run_0003] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/rc_run_0004.sh b/scripts/rc_run_0004.sh new file mode 100755 index 0000000..2b1564d --- /dev/null +++ b/scripts/rc_run_0004.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# rc_run_0004.sh - 대사 실행 러너 (medium) +# 사용법: rc_run_0004.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/rc_run_0004_${BIZDATE}.log" + +echo "[rc_run_0004] 대사 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/demo_rc_batch" ]; then + "${BIN}/demo_rc_batch" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[rc_run_0004] 실행 파일 없음: ${BIN}/demo_rc_batch" >&2 + RC=0 +fi +echo "[rc_run_0004] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/rc_run_0005.sh b/scripts/rc_run_0005.sh new file mode 100755 index 0000000..925eeed --- /dev/null +++ b/scripts/rc_run_0005.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# rc_run_0005.sh - 대사 실행 러너 (easy) +# 사용법: rc_run_0005.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/rc_run_0005_${BIZDATE}.log" + +echo "[rc_run_0005] 대사 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/demo_rc_batch" ]; then + "${BIN}/demo_rc_batch" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[rc_run_0005] 실행 파일 없음: ${BIN}/demo_rc_batch" >&2 + RC=0 +fi +echo "[rc_run_0005] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/rc_run_0006.sh b/scripts/rc_run_0006.sh new file mode 100755 index 0000000..84b918a --- /dev/null +++ b/scripts/rc_run_0006.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# rc_run_0006.sh - 대사 실행 러너 (hard) +# 사용법: rc_run_0006.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/rc_run_0006_${BIZDATE}.log" + +echo "[rc_run_0006] 대사 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/demo_rc_batch" ]; then + "${BIN}/demo_rc_batch" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[rc_run_0006] 실행 파일 없음: ${BIN}/demo_rc_batch" >&2 + RC=0 +fi +echo "[rc_run_0006] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/rc_run_0007.sh b/scripts/rc_run_0007.sh new file mode 100755 index 0000000..3c8e17e --- /dev/null +++ b/scripts/rc_run_0007.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# rc_run_0007.sh - 대사 실행 러너 (easy) +# 사용법: rc_run_0007.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/rc_run_0007_${BIZDATE}.log" + +echo "[rc_run_0007] 대사 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/demo_rc_batch" ]; then + "${BIN}/demo_rc_batch" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[rc_run_0007] 실행 파일 없음: ${BIN}/demo_rc_batch" >&2 + RC=0 +fi +echo "[rc_run_0007] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/rc_run_0008.sh b/scripts/rc_run_0008.sh new file mode 100755 index 0000000..4bcb437 --- /dev/null +++ b/scripts/rc_run_0008.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# rc_run_0008.sh - 대사 실행 러너 (easy) +# 사용법: rc_run_0008.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/rc_run_0008_${BIZDATE}.log" + +echo "[rc_run_0008] 대사 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/demo_rc_batch" ]; then + "${BIN}/demo_rc_batch" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[rc_run_0008] 실행 파일 없음: ${BIN}/demo_rc_batch" >&2 + RC=0 +fi +echo "[rc_run_0008] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/rc_run_0009.sh b/scripts/rc_run_0009.sh new file mode 100755 index 0000000..65ca6af --- /dev/null +++ b/scripts/rc_run_0009.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# rc_run_0009.sh - 대사 실행 러너 (medium) +# 사용법: rc_run_0009.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/rc_run_0009_${BIZDATE}.log" + +echo "[rc_run_0009] 대사 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/demo_rc_batch" ]; then + "${BIN}/demo_rc_batch" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[rc_run_0009] 실행 파일 없음: ${BIN}/demo_rc_batch" >&2 + RC=0 +fi +echo "[rc_run_0009] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/rc_run_0010.sh b/scripts/rc_run_0010.sh new file mode 100755 index 0000000..e08b1a8 --- /dev/null +++ b/scripts/rc_run_0010.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# rc_run_0010.sh - 대사 실행 러너 (easy) +# 사용법: rc_run_0010.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/rc_run_0010_${BIZDATE}.log" + +echo "[rc_run_0010] 대사 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/demo_rc_batch" ]; then + "${BIN}/demo_rc_batch" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[rc_run_0010] 실행 파일 없음: ${BIN}/demo_rc_batch" >&2 + RC=0 +fi +echo "[rc_run_0010] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/rc_run_0011.sh b/scripts/rc_run_0011.sh new file mode 100755 index 0000000..0438c41 --- /dev/null +++ b/scripts/rc_run_0011.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# rc_run_0011.sh - 대사 실행 러너 (medium) +# 사용법: rc_run_0011.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/rc_run_0011_${BIZDATE}.log" + +echo "[rc_run_0011] 대사 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/demo_rc_batch" ]; then + "${BIN}/demo_rc_batch" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[rc_run_0011] 실행 파일 없음: ${BIN}/demo_rc_batch" >&2 + RC=0 +fi +echo "[rc_run_0011] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/rc_run_0012.sh b/scripts/rc_run_0012.sh new file mode 100755 index 0000000..f9b3140 --- /dev/null +++ b/scripts/rc_run_0012.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# rc_run_0012.sh - 대사 실행 러너 (easy) +# 사용법: rc_run_0012.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/rc_run_0012_${BIZDATE}.log" + +echo "[rc_run_0012] 대사 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/demo_rc_batch" ]; then + "${BIN}/demo_rc_batch" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[rc_run_0012] 실행 파일 없음: ${BIN}/demo_rc_batch" >&2 + RC=0 +fi +echo "[rc_run_0012] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/rc_run_0013.sh b/scripts/rc_run_0013.sh new file mode 100755 index 0000000..9925428 --- /dev/null +++ b/scripts/rc_run_0013.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# rc_run_0013.sh - 대사 실행 러너 (medium) +# 사용법: rc_run_0013.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/rc_run_0013_${BIZDATE}.log" + +echo "[rc_run_0013] 대사 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/demo_rc_batch" ]; then + "${BIN}/demo_rc_batch" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[rc_run_0013] 실행 파일 없음: ${BIN}/demo_rc_batch" >&2 + RC=0 +fi +echo "[rc_run_0013] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/rc_run_0014.sh b/scripts/rc_run_0014.sh new file mode 100755 index 0000000..f0faee3 --- /dev/null +++ b/scripts/rc_run_0014.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# rc_run_0014.sh - 대사 실행 러너 (easy) +# 사용법: rc_run_0014.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/rc_run_0014_${BIZDATE}.log" + +echo "[rc_run_0014] 대사 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/demo_rc_batch" ]; then + "${BIN}/demo_rc_batch" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[rc_run_0014] 실행 파일 없음: ${BIN}/demo_rc_batch" >&2 + RC=0 +fi +echo "[rc_run_0014] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/rc_run_0015.sh b/scripts/rc_run_0015.sh new file mode 100755 index 0000000..7d330b3 --- /dev/null +++ b/scripts/rc_run_0015.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# rc_run_0015.sh - 대사 실행 러너 (hard) +# 사용법: rc_run_0015.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/rc_run_0015_${BIZDATE}.log" + +echo "[rc_run_0015] 대사 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/demo_rc_batch" ]; then + "${BIN}/demo_rc_batch" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[rc_run_0015] 실행 파일 없음: ${BIN}/demo_rc_batch" >&2 + RC=0 +fi +echo "[rc_run_0015] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/rc_run_0016.sh b/scripts/rc_run_0016.sh new file mode 100755 index 0000000..0775840 --- /dev/null +++ b/scripts/rc_run_0016.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# rc_run_0016.sh - 대사 실행 러너 (easy) +# 사용법: rc_run_0016.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/rc_run_0016_${BIZDATE}.log" + +echo "[rc_run_0016] 대사 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/demo_rc_batch" ]; then + "${BIN}/demo_rc_batch" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[rc_run_0016] 실행 파일 없음: ${BIN}/demo_rc_batch" >&2 + RC=0 +fi +echo "[rc_run_0016] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/rc_run_0017.sh b/scripts/rc_run_0017.sh new file mode 100755 index 0000000..2cc8456 --- /dev/null +++ b/scripts/rc_run_0017.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# rc_run_0017.sh - 대사 실행 러너 (hard) +# 사용법: rc_run_0017.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/rc_run_0017_${BIZDATE}.log" + +echo "[rc_run_0017] 대사 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/demo_rc_batch" ]; then + "${BIN}/demo_rc_batch" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[rc_run_0017] 실행 파일 없음: ${BIN}/demo_rc_batch" >&2 + RC=0 +fi +echo "[rc_run_0017] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/st_run_0001.sh b/scripts/st_run_0001.sh new file mode 100755 index 0000000..7549621 --- /dev/null +++ b/scripts/st_run_0001.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# st_run_0001.sh - 정산수수료 실행 러너 (easy) +# 사용법: st_run_0001.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/st_run_0001_${BIZDATE}.log" + +echo "[st_run_0001] 정산수수료 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/st_bt_0001" ]; then + "${BIN}/st_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[st_run_0001] 실행 파일 없음: ${BIN}/st_bt_0001" >&2 + RC=0 +fi +echo "[st_run_0001] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/st_run_0002.sh b/scripts/st_run_0002.sh new file mode 100755 index 0000000..5f6c1bd --- /dev/null +++ b/scripts/st_run_0002.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# st_run_0002.sh - 정산수수료 실행 러너 (medium) +# 사용법: st_run_0002.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/st_run_0002_${BIZDATE}.log" + +echo "[st_run_0002] 정산수수료 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/st_bt_0001" ]; then + "${BIN}/st_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[st_run_0002] 실행 파일 없음: ${BIN}/st_bt_0001" >&2 + RC=0 +fi +echo "[st_run_0002] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/st_run_0003.sh b/scripts/st_run_0003.sh new file mode 100755 index 0000000..9967a3a --- /dev/null +++ b/scripts/st_run_0003.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# st_run_0003.sh - 정산수수료 실행 러너 (easy) +# 사용법: st_run_0003.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/st_run_0003_${BIZDATE}.log" + +echo "[st_run_0003] 정산수수료 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/st_bt_0001" ]; then + "${BIN}/st_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[st_run_0003] 실행 파일 없음: ${BIN}/st_bt_0001" >&2 + RC=0 +fi +echo "[st_run_0003] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/st_run_0004.sh b/scripts/st_run_0004.sh new file mode 100755 index 0000000..3736b74 --- /dev/null +++ b/scripts/st_run_0004.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# st_run_0004.sh - 정산수수료 실행 러너 (hard) +# 사용법: st_run_0004.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/st_run_0004_${BIZDATE}.log" + +echo "[st_run_0004] 정산수수료 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/st_bt_0001" ]; then + "${BIN}/st_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[st_run_0004] 실행 파일 없음: ${BIN}/st_bt_0001" >&2 + RC=0 +fi +echo "[st_run_0004] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/st_run_0005.sh b/scripts/st_run_0005.sh new file mode 100755 index 0000000..86bcaf4 --- /dev/null +++ b/scripts/st_run_0005.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# st_run_0005.sh - 정산수수료 실행 러너 (easy) +# 사용법: st_run_0005.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/st_run_0005_${BIZDATE}.log" + +echo "[st_run_0005] 정산수수료 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/st_bt_0001" ]; then + "${BIN}/st_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[st_run_0005] 실행 파일 없음: ${BIN}/st_bt_0001" >&2 + RC=0 +fi +echo "[st_run_0005] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/st_run_0006.sh b/scripts/st_run_0006.sh new file mode 100755 index 0000000..38bdd12 --- /dev/null +++ b/scripts/st_run_0006.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# st_run_0006.sh - 정산수수료 실행 러너 (easy) +# 사용법: st_run_0006.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/st_run_0006_${BIZDATE}.log" + +echo "[st_run_0006] 정산수수료 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/st_bt_0001" ]; then + "${BIN}/st_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[st_run_0006] 실행 파일 없음: ${BIN}/st_bt_0001" >&2 + RC=0 +fi +echo "[st_run_0006] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/st_run_0007.sh b/scripts/st_run_0007.sh new file mode 100755 index 0000000..78a26ea --- /dev/null +++ b/scripts/st_run_0007.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# st_run_0007.sh - 정산수수료 실행 러너 (medium) +# 사용법: st_run_0007.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/st_run_0007_${BIZDATE}.log" + +echo "[st_run_0007] 정산수수료 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/st_bt_0001" ]; then + "${BIN}/st_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[st_run_0007] 실행 파일 없음: ${BIN}/st_bt_0001" >&2 + RC=0 +fi +echo "[st_run_0007] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/st_run_0008.sh b/scripts/st_run_0008.sh new file mode 100755 index 0000000..c3ad74a --- /dev/null +++ b/scripts/st_run_0008.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# st_run_0008.sh - 정산수수료 실행 러너 (easy) +# 사용법: st_run_0008.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/st_run_0008_${BIZDATE}.log" + +echo "[st_run_0008] 정산수수료 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/st_bt_0001" ]; then + "${BIN}/st_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[st_run_0008] 실행 파일 없음: ${BIN}/st_bt_0001" >&2 + RC=0 +fi +echo "[st_run_0008] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/st_run_0009.sh b/scripts/st_run_0009.sh new file mode 100755 index 0000000..0fb5a26 --- /dev/null +++ b/scripts/st_run_0009.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# st_run_0009.sh - 정산수수료 실행 러너 (medium) +# 사용법: st_run_0009.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/st_run_0009_${BIZDATE}.log" + +echo "[st_run_0009] 정산수수료 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/st_bt_0001" ]; then + "${BIN}/st_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[st_run_0009] 실행 파일 없음: ${BIN}/st_bt_0001" >&2 + RC=0 +fi +echo "[st_run_0009] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/st_run_0010.sh b/scripts/st_run_0010.sh new file mode 100755 index 0000000..a091953 --- /dev/null +++ b/scripts/st_run_0010.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# st_run_0010.sh - 정산수수료 실행 러너 (easy) +# 사용법: st_run_0010.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/st_run_0010_${BIZDATE}.log" + +echo "[st_run_0010] 정산수수료 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/st_bt_0001" ]; then + "${BIN}/st_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[st_run_0010] 실행 파일 없음: ${BIN}/st_bt_0001" >&2 + RC=0 +fi +echo "[st_run_0010] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/st_run_0011.sh b/scripts/st_run_0011.sh new file mode 100755 index 0000000..2441601 --- /dev/null +++ b/scripts/st_run_0011.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# st_run_0011.sh - 정산수수료 실행 러너 (medium) +# 사용법: st_run_0011.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/st_run_0011_${BIZDATE}.log" + +echo "[st_run_0011] 정산수수료 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/st_bt_0001" ]; then + "${BIN}/st_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[st_run_0011] 실행 파일 없음: ${BIN}/st_bt_0001" >&2 + RC=0 +fi +echo "[st_run_0011] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/st_run_0012.sh b/scripts/st_run_0012.sh new file mode 100755 index 0000000..167b209 --- /dev/null +++ b/scripts/st_run_0012.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# st_run_0012.sh - 정산수수료 실행 러너 (easy) +# 사용법: st_run_0012.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/st_run_0012_${BIZDATE}.log" + +echo "[st_run_0012] 정산수수료 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/st_bt_0001" ]; then + "${BIN}/st_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[st_run_0012] 실행 파일 없음: ${BIN}/st_bt_0001" >&2 + RC=0 +fi +echo "[st_run_0012] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/st_run_0013.sh b/scripts/st_run_0013.sh new file mode 100755 index 0000000..710cf47 --- /dev/null +++ b/scripts/st_run_0013.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# st_run_0013.sh - 정산수수료 실행 러너 (hard) +# 사용법: st_run_0013.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/st_run_0013_${BIZDATE}.log" + +echo "[st_run_0013] 정산수수료 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/st_bt_0001" ]; then + "${BIN}/st_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[st_run_0013] 실행 파일 없음: ${BIN}/st_bt_0001" >&2 + RC=0 +fi +echo "[st_run_0013] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/st_run_0014.sh b/scripts/st_run_0014.sh new file mode 100755 index 0000000..24d2679 --- /dev/null +++ b/scripts/st_run_0014.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# st_run_0014.sh - 정산수수료 실행 러너 (easy) +# 사용법: st_run_0014.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/st_run_0014_${BIZDATE}.log" + +echo "[st_run_0014] 정산수수료 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/st_bt_0001" ]; then + "${BIN}/st_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[st_run_0014] 실행 파일 없음: ${BIN}/st_bt_0001" >&2 + RC=0 +fi +echo "[st_run_0014] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/st_run_0015.sh b/scripts/st_run_0015.sh new file mode 100755 index 0000000..6e0aead --- /dev/null +++ b/scripts/st_run_0015.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# st_run_0015.sh - 정산수수료 실행 러너 (hard) +# 사용법: st_run_0015.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/st_run_0015_${BIZDATE}.log" + +echo "[st_run_0015] 정산수수료 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/st_bt_0001" ]; then + "${BIN}/st_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[st_run_0015] 실행 파일 없음: ${BIN}/st_bt_0001" >&2 + RC=0 +fi +echo "[st_run_0015] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/st_run_0016.sh b/scripts/st_run_0016.sh new file mode 100755 index 0000000..1c3bf69 --- /dev/null +++ b/scripts/st_run_0016.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# st_run_0016.sh - 정산수수료 실행 러너 (easy) +# 사용법: st_run_0016.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/st_run_0016_${BIZDATE}.log" + +echo "[st_run_0016] 정산수수료 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/st_bt_0001" ]; then + "${BIN}/st_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[st_run_0016] 실행 파일 없음: ${BIN}/st_bt_0001" >&2 + RC=0 +fi +echo "[st_run_0016] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/vl_run_0001.sh b/scripts/vl_run_0001.sh new file mode 100755 index 0000000..a0f027d --- /dev/null +++ b/scripts/vl_run_0001.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# vl_run_0001.sh - 정합성 실행 러너 (easy) +# 사용법: vl_run_0001.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/vl_run_0001_${BIZDATE}.log" + +echo "[vl_run_0001] 정합성 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/vl_bt_0001" ]; then + "${BIN}/vl_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[vl_run_0001] 실행 파일 없음: ${BIN}/vl_bt_0001" >&2 + RC=0 +fi +echo "[vl_run_0001] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/vl_run_0002.sh b/scripts/vl_run_0002.sh new file mode 100755 index 0000000..7d797cb --- /dev/null +++ b/scripts/vl_run_0002.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# vl_run_0002.sh - 정합성 실행 러너 (medium) +# 사용법: vl_run_0002.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/vl_run_0002_${BIZDATE}.log" + +echo "[vl_run_0002] 정합성 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/vl_bt_0001" ]; then + "${BIN}/vl_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[vl_run_0002] 실행 파일 없음: ${BIN}/vl_bt_0001" >&2 + RC=0 +fi +echo "[vl_run_0002] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/vl_run_0003.sh b/scripts/vl_run_0003.sh new file mode 100755 index 0000000..fc4aac2 --- /dev/null +++ b/scripts/vl_run_0003.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# vl_run_0003.sh - 정합성 실행 러너 (easy) +# 사용법: vl_run_0003.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/vl_run_0003_${BIZDATE}.log" + +echo "[vl_run_0003] 정합성 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/vl_bt_0001" ]; then + "${BIN}/vl_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[vl_run_0003] 실행 파일 없음: ${BIN}/vl_bt_0001" >&2 + RC=0 +fi +echo "[vl_run_0003] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/vl_run_0004.sh b/scripts/vl_run_0004.sh new file mode 100755 index 0000000..e335c62 --- /dev/null +++ b/scripts/vl_run_0004.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# vl_run_0004.sh - 정합성 실행 러너 (hard) +# 사용법: vl_run_0004.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/vl_run_0004_${BIZDATE}.log" + +echo "[vl_run_0004] 정합성 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/vl_bt_0001" ]; then + "${BIN}/vl_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[vl_run_0004] 실행 파일 없음: ${BIN}/vl_bt_0001" >&2 + RC=0 +fi +echo "[vl_run_0004] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/vl_run_0005.sh b/scripts/vl_run_0005.sh new file mode 100755 index 0000000..b35b308 --- /dev/null +++ b/scripts/vl_run_0005.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# vl_run_0005.sh - 정합성 실행 러너 (easy) +# 사용법: vl_run_0005.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/vl_run_0005_${BIZDATE}.log" + +echo "[vl_run_0005] 정합성 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/vl_bt_0001" ]; then + "${BIN}/vl_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[vl_run_0005] 실행 파일 없음: ${BIN}/vl_bt_0001" >&2 + RC=0 +fi +echo "[vl_run_0005] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/vl_run_0006.sh b/scripts/vl_run_0006.sh new file mode 100755 index 0000000..d30c8d5 --- /dev/null +++ b/scripts/vl_run_0006.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# vl_run_0006.sh - 정합성 실행 러너 (hard) +# 사용법: vl_run_0006.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/vl_run_0006_${BIZDATE}.log" + +echo "[vl_run_0006] 정합성 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/vl_bt_0001" ]; then + "${BIN}/vl_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[vl_run_0006] 실행 파일 없음: ${BIN}/vl_bt_0001" >&2 + RC=0 +fi +echo "[vl_run_0006] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/vl_run_0007.sh b/scripts/vl_run_0007.sh new file mode 100755 index 0000000..37d6783 --- /dev/null +++ b/scripts/vl_run_0007.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# vl_run_0007.sh - 정합성 실행 러너 (easy) +# 사용법: vl_run_0007.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/vl_run_0007_${BIZDATE}.log" + +echo "[vl_run_0007] 정합성 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/vl_bt_0001" ]; then + "${BIN}/vl_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[vl_run_0007] 실행 파일 없음: ${BIN}/vl_bt_0001" >&2 + RC=0 +fi +echo "[vl_run_0007] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/vl_run_0008.sh b/scripts/vl_run_0008.sh new file mode 100755 index 0000000..419d93e --- /dev/null +++ b/scripts/vl_run_0008.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# vl_run_0008.sh - 정합성 실행 러너 (easy) +# 사용법: vl_run_0008.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/vl_run_0008_${BIZDATE}.log" + +echo "[vl_run_0008] 정합성 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/vl_bt_0001" ]; then + "${BIN}/vl_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[vl_run_0008] 실행 파일 없음: ${BIN}/vl_bt_0001" >&2 + RC=0 +fi +echo "[vl_run_0008] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/vl_run_0009.sh b/scripts/vl_run_0009.sh new file mode 100755 index 0000000..d7da27b --- /dev/null +++ b/scripts/vl_run_0009.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# vl_run_0009.sh - 정합성 실행 러너 (medium) +# 사용법: vl_run_0009.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/vl_run_0009_${BIZDATE}.log" + +echo "[vl_run_0009] 정합성 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/vl_bt_0001" ]; then + "${BIN}/vl_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[vl_run_0009] 실행 파일 없음: ${BIN}/vl_bt_0001" >&2 + RC=0 +fi +echo "[vl_run_0009] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/vl_run_0010.sh b/scripts/vl_run_0010.sh new file mode 100755 index 0000000..a5a8128 --- /dev/null +++ b/scripts/vl_run_0010.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# vl_run_0010.sh - 정합성 실행 러너 (easy) +# 사용법: vl_run_0010.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/vl_run_0010_${BIZDATE}.log" + +echo "[vl_run_0010] 정합성 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/vl_bt_0001" ]; then + "${BIN}/vl_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[vl_run_0010] 실행 파일 없음: ${BIN}/vl_bt_0001" >&2 + RC=0 +fi +echo "[vl_run_0010] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/vl_run_0011.sh b/scripts/vl_run_0011.sh new file mode 100755 index 0000000..66c4d70 --- /dev/null +++ b/scripts/vl_run_0011.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# vl_run_0011.sh - 정합성 실행 러너 (medium) +# 사용법: vl_run_0011.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/vl_run_0011_${BIZDATE}.log" + +echo "[vl_run_0011] 정합성 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/vl_bt_0001" ]; then + "${BIN}/vl_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[vl_run_0011] 실행 파일 없음: ${BIN}/vl_bt_0001" >&2 + RC=0 +fi +echo "[vl_run_0011] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/vl_run_0012.sh b/scripts/vl_run_0012.sh new file mode 100755 index 0000000..df29862 --- /dev/null +++ b/scripts/vl_run_0012.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# vl_run_0012.sh - 정합성 실행 러너 (easy) +# 사용법: vl_run_0012.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/vl_run_0012_${BIZDATE}.log" + +echo "[vl_run_0012] 정합성 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/vl_bt_0001" ]; then + "${BIN}/vl_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[vl_run_0012] 실행 파일 없음: ${BIN}/vl_bt_0001" >&2 + RC=0 +fi +echo "[vl_run_0012] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/vl_run_0013.sh b/scripts/vl_run_0013.sh new file mode 100755 index 0000000..920b1e1 --- /dev/null +++ b/scripts/vl_run_0013.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# vl_run_0013.sh - 정합성 실행 러너 (medium) +# 사용법: vl_run_0013.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/vl_run_0013_${BIZDATE}.log" + +echo "[vl_run_0013] 정합성 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/vl_bt_0001" ]; then + "${BIN}/vl_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[vl_run_0013] 실행 파일 없음: ${BIN}/vl_bt_0001" >&2 + RC=0 +fi +echo "[vl_run_0013] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/vl_run_0014.sh b/scripts/vl_run_0014.sh new file mode 100755 index 0000000..6d142f0 --- /dev/null +++ b/scripts/vl_run_0014.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# vl_run_0014.sh - 정합성 실행 러너 (easy) +# 사용법: vl_run_0014.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/vl_run_0014_${BIZDATE}.log" + +echo "[vl_run_0014] 정합성 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/vl_bt_0001" ]; then + "${BIN}/vl_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[vl_run_0014] 실행 파일 없음: ${BIN}/vl_bt_0001" >&2 + RC=0 +fi +echo "[vl_run_0014] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/vl_run_0015.sh b/scripts/vl_run_0015.sh new file mode 100755 index 0000000..83b7301 --- /dev/null +++ b/scripts/vl_run_0015.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# vl_run_0015.sh - 정합성 실행 러너 (hard) +# 사용법: vl_run_0015.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/vl_run_0015_${BIZDATE}.log" + +echo "[vl_run_0015] 정합성 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/vl_bt_0001" ]; then + "${BIN}/vl_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[vl_run_0015] 실행 파일 없음: ${BIN}/vl_bt_0001" >&2 + RC=0 +fi +echo "[vl_run_0015] 종료 rc=${RC}" +exit ${RC} diff --git a/scripts/vl_run_0016.sh b/scripts/vl_run_0016.sh new file mode 100755 index 0000000..22bf605 --- /dev/null +++ b/scripts/vl_run_0016.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# vl_run_0016.sh - 정합성 실행 러너 (easy) +# 사용법: vl_run_0016.sh +set -eu + +BIZDATE="${1:-$(date +%Y%m%d)}" +APP_HOME="${APP_HOME:-/app/acquire-core}" +BIN="${APP_HOME}/bin" +LOG="${APP_HOME}/log/vl_run_0016_${BIZDATE}.log" + +echo "[vl_run_0016] 정합성 처리 시작 date=${BIZDATE}" +if [ -x "${BIN}/vl_bt_0001" ]; then + "${BIN}/vl_bt_0001" "${BIZDATE}" "acquire@localhost" >> "${LOG}" 2>&1 + RC=$? +else + echo "[vl_run_0016] 실행 파일 없음: ${BIN}/vl_bt_0001" >&2 + RC=0 +fi +echo "[vl_run_0016] 종료 rc=${RC}" +exit ${RC}