Phase 2c: 전 11모듈 per-service 레거시 구조 분해·확장 (실동작 유지)

- 10개 모듈(au py rc st lg cl mm vl mg cm)을 ac 템플릿대로 분해:
  svc/ 30 서비스 .pgc + 카피북 .h, 얇은 <mod>_svr 디스패처
  dbio/ ~25 .pgc(+.h), batch/ ~17 .pgc, run/ ~17 .sh (모듈마다)
- 파일: svc 330 + dbio 276 + batch 187 + run 187, 총 소스 1602본
- 서비스별 고유 실로직(정규화 md5), build.sh 자동발견(inline/split 양립)
- 통합 검증: build DONE modules=11 servers=11 batches=187, 12서버 runok,
  333 서비스 AVAIL, 매입체인 XA 커밋(status=S), prepared_xacts=0

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
forge-bot 2026-07-19 11:58:44 +00:00
parent c3b99a8b75
commit fd8b418c6e
1404 changed files with 30322 additions and 5994 deletions

View file

@ -0,0 +1,14 @@
/*
* py_account_agg_dbio.h - py DB copybook (py_account_agg_dbio, part of libpydbio.a).
* ECPG functions; run on the caller's XA branch (no EXEC SQL CONNECT).
* Return convention: >=0 ok, -1 = SQL error.
*/
#ifndef PY_ACCOUNT_AGG_DBIO_H
#define PY_ACCOUNT_AGG_DBIO_H
typedef struct { long total_balance; long active_cnt; } py_account_agg_rec_t;
long pydb_account_active_balance(void);
long pydb_account_active_count(void);
#endif /* PY_ACCOUNT_AGG_DBIO_H */

View file

@ -0,0 +1,29 @@
/*
* py_account_agg_dbio.pgc - py 모듈 DB 접근 함수 세트 (py_account_agg_dbio), archived into libpydbio.a.
* ECPG (EXEC SQL) functions; run on the caller's XA branch. No EXEC SQL CONNECT.
*/
#include <string.h>
#include <userlog.h>
#include "py_account_agg_dbio.h"
/* ACTIVE 계좌 잔액 총합 (무인자 집계). */
long pydb_account_active_balance(void)
{
EXEC SQL BEGIN DECLARE SECTION;
long h_v = 0;
EXEC SQL END DECLARE SECTION;
EXEC SQL SELECT coalesce(sum(balance),0) INTO :h_v FROM py_account WHERE status = 'ACTIVE';
if (sqlca.sqlcode < 0) return -1;
return h_v;
}
/* ACTIVE 계좌 수 (무인자 집계). */
long pydb_account_active_count(void)
{
EXEC SQL BEGIN DECLARE SECTION;
long h_v = 0;
EXEC SQL END DECLARE SECTION;
EXEC SQL SELECT count(*) INTO :h_v FROM py_account WHERE status = 'ACTIVE';
if (sqlca.sqlcode < 0) return -1;
return h_v;
}

View file

@ -0,0 +1,14 @@
/*
* py_account_minmax_dbio.h - py DB copybook (py_account_minmax_dbio, part of libpydbio.a).
* ECPG functions; run on the caller's XA branch (no EXEC SQL CONNECT).
* Return convention: >=0 ok, -1 = SQL error.
*/
#ifndef PY_ACCOUNT_MINMAX_DBIO_H
#define PY_ACCOUNT_MINMAX_DBIO_H
typedef struct { long threshold; long top_balance; long low_cnt; } py_account_minmax_rec_t;
long pydb_account_top_balance(void);
long pydb_account_low_count(long threshold);
#endif /* PY_ACCOUNT_MINMAX_DBIO_H */

View file

@ -0,0 +1,29 @@
/*
* py_account_minmax_dbio.pgc - py 모듈 DB 접근 함수 세트 (py_account_minmax_dbio), archived into libpydbio.a.
* ECPG (EXEC SQL) functions; run on the caller's XA branch. No EXEC SQL CONNECT.
*/
#include <string.h>
#include <userlog.h>
#include "py_account_minmax_dbio.h"
/* 최대 잔액 계좌의 잔액 (무인자). */
long pydb_account_top_balance(void)
{
EXEC SQL BEGIN DECLARE SECTION;
long h_v = 0;
EXEC SQL END DECLARE SECTION;
EXEC SQL SELECT coalesce(max(balance),0) INTO :h_v FROM py_account;
if (sqlca.sqlcode < 0) return -1;
return h_v;
}
/* 임계 미만 잔액 계좌 수 (threshold 인자). */
long pydb_account_low_count(long threshold)
{
EXEC SQL BEGIN DECLARE SECTION;
long h_thr = threshold, h_v = 0;
EXEC SQL END DECLARE SECTION;
EXEC SQL SELECT count(*) INTO :h_v FROM py_account WHERE balance < :h_thr;
if (sqlca.sqlcode < 0) return -1;
return h_v;
}

View file

@ -0,0 +1,14 @@
/*
* py_adjust_dbio.h - py DB copybook (py_adjust_dbio, part of libpydbio.a).
* ECPG functions; run on the caller's XA branch (no EXEC SQL CONNECT).
* Return convention: >=0 ok, -1 = SQL error.
*/
#ifndef PY_ADJUST_DBIO_H
#define PY_ADJUST_DBIO_H
typedef struct { long payout_id; char biz_date[16]; long delta_sum; long cnt; } py_adjust_rec_t;
long pydb_adjust_delta_sum(long payout_id);
long pydb_adjust_count(const char *bizdate);
#endif /* PY_ADJUST_DBIO_H */

View file

@ -0,0 +1,31 @@
/*
* py_adjust_dbio.pgc - py 모듈 DB 접근 함수 세트 (py_adjust_dbio), archived into libpydbio.a.
* ECPG (EXEC SQL) functions; run on the caller's XA branch. No EXEC SQL CONNECT.
*/
#include <string.h>
#include <userlog.h>
#include "py_adjust_dbio.h"
/* 단일 지급건 조정 증감 누계 (payout_id 스칼라 키). */
long pydb_adjust_delta_sum(long payout_id)
{
EXEC SQL BEGIN DECLARE SECTION;
long h_pay = payout_id, h_v = 0;
EXEC SQL END DECLARE SECTION;
EXEC SQL SELECT coalesce(sum(delta),0) INTO :h_v FROM py_adjust WHERE payout_id = :h_pay;
if (sqlca.sqlcode < 0) return -1;
return h_v;
}
/* 당일 조정 건수. */
long pydb_adjust_count(const char *bizdate)
{
EXEC SQL BEGIN DECLARE SECTION;
char h_bizdate[16];
long h_v = 0;
EXEC SQL END DECLARE SECTION;
strncpy(h_bizdate, bizdate, sizeof(h_bizdate)-1); h_bizdate[sizeof(h_bizdate)-1] = 0;
EXEC SQL SELECT count(*) INTO :h_v FROM py_adjust WHERE biz_date = :h_bizdate;
if (sqlca.sqlcode < 0) return -1;
return h_v;
}

View file

@ -0,0 +1,13 @@
/*
* py_adjust_reason_dbio.h - py DB copybook (py_adjust_reason_dbio, part of libpydbio.a).
* ECPG functions; run on the caller's XA branch (no EXEC SQL CONNECT).
* Return convention: >=0 ok, -1 = SQL error.
*/
#ifndef PY_ADJUST_REASON_DBIO_H
#define PY_ADJUST_REASON_DBIO_H
typedef struct { char biz_date[16]; long reason_kinds; } py_adjust_reason_rec_t;
long pydb_adjust_reason_variety(const char *bizdate);
#endif /* PY_ADJUST_REASON_DBIO_H */

View file

@ -0,0 +1,20 @@
/*
* py_adjust_reason_dbio.pgc - py 모듈 DB 접근 함수 세트 (py_adjust_reason_dbio), archived into libpydbio.a.
* ECPG (EXEC SQL) functions; run on the caller's XA branch. No EXEC SQL CONNECT.
*/
#include <string.h>
#include <userlog.h>
#include "py_adjust_reason_dbio.h"
/* 당일 조정 사유 가짓수 (count DISTINCT reason). */
long pydb_adjust_reason_variety(const char *bizdate)
{
EXEC SQL BEGIN DECLARE SECTION;
char h_bizdate[16];
long h_v = 0;
EXEC SQL END DECLARE SECTION;
strncpy(h_bizdate, bizdate, sizeof(h_bizdate)-1); h_bizdate[sizeof(h_bizdate)-1] = 0;
EXEC SQL SELECT count(DISTINCT reason) INTO :h_v FROM py_adjust WHERE biz_date = :h_bizdate;
if (sqlca.sqlcode < 0) { userlog("pydb_adjust_reason_variety FAIL [%d] %s", sqlca.sqlcode, sqlca.sqlerrm.sqlerrmc); return -1; }
return h_v;
}

View file

@ -0,0 +1,14 @@
/*
* py_file_agg_dbio.h - py DB copybook (py_file_agg_dbio, part of libpydbio.a).
* ECPG functions; run on the caller's XA branch (no EXEC SQL CONNECT).
* Return convention: >=0 ok, -1 = SQL error.
*/
#ifndef PY_FILE_AGG_DBIO_H
#define PY_FILE_AGG_DBIO_H
typedef struct { char biz_date[16]; long gen_cnt; long rec_sum; } py_file_agg_rec_t;
long pydb_file_generated_count(const char *bizdate);
long pydb_file_record_sum(const char *bizdate);
#endif /* PY_FILE_AGG_DBIO_H */

View file

@ -0,0 +1,33 @@
/*
* py_file_agg_dbio.pgc - py 모듈 DB 접근 함수 세트 (py_file_agg_dbio), archived into libpydbio.a.
* ECPG (EXEC SQL) functions; run on the caller's XA branch. No EXEC SQL CONNECT.
*/
#include <string.h>
#include <userlog.h>
#include "py_file_agg_dbio.h"
/* 당일 생성(G) 상태 파일 건수 (2조건 필터 count). */
long pydb_file_generated_count(const char *bizdate)
{
EXEC SQL BEGIN DECLARE SECTION;
char h_bizdate[16];
long h_v = 0;
EXEC SQL END DECLARE SECTION;
strncpy(h_bizdate, bizdate, sizeof(h_bizdate)-1); h_bizdate[sizeof(h_bizdate)-1] = 0;
EXEC SQL SELECT count(*) INTO :h_v FROM py_file WHERE biz_date = :h_bizdate AND status = 'G';
if (sqlca.sqlcode < 0) return -1;
return h_v;
}
/* 당일 파일 레코드 수 합계. */
long pydb_file_record_sum(const char *bizdate)
{
EXEC SQL BEGIN DECLARE SECTION;
char h_bizdate[16];
long h_v = 0;
EXEC SQL END DECLARE SECTION;
strncpy(h_bizdate, bizdate, sizeof(h_bizdate)-1); h_bizdate[sizeof(h_bizdate)-1] = 0;
EXEC SQL SELECT coalesce(sum(record_count),0) INTO :h_v FROM py_file WHERE biz_date = :h_bizdate;
if (sqlca.sqlcode < 0) return -1;
return h_v;
}

View file

@ -0,0 +1,14 @@
/*
* py_file_dbio.h - py DB copybook (py_file_dbio, part of libpydbio.a).
* ECPG functions; run on the caller's XA branch (no EXEC SQL CONNECT).
* Return convention: >=0 ok, -1 = SQL error.
*/
#ifndef PY_FILE_DBIO_H
#define PY_FILE_DBIO_H
typedef struct { long file_id; long total_amount; char status[8]; } py_file_rec_t;
long pydb_file_total(long file_id);
int pydb_file_status(long file_id, char *out /* >= 2 bytes */);
#endif /* PY_FILE_DBIO_H */

View file

@ -0,0 +1,32 @@
/*
* py_file_dbio.pgc - py 모듈 DB 접근 함수 세트 (py_file_dbio), archived into libpydbio.a.
* ECPG (EXEC SQL) functions; run on the caller's XA branch. No EXEC SQL CONNECT.
*/
#include <string.h>
#include <userlog.h>
#include "py_file_dbio.h"
/* 지급 파일 총액 (단순 스칼라). */
long pydb_file_total(long file_id)
{
EXEC SQL BEGIN DECLARE SECTION;
long h_file = file_id, h_v = 0;
EXEC SQL END DECLARE SECTION;
EXEC SQL SELECT coalesce(total_amount,0) INTO :h_v FROM py_file WHERE file_id = :h_file;
if (sqlca.sqlcode < 0) { userlog("pydb_file_total FAIL [%d] %s", sqlca.sqlcode, sqlca.sqlerrm.sqlerrmc); return -1; }
return h_v;
}
/* 지급 파일 상태 문자 회신. */
int pydb_file_status(long file_id, char *out)
{
EXEC SQL BEGIN DECLARE SECTION;
long h_file = file_id;
char h_status[8];
EXEC SQL END DECLARE SECTION;
EXEC SQL SELECT status INTO :h_status FROM py_file WHERE file_id = :h_file;
if (sqlca.sqlcode < 0 || sqlca.sqlcode == 100) { userlog("pydb_file_status FAIL [%d] %s", sqlca.sqlcode, sqlca.sqlerrm.sqlerrmc); return -1; }
out[0] = h_status[0];
out[1] = 0;
return 0;
}

View file

@ -0,0 +1,14 @@
/*
* py_ledger_dbio.h - py DB copybook (py_ledger_dbio, part of libpydbio.a).
* ECPG functions; run on the caller's XA branch (no EXEC SQL CONNECT).
* Return convention: >=0 ok, -1 = SQL error.
*/
#ifndef PY_LEDGER_DBIO_H
#define PY_LEDGER_DBIO_H
typedef struct { long ledger_id; long payout_id; char entry_type[16]; long amount; } py_ledger_rec_t;
long pydb_ledger_xfer_sum(const char *bizdate);
long pydb_ledger_balance(long payout_id);
#endif /* PY_LEDGER_DBIO_H */

View file

@ -0,0 +1,45 @@
/*
* py_ledger_dbio.pgc - py 모듈 DB 접근 함수 세트 (py_ledger_dbio), archived into libpydbio.a.
* ECPG (EXEC SQL) functions; run on the caller's XA branch. No EXEC SQL CONNECT.
*/
#include <string.h>
#include <userlog.h>
#include "py_ledger_dbio.h"
/* XFER/ADJ 엔트리를 FILTER 로 한 번에 분리 집계하고 XFER 합 반환. */
long pydb_ledger_xfer_sum(const char *bizdate)
{
EXEC SQL BEGIN DECLARE SECTION;
char h_bizdate[16];
long h_xfer = 0, h_adj = 0;
EXEC SQL END DECLARE SECTION;
strncpy(h_bizdate, bizdate, sizeof(h_bizdate)-1); h_bizdate[sizeof(h_bizdate)-1] = 0;
EXEC SQL SELECT
coalesce(sum(amount) FILTER (WHERE entry_type = 'XFER'), 0),
coalesce(sum(amount) FILTER (WHERE entry_type = 'ADJ'), 0)
INTO :h_xfer, :h_adj FROM py_ledger WHERE biz_date = :h_bizdate;
if (sqlca.sqlcode < 0) return -1;
if (h_adj < 0) return -1;
return h_xfer;
}
/* 단일 지급 원장 잔액 = XFER(-) 그 외(+), 커서 부호 누적. */
long pydb_ledger_balance(long payout_id)
{
EXEC SQL BEGIN DECLARE SECTION;
long h_pay = payout_id, h_amt, bal = 0;
char h_type[16];
EXEC SQL END DECLARE SECTION;
EXEC SQL DECLARE plbc CURSOR FOR
SELECT entry_type, amount FROM py_ledger WHERE payout_id = :h_pay;
EXEC SQL OPEN plbc;
if (sqlca.sqlcode < 0) return -1;
for (;;) {
EXEC SQL FETCH plbc INTO :h_type, :h_amt;
if (sqlca.sqlcode == 100) break;
if (sqlca.sqlcode < 0) { EXEC SQL CLOSE plbc; return -1; }
bal += (h_type[0] == 'X') ? -h_amt : h_amt;
}
EXEC SQL CLOSE plbc;
return bal;
}

View file

@ -0,0 +1,13 @@
/*
* py_ledger_type_dbio.h - py DB copybook (py_ledger_type_dbio, part of libpydbio.a).
* ECPG functions; run on the caller's XA branch (no EXEC SQL CONNECT).
* Return convention: >=0 ok, -1 = SQL error.
*/
#ifndef PY_LEDGER_TYPE_DBIO_H
#define PY_LEDGER_TYPE_DBIO_H
typedef struct { char entry_type[16]; char biz_date[16]; long total; } py_ledger_type_rec_t;
long pydb_ledger_type_total(const char *entry_type, const char *bizdate);
#endif /* PY_LEDGER_TYPE_DBIO_H */

View file

@ -0,0 +1,22 @@
/*
* py_ledger_type_dbio.pgc - py 모듈 DB 접근 함수 세트 (py_ledger_type_dbio), archived into libpydbio.a.
* ECPG (EXEC SQL) functions; run on the caller's XA branch. No EXEC SQL CONNECT.
*/
#include <string.h>
#include <userlog.h>
#include "py_ledger_type_dbio.h"
/* 지정 엔트리 유형의 당일 원장 합계 (entry_type 인자). */
long pydb_ledger_type_total(const char *entry_type, const char *bizdate)
{
EXEC SQL BEGIN DECLARE SECTION;
char h_type[16], h_bizdate[16];
long h_v = 0;
EXEC SQL END DECLARE SECTION;
strncpy(h_type, entry_type, sizeof(h_type)-1); h_type[sizeof(h_type)-1] = 0;
strncpy(h_bizdate, bizdate, sizeof(h_bizdate)-1); h_bizdate[sizeof(h_bizdate)-1] = 0;
EXEC SQL SELECT coalesce(sum(amount),0) INTO :h_v FROM py_ledger
WHERE entry_type = :h_type AND biz_date = :h_bizdate;
if (sqlca.sqlcode < 0) { userlog("pydb_ledger_type_total FAIL [%d] %s", sqlca.sqlcode, sqlca.sqlerrm.sqlerrmc); return -1; }
return h_v;
}

View file

@ -0,0 +1,14 @@
/*
* py_payout_agg_dbio.h - py DB copybook (py_payout_agg_dbio, part of libpydbio.a).
* ECPG functions; run on the caller's XA branch (no EXEC SQL CONNECT).
* Return convention: >=0 ok, -1 = SQL error.
*/
#ifndef PY_PAYOUT_AGG_DBIO_H
#define PY_PAYOUT_AGG_DBIO_H
typedef struct { char biz_date[16]; long gross; long cnt; } py_payout_agg_rec_t;
long pydb_payout_amount_sum(const char *bizdate);
long pydb_payout_txn_count(const char *bizdate);
#endif /* PY_PAYOUT_AGG_DBIO_H */

View file

@ -0,0 +1,33 @@
/*
* py_payout_agg_dbio.pgc - py 모듈 DB 접근 함수 세트 (py_payout_agg_dbio), archived into libpydbio.a.
* ECPG (EXEC SQL) functions; run on the caller's XA branch. No EXEC SQL CONNECT.
*/
#include <string.h>
#include <userlog.h>
#include "py_payout_agg_dbio.h"
/* 당일 지급 총액. */
long pydb_payout_amount_sum(const char *bizdate)
{
EXEC SQL BEGIN DECLARE SECTION;
char h_bizdate[16];
long h_v = 0;
EXEC SQL END DECLARE SECTION;
strncpy(h_bizdate, bizdate, sizeof(h_bizdate)-1); h_bizdate[sizeof(h_bizdate)-1] = 0;
EXEC SQL SELECT coalesce(sum(amount),0) INTO :h_v FROM py_payout WHERE biz_date = :h_bizdate;
if (sqlca.sqlcode < 0) { userlog("pydb_payout_amount_sum FAIL [%d] %s", sqlca.sqlcode, sqlca.sqlerrm.sqlerrmc); return -1; }
return h_v;
}
/* 당일 지급 건수. */
long pydb_payout_txn_count(const char *bizdate)
{
EXEC SQL BEGIN DECLARE SECTION;
char h_bizdate[16];
long h_v = 0;
EXEC SQL END DECLARE SECTION;
strncpy(h_bizdate, bizdate, sizeof(h_bizdate)-1); h_bizdate[sizeof(h_bizdate)-1] = 0;
EXEC SQL SELECT count(*) INTO :h_v FROM py_payout WHERE biz_date = :h_bizdate;
if (sqlca.sqlcode < 0) { userlog("pydb_payout_txn_count FAIL [%d] %s", sqlca.sqlcode, sqlca.sqlerrm.sqlerrmc); return -1; }
return h_v;
}

View file

@ -0,0 +1,13 @@
/*
* py_payout_avg_dbio.h - py DB copybook (py_payout_avg_dbio, part of libpydbio.a).
* ECPG functions; run on the caller's XA branch (no EXEC SQL CONNECT).
* Return convention: >=0 ok, -1 = SQL error.
*/
#ifndef PY_PAYOUT_AVG_DBIO_H
#define PY_PAYOUT_AVG_DBIO_H
typedef struct { char biz_date[16]; long total; long cnt; long avg; } py_payout_avg_rec_t;
long pydb_payout_avg_amount(const char *bizdate);
#endif /* PY_PAYOUT_AVG_DBIO_H */

View file

@ -0,0 +1,22 @@
/*
* py_payout_avg_dbio.pgc - py 모듈 DB 접근 함수 세트 (py_payout_avg_dbio), archived into libpydbio.a.
* ECPG (EXEC SQL) functions; run on the caller's XA branch. No EXEC SQL CONNECT.
*/
#include <string.h>
#include <userlog.h>
#include "py_payout_avg_dbio.h"
/* 건당 평균 지급액 = sum(amount)/count(*) (0 나눗셈 가드). */
long pydb_payout_avg_amount(const char *bizdate)
{
EXEC SQL BEGIN DECLARE SECTION;
char h_bizdate[16];
long h_sum = 0, h_cnt = 0;
EXEC SQL END DECLARE SECTION;
strncpy(h_bizdate, bizdate, sizeof(h_bizdate)-1); h_bizdate[sizeof(h_bizdate)-1] = 0;
EXEC SQL SELECT coalesce(sum(amount),0), count(*) INTO :h_sum, :h_cnt
FROM py_payout WHERE biz_date = :h_bizdate;
if (sqlca.sqlcode < 0) return -1;
if (h_cnt <= 0) return 0;
return h_sum / h_cnt;
}

View file

@ -0,0 +1,13 @@
/*
* py_payout_case_dbio.h - py DB copybook (py_payout_case_dbio, part of libpydbio.a).
* ECPG functions; run on the caller's XA branch (no EXEC SQL CONNECT).
* Return convention: >=0 ok, -1 = SQL error.
*/
#ifndef PY_PAYOUT_CASE_DBIO_H
#define PY_PAYOUT_CASE_DBIO_H
typedef struct { char biz_date[16]; long threshold; long large_cnt; } py_payout_case_rec_t;
long pydb_payout_large_count(const char *bizdate, long threshold);
#endif /* PY_PAYOUT_CASE_DBIO_H */

View file

@ -0,0 +1,21 @@
/*
* py_payout_case_dbio.pgc - py 모듈 DB 접근 함수 세트 (py_payout_case_dbio), archived into libpydbio.a.
* ECPG (EXEC SQL) functions; run on the caller's XA branch. No EXEC SQL CONNECT.
*/
#include <string.h>
#include <userlog.h>
#include "py_payout_case_dbio.h"
/* CASE 버킷 집계: 임계금액 이상 지급건 수를 sum(CASE ...) 로 산출. */
long pydb_payout_large_count(const char *bizdate, long threshold)
{
EXEC SQL BEGIN DECLARE SECTION;
char h_bizdate[16];
long h_thr = threshold, h_v = 0;
EXEC SQL END DECLARE SECTION;
strncpy(h_bizdate, bizdate, sizeof(h_bizdate)-1); h_bizdate[sizeof(h_bizdate)-1] = 0;
EXEC SQL SELECT coalesce(sum(CASE WHEN amount >= :h_thr THEN 1 ELSE 0 END),0) INTO :h_v
FROM py_payout WHERE biz_date = :h_bizdate;
if (sqlca.sqlcode < 0) { userlog("pydb_payout_large_count FAIL [%d] %s", sqlca.sqlcode, sqlca.sqlerrm.sqlerrmc); return -1; }
return h_v;
}

View file

@ -0,0 +1,14 @@
/*
* py_payout_channel_dbio.h - py DB copybook (py_payout_channel_dbio, part of libpydbio.a).
* ECPG functions; run on the caller's XA branch (no EXEC SQL CONNECT).
* Return convention: >=0 ok, -1 = SQL error.
*/
#ifndef PY_PAYOUT_CHANNEL_DBIO_H
#define PY_PAYOUT_CHANNEL_DBIO_H
typedef struct { char channel[16]; char biz_date[16]; long gross; } py_payout_channel_rec_t;
long pydb_payout_channel_variety(const char *bizdate);
long pydb_payout_channel_gross(const char *channel, const char *bizdate);
#endif /* PY_PAYOUT_CHANNEL_DBIO_H */

View file

@ -0,0 +1,35 @@
/*
* py_payout_channel_dbio.pgc - py 모듈 DB 접근 함수 세트 (py_payout_channel_dbio), archived into libpydbio.a.
* ECPG (EXEC SQL) functions; run on the caller's XA branch. No EXEC SQL CONNECT.
*/
#include <string.h>
#include <userlog.h>
#include "py_payout_channel_dbio.h"
/* 당일 사용된 지급 채널 가짓수 (BULK/SPLIT/ADVANCE/...). */
long pydb_payout_channel_variety(const char *bizdate)
{
EXEC SQL BEGIN DECLARE SECTION;
char h_bizdate[16];
long h_v = 0;
EXEC SQL END DECLARE SECTION;
strncpy(h_bizdate, bizdate, sizeof(h_bizdate)-1); h_bizdate[sizeof(h_bizdate)-1] = 0;
EXEC SQL SELECT count(DISTINCT channel) INTO :h_v FROM py_payout WHERE biz_date = :h_bizdate;
if (sqlca.sqlcode < 0) return -1;
return h_v;
}
/* 지정 채널의 당일 지급 총액. */
long pydb_payout_channel_gross(const char *channel, const char *bizdate)
{
EXEC SQL BEGIN DECLARE SECTION;
char h_ch[16], h_bizdate[16];
long h_v = 0;
EXEC SQL END DECLARE SECTION;
strncpy(h_ch, channel, sizeof(h_ch)-1); h_ch[sizeof(h_ch)-1] = 0;
strncpy(h_bizdate, bizdate, sizeof(h_bizdate)-1); h_bizdate[sizeof(h_bizdate)-1] = 0;
EXEC SQL SELECT coalesce(sum(amount),0) INTO :h_v FROM py_payout
WHERE channel = :h_ch AND biz_date = :h_bizdate;
if (sqlca.sqlcode < 0) return -1;
return h_v;
}

View file

@ -0,0 +1,13 @@
/*
* py_payout_join_dbio.h - py DB copybook (py_payout_join_dbio, part of libpydbio.a).
* ECPG functions; run on the caller's XA branch (no EXEC SQL CONNECT).
* Return convention: >=0 ok, -1 = SQL error.
*/
#ifndef PY_PAYOUT_JOIN_DBIO_H
#define PY_PAYOUT_JOIN_DBIO_H
typedef struct { char biz_date[16]; long filed_net; } py_payout_join_rec_t;
long pydb_payout_filed_net(const char *bizdate);
#endif /* PY_PAYOUT_JOIN_DBIO_H */

View file

@ -0,0 +1,22 @@
/*
* py_payout_join_dbio.pgc - py 모듈 DB 접근 함수 세트 (py_payout_join_dbio), archived into libpydbio.a.
* ECPG (EXEC SQL) functions; run on the caller's XA branch. No EXEC SQL CONNECT.
*/
#include <string.h>
#include <userlog.h>
#include "py_payout_join_dbio.h"
/* 2-테이블 JOIN: 생성(G)된 파일에 편성된 지급건의 순액 합. */
long pydb_payout_filed_net(const char *bizdate)
{
EXEC SQL BEGIN DECLARE SECTION;
char h_bizdate[16];
long h_v = 0;
EXEC SQL END DECLARE SECTION;
strncpy(h_bizdate, bizdate, sizeof(h_bizdate)-1); h_bizdate[sizeof(h_bizdate)-1] = 0;
EXEC SQL SELECT coalesce(sum(pp.net),0) INTO :h_v
FROM py_payout pp JOIN py_file pf ON pp.file_id = pf.file_id
WHERE pf.biz_date = :h_bizdate AND pf.status = 'G';
if (sqlca.sqlcode < 0) { userlog("pydb_payout_filed_net FAIL [%d] %s", sqlca.sqlcode, sqlca.sqlerrm.sqlerrmc); return -1; }
return h_v;
}

View file

@ -0,0 +1,14 @@
/*
* py_payout_merch_dbio.h - py DB copybook (py_payout_merch_dbio, part of libpydbio.a).
* ECPG functions; run on the caller's XA branch (no EXEC SQL CONNECT).
* Return convention: >=0 ok, -1 = SQL error.
*/
#ifndef PY_PAYOUT_MERCH_DBIO_H
#define PY_PAYOUT_MERCH_DBIO_H
typedef struct { char merchant_id[64]; long cnt; long gross; } py_payout_merch_rec_t;
long pydb_payout_merch_count(const char *merch);
long pydb_payout_merch_gross(const char *merch);
#endif /* PY_PAYOUT_MERCH_DBIO_H */

View file

@ -0,0 +1,33 @@
/*
* py_payout_merch_dbio.pgc - py 모듈 DB 접근 함수 세트 (py_payout_merch_dbio), archived into libpydbio.a.
* ECPG (EXEC SQL) functions; run on the caller's XA branch. No EXEC SQL CONNECT.
*/
#include <string.h>
#include <userlog.h>
#include "py_payout_merch_dbio.h"
/* 가맹점 전체 지급 건수. */
long pydb_payout_merch_count(const char *merch)
{
EXEC SQL BEGIN DECLARE SECTION;
char h_merch[64];
long h_v = 0;
EXEC SQL END DECLARE SECTION;
strncpy(h_merch, merch, sizeof(h_merch)-1); h_merch[sizeof(h_merch)-1] = 0;
EXEC SQL SELECT count(*) INTO :h_v FROM py_payout WHERE merchant_id = :h_merch;
if (sqlca.sqlcode < 0) return -1;
return h_v;
}
/* 가맹점 전체 지급 총액. */
long pydb_payout_merch_gross(const char *merch)
{
EXEC SQL BEGIN DECLARE SECTION;
char h_merch[64];
long h_v = 0;
EXEC SQL END DECLARE SECTION;
strncpy(h_merch, merch, sizeof(h_merch)-1); h_merch[sizeof(h_merch)-1] = 0;
EXEC SQL SELECT coalesce(sum(amount),0) INTO :h_v FROM py_payout WHERE merchant_id = :h_merch;
if (sqlca.sqlcode < 0) return -1;
return h_v;
}

View file

@ -0,0 +1,14 @@
/*
* py_payout_minmax_dbio.h - py DB copybook (py_payout_minmax_dbio, part of libpydbio.a).
* ECPG functions; run on the caller's XA branch (no EXEC SQL CONNECT).
* Return convention: >=0 ok, -1 = SQL error.
*/
#ifndef PY_PAYOUT_MINMAX_DBIO_H
#define PY_PAYOUT_MINMAX_DBIO_H
typedef struct { char biz_date[16]; long peak; long floor_amt; } py_payout_minmax_rec_t;
long pydb_payout_peak_amount(const char *bizdate);
long pydb_payout_floor_amount(const char *bizdate);
#endif /* PY_PAYOUT_MINMAX_DBIO_H */

View file

@ -0,0 +1,33 @@
/*
* py_payout_minmax_dbio.pgc - py 모듈 DB 접근 함수 세트 (py_payout_minmax_dbio), archived into libpydbio.a.
* ECPG (EXEC SQL) functions; run on the caller's XA branch. No EXEC SQL CONNECT.
*/
#include <string.h>
#include <userlog.h>
#include "py_payout_minmax_dbio.h"
/* 당일 최대 지급액. */
long pydb_payout_peak_amount(const char *bizdate)
{
EXEC SQL BEGIN DECLARE SECTION;
char h_bizdate[16];
long h_v = 0;
EXEC SQL END DECLARE SECTION;
strncpy(h_bizdate, bizdate, sizeof(h_bizdate)-1); h_bizdate[sizeof(h_bizdate)-1] = 0;
EXEC SQL SELECT coalesce(max(amount),0) INTO :h_v FROM py_payout WHERE biz_date = :h_bizdate;
if (sqlca.sqlcode < 0) return -1;
return h_v;
}
/* 당일 최소 지급액. */
long pydb_payout_floor_amount(const char *bizdate)
{
EXEC SQL BEGIN DECLARE SECTION;
char h_bizdate[16];
long h_v = 0;
EXEC SQL END DECLARE SECTION;
strncpy(h_bizdate, bizdate, sizeof(h_bizdate)-1); h_bizdate[sizeof(h_bizdate)-1] = 0;
EXEC SQL SELECT coalesce(min(amount),0) INTO :h_v FROM py_payout WHERE biz_date = :h_bizdate;
if (sqlca.sqlcode < 0) return -1;
return h_v;
}

View file

@ -0,0 +1,14 @@
/*
* py_payout_reject_dbio.h - py DB copybook (py_payout_reject_dbio, part of libpydbio.a).
* ECPG functions; run on the caller's XA branch (no EXEC SQL CONNECT).
* Return convention: >=0 ok, -1 = SQL error.
*/
#ifndef PY_PAYOUT_REJECT_DBIO_H
#define PY_PAYOUT_REJECT_DBIO_H
typedef struct { char biz_date[16]; long payout_id; long reject_cnt; char reason[128]; } py_payout_reject_rec_t;
long pydb_payout_reject_count(const char *bizdate);
int pydb_payout_reject_reason(long payout_id, char *out /* >= 128 bytes */);
#endif /* PY_PAYOUT_REJECT_DBIO_H */

View file

@ -0,0 +1,33 @@
/*
* py_payout_reject_dbio.pgc - py 모듈 DB 접근 함수 세트 (py_payout_reject_dbio), archived into libpydbio.a.
* ECPG (EXEC SQL) functions; run on the caller's XA branch. No EXEC SQL CONNECT.
*/
#include <string.h>
#include <userlog.h>
#include "py_payout_reject_dbio.h"
/* 당일 반려(J) 지급 건수. */
long pydb_payout_reject_count(const char *bizdate)
{
EXEC SQL BEGIN DECLARE SECTION;
char h_bizdate[16];
long h_v = 0;
EXEC SQL END DECLARE SECTION;
strncpy(h_bizdate, bizdate, sizeof(h_bizdate)-1); h_bizdate[sizeof(h_bizdate)-1] = 0;
EXEC SQL SELECT count(*) INTO :h_v FROM py_payout WHERE biz_date = :h_bizdate AND status = 'J';
if (sqlca.sqlcode < 0) return -1;
return h_v;
}
/* 단건 반려 사유 문자열 회신. */
int pydb_payout_reject_reason(long payout_id, char *out)
{
EXEC SQL BEGIN DECLARE SECTION;
long h_pay = payout_id;
char h_reason[128];
EXEC SQL END DECLARE SECTION;
EXEC SQL SELECT coalesce(reject_reason,'') INTO :h_reason FROM py_payout WHERE payout_id = :h_pay;
if (sqlca.sqlcode < 0 || sqlca.sqlcode == 100) { userlog("pydb_payout_reject_reason FAIL [%d] %s", sqlca.sqlcode, sqlca.sqlerrm.sqlerrmc); return -1; }
strncpy(out, h_reason, 127); out[127] = 0;
return 0;
}

View file

@ -0,0 +1,13 @@
/*
* py_payout_retry_dbio.h - py DB copybook (py_payout_retry_dbio, part of libpydbio.a).
* ECPG functions; run on the caller's XA branch (no EXEC SQL CONNECT).
* Return convention: >=0 ok, -1 = SQL error.
*/
#ifndef PY_PAYOUT_RETRY_DBIO_H
#define PY_PAYOUT_RETRY_DBIO_H
typedef struct { char biz_date[16]; long retried; long failed; } py_payout_retry_rec_t;
long pydb_payout_retry_load(const char *bizdate);
#endif /* PY_PAYOUT_RETRY_DBIO_H */

View file

@ -0,0 +1,24 @@
/*
* py_payout_retry_dbio.pgc - py 모듈 DB 접근 함수 세트 (py_payout_retry_dbio), archived into libpydbio.a.
* ECPG (EXEC SQL) functions; run on the caller's XA branch. No EXEC SQL CONNECT.
*/
#include <string.h>
#include <userlog.h>
#include "py_payout_retry_dbio.h"
/* FILTER 집계로 실패(J)건과 재시도 누계를 한 번에 뽑아 재시도 합을 반환. */
long pydb_payout_retry_load(const char *bizdate)
{
EXEC SQL BEGIN DECLARE SECTION;
char h_bizdate[16];
long h_retry = 0, h_fail = 0;
EXEC SQL END DECLARE SECTION;
strncpy(h_bizdate, bizdate, sizeof(h_bizdate)-1); h_bizdate[sizeof(h_bizdate)-1] = 0;
EXEC SQL SELECT
coalesce(sum(retry_count),0),
coalesce(count(*) FILTER (WHERE status = 'J'),0)
INTO :h_retry, :h_fail FROM py_payout WHERE biz_date = :h_bizdate;
if (sqlca.sqlcode < 0) return -1;
if (h_fail < 0) return -1;
return h_retry;
}

View file

@ -0,0 +1,13 @@
/*
* py_payout_scan_dbio.h - py DB copybook (py_payout_scan_dbio, part of libpydbio.a).
* ECPG functions; run on the caller's XA branch (no EXEC SQL CONNECT).
* Return convention: >=0 ok, -1 = SQL error.
*/
#ifndef PY_PAYOUT_SCAN_DBIO_H
#define PY_PAYOUT_SCAN_DBIO_H
typedef struct { char biz_date[16]; char status[8]; long cnt; } py_payout_scan_rec_t;
long pydb_payout_paid_count(const char *bizdate);
#endif /* PY_PAYOUT_SCAN_DBIO_H */

View file

@ -0,0 +1,29 @@
/*
* py_payout_scan_dbio.pgc - py 모듈 DB 접근 함수 세트 (py_payout_scan_dbio), archived into libpydbio.a.
* ECPG (EXEC SQL) functions; run on the caller's XA branch. No EXEC SQL CONNECT.
*/
#include <string.h>
#include <userlog.h>
#include "py_payout_scan_dbio.h"
/* 상태별 건수를 커서로 순회하여 지급완료(P) 건수만 추출. */
long pydb_payout_paid_count(const char *bizdate)
{
EXEC SQL BEGIN DECLARE SECTION;
char h_bizdate[16], h_st[8];
long h_cnt, paid = 0;
EXEC SQL END DECLARE SECTION;
strncpy(h_bizdate, bizdate, sizeof(h_bizdate)-1); h_bizdate[sizeof(h_bizdate)-1] = 0;
EXEC SQL DECLARE pysc CURSOR FOR
SELECT status, count(*) FROM py_payout WHERE biz_date = :h_bizdate GROUP BY status;
EXEC SQL OPEN pysc;
if (sqlca.sqlcode < 0) return -1;
for (;;) {
EXEC SQL FETCH pysc INTO :h_st, :h_cnt;
if (sqlca.sqlcode == 100) break;
if (sqlca.sqlcode < 0) { EXEC SQL CLOSE pysc; return -1; }
if (h_st[0] == 'P') paid = h_cnt;
}
EXEC SQL CLOSE pysc;
return paid;
}

View file

@ -0,0 +1,13 @@
/*
* py_payout_subq_dbio.h - py DB copybook (py_payout_subq_dbio, part of libpydbio.a).
* ECPG functions; run on the caller's XA branch (no EXEC SQL CONNECT).
* Return convention: >=0 ok, -1 = SQL error.
*/
#ifndef PY_PAYOUT_SUBQ_DBIO_H
#define PY_PAYOUT_SUBQ_DBIO_H
typedef struct { char run_date[16]; long scheduled_sum; } py_payout_subq_rec_t;
long pydb_payout_scheduled_sum(const char *rundate);
#endif /* PY_PAYOUT_SUBQ_DBIO_H */

View file

@ -0,0 +1,22 @@
/*
* py_payout_subq_dbio.pgc - py 모듈 DB 접근 함수 세트 (py_payout_subq_dbio), archived into libpydbio.a.
* ECPG (EXEC SQL) functions; run on the caller's XA branch. No EXEC SQL CONNECT.
*/
#include <string.h>
#include <userlog.h>
#include "py_payout_subq_dbio.h"
/* 서브쿼리: 해당 실행일에 예약(S)된 지급건들의 순액 합. */
long pydb_payout_scheduled_sum(const char *rundate)
{
EXEC SQL BEGIN DECLARE SECTION;
char h_rundate[16];
long h_v = 0;
EXEC SQL END DECLARE SECTION;
strncpy(h_rundate, rundate, sizeof(h_rundate)-1); h_rundate[sizeof(h_rundate)-1] = 0;
EXEC SQL SELECT coalesce(sum(net),0) INTO :h_v FROM py_payout
WHERE payout_id IN (SELECT payout_id FROM py_schedule
WHERE run_date = :h_rundate AND status = 'S');
if (sqlca.sqlcode < 0) { userlog("pydb_payout_scheduled_sum FAIL [%d] %s", sqlca.sqlcode, sqlca.sqlerrm.sqlerrmc); return -1; }
return h_v;
}

View file

@ -0,0 +1,14 @@
/*
* py_schedule_dbio.h - py DB copybook (py_schedule_dbio, part of libpydbio.a).
* ECPG functions; run on the caller's XA branch (no EXEC SQL CONNECT).
* Return convention: >=0 ok, -1 = SQL error.
*/
#ifndef PY_SCHEDULE_DBIO_H
#define PY_SCHEDULE_DBIO_H
typedef struct { char run_date[16]; long pending; } py_schedule_rec_t;
long pydb_schedule_pending_count(const char *rundate);
long pydb_schedule_next_id(void);
#endif /* PY_SCHEDULE_DBIO_H */

View file

@ -0,0 +1,31 @@
/*
* py_schedule_dbio.pgc - py 모듈 DB 접근 함수 세트 (py_schedule_dbio), archived into libpydbio.a.
* ECPG (EXEC SQL) functions; run on the caller's XA branch. No EXEC SQL CONNECT.
*/
#include <string.h>
#include <userlog.h>
#include "py_schedule_dbio.h"
/* 지정 실행일의 대기(S) 예약 건수. */
long pydb_schedule_pending_count(const char *rundate)
{
EXEC SQL BEGIN DECLARE SECTION;
char h_rundate[16];
long h_v = 0;
EXEC SQL END DECLARE SECTION;
strncpy(h_rundate, rundate, sizeof(h_rundate)-1); h_rundate[sizeof(h_rundate)-1] = 0;
EXEC SQL SELECT count(*) INTO :h_v FROM py_schedule WHERE run_date = :h_rundate AND status = 'S';
if (sqlca.sqlcode < 0) return -1;
return h_v;
}
/* 예약 시퀀스 다음 값. */
long pydb_schedule_next_id(void)
{
EXEC SQL BEGIN DECLARE SECTION;
long h_id = 0;
EXEC SQL END DECLARE SECTION;
EXEC SQL SELECT nextval('py_schedule_seq') INTO :h_id;
if (sqlca.sqlcode < 0) { userlog("pydb_schedule_next_id FAIL [%d] %s", sqlca.sqlcode, sqlca.sqlerrm.sqlerrmc); return -1; }
return h_id;
}

View file

@ -0,0 +1,13 @@
/*
* py_schedule_scan_dbio.h - py DB copybook (py_schedule_scan_dbio, part of libpydbio.a).
* ECPG functions; run on the caller's XA branch (no EXEC SQL CONNECT).
* Return convention: >=0 ok, -1 = SQL error.
*/
#ifndef PY_SCHEDULE_SCAN_DBIO_H
#define PY_SCHEDULE_SCAN_DBIO_H
typedef struct { char run_date[16]; long due; } py_schedule_scan_rec_t;
long pydb_schedule_due_count(const char *rundate);
#endif /* PY_SCHEDULE_SCAN_DBIO_H */

View file

@ -0,0 +1,29 @@
/*
* py_schedule_scan_dbio.pgc - py 모듈 DB 접근 함수 세트 (py_schedule_scan_dbio), archived into libpydbio.a.
* ECPG (EXEC SQL) functions; run on the caller's XA branch. No EXEC SQL CONNECT.
*/
#include <string.h>
#include <userlog.h>
#include "py_schedule_scan_dbio.h"
/* 커서로 실행일 예약을 순회하며 대기(S) 상태 건만 집계. */
long pydb_schedule_due_count(const char *rundate)
{
EXEC SQL BEGIN DECLARE SECTION;
char h_rundate[16], h_st[8];
long h_pay, due = 0;
EXEC SQL END DECLARE SECTION;
strncpy(h_rundate, rundate, sizeof(h_rundate)-1); h_rundate[sizeof(h_rundate)-1] = 0;
EXEC SQL DECLARE pydsc CURSOR FOR
SELECT payout_id, status FROM py_schedule WHERE run_date = :h_rundate;
EXEC SQL OPEN pydsc;
if (sqlca.sqlcode < 0) return -1;
for (;;) {
EXEC SQL FETCH pydsc INTO :h_pay, :h_st;
if (sqlca.sqlcode == 100) break;
if (sqlca.sqlcode < 0) { EXEC SQL CLOSE pydsc; return -1; }
if (h_st[0] == 'S') due++;
}
EXEC SQL CLOSE pydsc;
return due;
}

View file

@ -0,0 +1,13 @@
/*
* py_summary_dbio.h - py DB copybook (py_summary_dbio, part of libpydbio.a).
* ECPG functions; run on the caller's XA branch (no EXEC SQL CONNECT).
* Return convention: >=0 ok, -1 = SQL error.
*/
#ifndef PY_SUMMARY_DBIO_H
#define PY_SUMMARY_DBIO_H
typedef struct { char biz_date[16]; long threshold; long merchants; } py_summary_rec_t;
long pydb_summary_active_merchants(const char *bizdate, long threshold);
#endif /* PY_SUMMARY_DBIO_H */

View file

@ -0,0 +1,22 @@
/*
* py_summary_dbio.pgc - py 모듈 DB 접근 함수 세트 (py_summary_dbio), archived into libpydbio.a.
* ECPG (EXEC SQL) functions; run on the caller's XA branch. No EXEC SQL CONNECT.
*/
#include <string.h>
#include <userlog.h>
#include "py_summary_dbio.h"
/* GROUP BY ... HAVING: 당일 지급총액이 임계 이상인 가맹점 수. */
long pydb_summary_active_merchants(const char *bizdate, long threshold)
{
EXEC SQL BEGIN DECLARE SECTION;
char h_bizdate[16];
long h_thr = threshold, h_v = 0;
EXEC SQL END DECLARE SECTION;
strncpy(h_bizdate, bizdate, sizeof(h_bizdate)-1); h_bizdate[sizeof(h_bizdate)-1] = 0;
EXEC SQL SELECT count(*) INTO :h_v FROM (
SELECT merchant_id FROM py_summary WHERE biz_date = :h_bizdate
GROUP BY merchant_id HAVING sum(payout_amount) >= :h_thr) t;
if (sqlca.sqlcode < 0) { userlog("pydb_summary_active_merchants FAIL [%d] %s", sqlca.sqlcode, sqlca.sqlerrm.sqlerrmc); return -1; }
return h_v;
}

View file

@ -0,0 +1,13 @@
/*
* py_summary_upsert_dbio.h - py DB copybook (py_summary_upsert_dbio, part of libpydbio.a).
* ECPG functions; run on the caller's XA branch (no EXEC SQL CONNECT).
* Return convention: 0 ok, -1 = SQL error.
*/
#ifndef PY_SUMMARY_UPSERT_DBIO_H
#define PY_SUMMARY_UPSERT_DBIO_H
typedef struct { char merchant_id[64]; char biz_date[16]; } py_summary_upsert_rec_t;
int pydb_summary_reset(const char *merch, const char *bizdate);
#endif /* PY_SUMMARY_UPSERT_DBIO_H */

View file

@ -0,0 +1,23 @@
/*
* py_summary_upsert_dbio.pgc - py 모듈 DB 접근 함수 세트 (py_summary_upsert_dbio), archived into libpydbio.a.
* ECPG (EXEC SQL) functions; run on the caller's XA branch. No EXEC SQL CONNECT.
*/
#include <string.h>
#include <userlog.h>
#include "py_summary_upsert_dbio.h"
/* ON CONFLICT upsert: 가맹점 당일 집계를 0으로 리셋(재집계 준비). */
int pydb_summary_reset(const char *merch, const char *bizdate)
{
EXEC SQL BEGIN DECLARE SECTION;
char h_merch[64], h_bizdate[16];
EXEC SQL END DECLARE SECTION;
strncpy(h_merch, merch, sizeof(h_merch)-1); h_merch[sizeof(h_merch)-1] = 0;
strncpy(h_bizdate, bizdate, sizeof(h_bizdate)-1); h_bizdate[sizeof(h_bizdate)-1] = 0;
EXEC SQL INSERT INTO py_summary (merchant_id, biz_date, payout_count, payout_amount)
VALUES (:h_merch, :h_bizdate, 0, 0)
ON CONFLICT (merchant_id, biz_date) DO UPDATE
SET payout_count = 0, payout_amount = 0, updated_at = now();
if (sqlca.sqlcode < 0) { userlog("pydb_summary_reset FAIL [%d] %s", sqlca.sqlcode, sqlca.sqlerrm.sqlerrmc); return -1; }
return 0;
}