feat: acquire-core full legacy C corpus (~2066 files, build-verified) + generator + inventory
This commit is contained in:
commit
b96cf702ee
2897 changed files with 264970 additions and 0 deletions
399
app/dbio/ac_dbio_main.c
Normal file
399
app/dbio/ac_dbio_main.c
Normal file
|
|
@ -0,0 +1,399 @@
|
|||
/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */
|
||||
/* These include files are added by the preprocessor */
|
||||
#include <ecpglib.h>
|
||||
#include <ecpgerrno.h>
|
||||
#include <sqlca.h>
|
||||
/* 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 <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
202
app/dbio/ac_dbio_main.pgc
Normal file
202
app/dbio/ac_dbio_main.pgc
Normal file
|
|
@ -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 <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
204
app/dbio/ac_io_0001.c
Normal file
204
app/dbio/ac_io_0001.c
Normal file
|
|
@ -0,0 +1,204 @@
|
|||
/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */
|
||||
/* These include files are added by the preprocessor */
|
||||
#include <ecpglib.h>
|
||||
#include <ecpgerrno.h>
|
||||
#include <sqlca.h>
|
||||
/* 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 <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
92
app/dbio/ac_io_0001.pgc
Normal file
92
app/dbio/ac_io_0001.pgc
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
/* @tier easy @module ac @transform acquire-dbio */
|
||||
/*
|
||||
* ac_io_0001.pgc - 매입 보조 DBIO (ECPG) [tier=easy]
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
204
app/dbio/ac_io_0002.c
Normal file
204
app/dbio/ac_io_0002.c
Normal file
|
|
@ -0,0 +1,204 @@
|
|||
/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */
|
||||
/* These include files are added by the preprocessor */
|
||||
#include <ecpglib.h>
|
||||
#include <ecpgerrno.h>
|
||||
#include <sqlca.h>
|
||||
/* 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 <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
92
app/dbio/ac_io_0002.pgc
Normal file
92
app/dbio/ac_io_0002.pgc
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
/* @tier medium @module ac @transform acquire-dbio */
|
||||
/*
|
||||
* ac_io_0002.pgc - 매입 보조 DBIO (ECPG) [tier=medium]
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
204
app/dbio/ac_io_0003.c
Normal file
204
app/dbio/ac_io_0003.c
Normal file
|
|
@ -0,0 +1,204 @@
|
|||
/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */
|
||||
/* These include files are added by the preprocessor */
|
||||
#include <ecpglib.h>
|
||||
#include <ecpgerrno.h>
|
||||
#include <sqlca.h>
|
||||
/* 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 <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
92
app/dbio/ac_io_0003.pgc
Normal file
92
app/dbio/ac_io_0003.pgc
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
/* @tier easy @module ac @transform acquire-dbio */
|
||||
/*
|
||||
* ac_io_0003.pgc - 매입 보조 DBIO (ECPG) [tier=easy]
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
204
app/dbio/ac_io_0004.c
Normal file
204
app/dbio/ac_io_0004.c
Normal file
|
|
@ -0,0 +1,204 @@
|
|||
/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */
|
||||
/* These include files are added by the preprocessor */
|
||||
#include <ecpglib.h>
|
||||
#include <ecpgerrno.h>
|
||||
#include <sqlca.h>
|
||||
/* 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 <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
92
app/dbio/ac_io_0004.pgc
Normal file
92
app/dbio/ac_io_0004.pgc
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
/* @tier medium @module ac @transform acquire-dbio */
|
||||
/*
|
||||
* ac_io_0004.pgc - 매입 보조 DBIO (ECPG) [tier=medium]
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
204
app/dbio/ac_io_0005.c
Normal file
204
app/dbio/ac_io_0005.c
Normal file
|
|
@ -0,0 +1,204 @@
|
|||
/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */
|
||||
/* These include files are added by the preprocessor */
|
||||
#include <ecpglib.h>
|
||||
#include <ecpgerrno.h>
|
||||
#include <sqlca.h>
|
||||
/* 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 <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
92
app/dbio/ac_io_0005.pgc
Normal file
92
app/dbio/ac_io_0005.pgc
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
/* @tier easy @module ac @transform acquire-dbio */
|
||||
/*
|
||||
* ac_io_0005.pgc - 매입 보조 DBIO (ECPG) [tier=easy]
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
204
app/dbio/ac_io_0006.c
Normal file
204
app/dbio/ac_io_0006.c
Normal file
|
|
@ -0,0 +1,204 @@
|
|||
/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */
|
||||
/* These include files are added by the preprocessor */
|
||||
#include <ecpglib.h>
|
||||
#include <ecpgerrno.h>
|
||||
#include <sqlca.h>
|
||||
/* 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 <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
92
app/dbio/ac_io_0006.pgc
Normal file
92
app/dbio/ac_io_0006.pgc
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
/* @tier hard @module ac @transform acquire-dbio */
|
||||
/*
|
||||
* ac_io_0006.pgc - 매입 보조 DBIO (ECPG) [tier=hard]
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
204
app/dbio/ac_io_0007.c
Normal file
204
app/dbio/ac_io_0007.c
Normal file
|
|
@ -0,0 +1,204 @@
|
|||
/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */
|
||||
/* These include files are added by the preprocessor */
|
||||
#include <ecpglib.h>
|
||||
#include <ecpgerrno.h>
|
||||
#include <sqlca.h>
|
||||
/* 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 <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
92
app/dbio/ac_io_0007.pgc
Normal file
92
app/dbio/ac_io_0007.pgc
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
/* @tier easy @module ac @transform acquire-dbio */
|
||||
/*
|
||||
* ac_io_0007.pgc - 매입 보조 DBIO (ECPG) [tier=easy]
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
204
app/dbio/ac_io_0008.c
Normal file
204
app/dbio/ac_io_0008.c
Normal file
|
|
@ -0,0 +1,204 @@
|
|||
/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */
|
||||
/* These include files are added by the preprocessor */
|
||||
#include <ecpglib.h>
|
||||
#include <ecpgerrno.h>
|
||||
#include <sqlca.h>
|
||||
/* 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 <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
92
app/dbio/ac_io_0008.pgc
Normal file
92
app/dbio/ac_io_0008.pgc
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
/* @tier hard @module ac @transform acquire-dbio */
|
||||
/*
|
||||
* ac_io_0008.pgc - 매입 보조 DBIO (ECPG) [tier=hard]
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
204
app/dbio/ac_io_0009.c
Normal file
204
app/dbio/ac_io_0009.c
Normal file
|
|
@ -0,0 +1,204 @@
|
|||
/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */
|
||||
/* These include files are added by the preprocessor */
|
||||
#include <ecpglib.h>
|
||||
#include <ecpgerrno.h>
|
||||
#include <sqlca.h>
|
||||
/* 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 <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
92
app/dbio/ac_io_0009.pgc
Normal file
92
app/dbio/ac_io_0009.pgc
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
/* @tier easy @module ac @transform acquire-dbio */
|
||||
/*
|
||||
* ac_io_0009.pgc - 매입 보조 DBIO (ECPG) [tier=easy]
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
204
app/dbio/ac_io_0010.c
Normal file
204
app/dbio/ac_io_0010.c
Normal file
|
|
@ -0,0 +1,204 @@
|
|||
/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */
|
||||
/* These include files are added by the preprocessor */
|
||||
#include <ecpglib.h>
|
||||
#include <ecpgerrno.h>
|
||||
#include <sqlca.h>
|
||||
/* 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 <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
92
app/dbio/ac_io_0010.pgc
Normal file
92
app/dbio/ac_io_0010.pgc
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
/* @tier easy @module ac @transform acquire-dbio */
|
||||
/*
|
||||
* ac_io_0010.pgc - 매입 보조 DBIO (ECPG) [tier=easy]
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
204
app/dbio/ac_io_0011.c
Normal file
204
app/dbio/ac_io_0011.c
Normal file
|
|
@ -0,0 +1,204 @@
|
|||
/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */
|
||||
/* These include files are added by the preprocessor */
|
||||
#include <ecpglib.h>
|
||||
#include <ecpgerrno.h>
|
||||
#include <sqlca.h>
|
||||
/* 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 <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
92
app/dbio/ac_io_0011.pgc
Normal file
92
app/dbio/ac_io_0011.pgc
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
/* @tier medium @module ac @transform acquire-dbio */
|
||||
/*
|
||||
* ac_io_0011.pgc - 매입 보조 DBIO (ECPG) [tier=medium]
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
204
app/dbio/ac_io_0012.c
Normal file
204
app/dbio/ac_io_0012.c
Normal file
|
|
@ -0,0 +1,204 @@
|
|||
/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */
|
||||
/* These include files are added by the preprocessor */
|
||||
#include <ecpglib.h>
|
||||
#include <ecpgerrno.h>
|
||||
#include <sqlca.h>
|
||||
/* 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 <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
92
app/dbio/ac_io_0012.pgc
Normal file
92
app/dbio/ac_io_0012.pgc
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
/* @tier easy @module ac @transform acquire-dbio */
|
||||
/*
|
||||
* ac_io_0012.pgc - 매입 보조 DBIO (ECPG) [tier=easy]
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
204
app/dbio/ac_io_0013.c
Normal file
204
app/dbio/ac_io_0013.c
Normal file
|
|
@ -0,0 +1,204 @@
|
|||
/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */
|
||||
/* These include files are added by the preprocessor */
|
||||
#include <ecpglib.h>
|
||||
#include <ecpgerrno.h>
|
||||
#include <sqlca.h>
|
||||
/* 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 <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
92
app/dbio/ac_io_0013.pgc
Normal file
92
app/dbio/ac_io_0013.pgc
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
/* @tier medium @module ac @transform acquire-dbio */
|
||||
/*
|
||||
* ac_io_0013.pgc - 매입 보조 DBIO (ECPG) [tier=medium]
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
204
app/dbio/ac_io_0014.c
Normal file
204
app/dbio/ac_io_0014.c
Normal file
|
|
@ -0,0 +1,204 @@
|
|||
/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */
|
||||
/* These include files are added by the preprocessor */
|
||||
#include <ecpglib.h>
|
||||
#include <ecpgerrno.h>
|
||||
#include <sqlca.h>
|
||||
/* 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 <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
92
app/dbio/ac_io_0014.pgc
Normal file
92
app/dbio/ac_io_0014.pgc
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
/* @tier easy @module ac @transform acquire-dbio */
|
||||
/*
|
||||
* ac_io_0014.pgc - 매입 보조 DBIO (ECPG) [tier=easy]
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
204
app/dbio/ac_io_0015.c
Normal file
204
app/dbio/ac_io_0015.c
Normal file
|
|
@ -0,0 +1,204 @@
|
|||
/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */
|
||||
/* These include files are added by the preprocessor */
|
||||
#include <ecpglib.h>
|
||||
#include <ecpgerrno.h>
|
||||
#include <sqlca.h>
|
||||
/* 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 <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
92
app/dbio/ac_io_0015.pgc
Normal file
92
app/dbio/ac_io_0015.pgc
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
/* @tier medium @module ac @transform acquire-dbio */
|
||||
/*
|
||||
* ac_io_0015.pgc - 매입 보조 DBIO (ECPG) [tier=medium]
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
204
app/dbio/ac_io_0016.c
Normal file
204
app/dbio/ac_io_0016.c
Normal file
|
|
@ -0,0 +1,204 @@
|
|||
/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */
|
||||
/* These include files are added by the preprocessor */
|
||||
#include <ecpglib.h>
|
||||
#include <ecpgerrno.h>
|
||||
#include <sqlca.h>
|
||||
/* 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 <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
92
app/dbio/ac_io_0016.pgc
Normal file
92
app/dbio/ac_io_0016.pgc
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
/* @tier easy @module ac @transform acquire-dbio */
|
||||
/*
|
||||
* ac_io_0016.pgc - 매입 보조 DBIO (ECPG) [tier=easy]
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
204
app/dbio/ac_io_0017.c
Normal file
204
app/dbio/ac_io_0017.c
Normal file
|
|
@ -0,0 +1,204 @@
|
|||
/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */
|
||||
/* These include files are added by the preprocessor */
|
||||
#include <ecpglib.h>
|
||||
#include <ecpgerrno.h>
|
||||
#include <sqlca.h>
|
||||
/* 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 <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
92
app/dbio/ac_io_0017.pgc
Normal file
92
app/dbio/ac_io_0017.pgc
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
/* @tier hard @module ac @transform acquire-dbio */
|
||||
/*
|
||||
* ac_io_0017.pgc - 매입 보조 DBIO (ECPG) [tier=hard]
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
204
app/dbio/ac_io_0018.c
Normal file
204
app/dbio/ac_io_0018.c
Normal file
|
|
@ -0,0 +1,204 @@
|
|||
/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */
|
||||
/* These include files are added by the preprocessor */
|
||||
#include <ecpglib.h>
|
||||
#include <ecpgerrno.h>
|
||||
#include <sqlca.h>
|
||||
/* 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 <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
92
app/dbio/ac_io_0018.pgc
Normal file
92
app/dbio/ac_io_0018.pgc
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
/* @tier easy @module ac @transform acquire-dbio */
|
||||
/*
|
||||
* ac_io_0018.pgc - 매입 보조 DBIO (ECPG) [tier=easy]
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
204
app/dbio/ac_io_0019.c
Normal file
204
app/dbio/ac_io_0019.c
Normal file
|
|
@ -0,0 +1,204 @@
|
|||
/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */
|
||||
/* These include files are added by the preprocessor */
|
||||
#include <ecpglib.h>
|
||||
#include <ecpgerrno.h>
|
||||
#include <sqlca.h>
|
||||
/* 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 <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
92
app/dbio/ac_io_0019.pgc
Normal file
92
app/dbio/ac_io_0019.pgc
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
/* @tier easy @module ac @transform acquire-dbio */
|
||||
/*
|
||||
* ac_io_0019.pgc - 매입 보조 DBIO (ECPG) [tier=easy]
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
204
app/dbio/ac_io_0020.c
Normal file
204
app/dbio/ac_io_0020.c
Normal file
|
|
@ -0,0 +1,204 @@
|
|||
/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */
|
||||
/* These include files are added by the preprocessor */
|
||||
#include <ecpglib.h>
|
||||
#include <ecpgerrno.h>
|
||||
#include <sqlca.h>
|
||||
/* 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 <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
92
app/dbio/ac_io_0020.pgc
Normal file
92
app/dbio/ac_io_0020.pgc
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
/* @tier medium @module ac @transform acquire-dbio */
|
||||
/*
|
||||
* ac_io_0020.pgc - 매입 보조 DBIO (ECPG) [tier=medium]
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
204
app/dbio/ac_io_0021.c
Normal file
204
app/dbio/ac_io_0021.c
Normal file
|
|
@ -0,0 +1,204 @@
|
|||
/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */
|
||||
/* These include files are added by the preprocessor */
|
||||
#include <ecpglib.h>
|
||||
#include <ecpgerrno.h>
|
||||
#include <sqlca.h>
|
||||
/* 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 <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
92
app/dbio/ac_io_0021.pgc
Normal file
92
app/dbio/ac_io_0021.pgc
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
/* @tier easy @module ac @transform acquire-dbio */
|
||||
/*
|
||||
* ac_io_0021.pgc - 매입 보조 DBIO (ECPG) [tier=easy]
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
204
app/dbio/ac_io_0022.c
Normal file
204
app/dbio/ac_io_0022.c
Normal file
|
|
@ -0,0 +1,204 @@
|
|||
/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */
|
||||
/* These include files are added by the preprocessor */
|
||||
#include <ecpglib.h>
|
||||
#include <ecpgerrno.h>
|
||||
#include <sqlca.h>
|
||||
/* 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 <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
92
app/dbio/ac_io_0022.pgc
Normal file
92
app/dbio/ac_io_0022.pgc
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
/* @tier medium @module ac @transform acquire-dbio */
|
||||
/*
|
||||
* ac_io_0022.pgc - 매입 보조 DBIO (ECPG) [tier=medium]
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
204
app/dbio/ac_io_0023.c
Normal file
204
app/dbio/ac_io_0023.c
Normal file
|
|
@ -0,0 +1,204 @@
|
|||
/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */
|
||||
/* These include files are added by the preprocessor */
|
||||
#include <ecpglib.h>
|
||||
#include <ecpgerrno.h>
|
||||
#include <sqlca.h>
|
||||
/* 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 <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
92
app/dbio/ac_io_0023.pgc
Normal file
92
app/dbio/ac_io_0023.pgc
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
/* @tier easy @module ac @transform acquire-dbio */
|
||||
/*
|
||||
* ac_io_0023.pgc - 매입 보조 DBIO (ECPG) [tier=easy]
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
204
app/dbio/ac_io_0024.c
Normal file
204
app/dbio/ac_io_0024.c
Normal file
|
|
@ -0,0 +1,204 @@
|
|||
/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */
|
||||
/* These include files are added by the preprocessor */
|
||||
#include <ecpglib.h>
|
||||
#include <ecpgerrno.h>
|
||||
#include <sqlca.h>
|
||||
/* 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 <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
92
app/dbio/ac_io_0024.pgc
Normal file
92
app/dbio/ac_io_0024.pgc
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
/* @tier medium @module ac @transform acquire-dbio */
|
||||
/*
|
||||
* ac_io_0024.pgc - 매입 보조 DBIO (ECPG) [tier=medium]
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
204
app/dbio/ac_io_0025.c
Normal file
204
app/dbio/ac_io_0025.c
Normal file
|
|
@ -0,0 +1,204 @@
|
|||
/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */
|
||||
/* These include files are added by the preprocessor */
|
||||
#include <ecpglib.h>
|
||||
#include <ecpgerrno.h>
|
||||
#include <sqlca.h>
|
||||
/* 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 <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
92
app/dbio/ac_io_0025.pgc
Normal file
92
app/dbio/ac_io_0025.pgc
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
/* @tier easy @module ac @transform acquire-dbio */
|
||||
/*
|
||||
* ac_io_0025.pgc - 매입 보조 DBIO (ECPG) [tier=easy]
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
204
app/dbio/ac_io_0026.c
Normal file
204
app/dbio/ac_io_0026.c
Normal file
|
|
@ -0,0 +1,204 @@
|
|||
/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */
|
||||
/* These include files are added by the preprocessor */
|
||||
#include <ecpglib.h>
|
||||
#include <ecpgerrno.h>
|
||||
#include <sqlca.h>
|
||||
/* 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 <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
92
app/dbio/ac_io_0026.pgc
Normal file
92
app/dbio/ac_io_0026.pgc
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
/* @tier hard @module ac @transform acquire-dbio */
|
||||
/*
|
||||
* ac_io_0026.pgc - 매입 보조 DBIO (ECPG) [tier=hard]
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
204
app/dbio/ac_io_0027.c
Normal file
204
app/dbio/ac_io_0027.c
Normal file
|
|
@ -0,0 +1,204 @@
|
|||
/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */
|
||||
/* These include files are added by the preprocessor */
|
||||
#include <ecpglib.h>
|
||||
#include <ecpgerrno.h>
|
||||
#include <sqlca.h>
|
||||
/* 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 <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
92
app/dbio/ac_io_0027.pgc
Normal file
92
app/dbio/ac_io_0027.pgc
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
/* @tier easy @module ac @transform acquire-dbio */
|
||||
/*
|
||||
* ac_io_0027.pgc - 매입 보조 DBIO (ECPG) [tier=easy]
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
399
app/dbio/au_dbio_main.c
Normal file
399
app/dbio/au_dbio_main.c
Normal file
|
|
@ -0,0 +1,399 @@
|
|||
/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */
|
||||
/* These include files are added by the preprocessor */
|
||||
#include <ecpglib.h>
|
||||
#include <ecpgerrno.h>
|
||||
#include <sqlca.h>
|
||||
/* 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 <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
202
app/dbio/au_dbio_main.pgc
Normal file
202
app/dbio/au_dbio_main.pgc
Normal file
|
|
@ -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 <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
204
app/dbio/au_io_0001.c
Normal file
204
app/dbio/au_io_0001.c
Normal file
|
|
@ -0,0 +1,204 @@
|
|||
/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */
|
||||
/* These include files are added by the preprocessor */
|
||||
#include <ecpglib.h>
|
||||
#include <ecpgerrno.h>
|
||||
#include <sqlca.h>
|
||||
/* 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 <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
92
app/dbio/au_io_0001.pgc
Normal file
92
app/dbio/au_io_0001.pgc
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
/* @tier easy @module au @transform authorization-dbio */
|
||||
/*
|
||||
* au_io_0001.pgc - 승인한도 보조 DBIO (ECPG) [tier=easy]
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
204
app/dbio/au_io_0002.c
Normal file
204
app/dbio/au_io_0002.c
Normal file
|
|
@ -0,0 +1,204 @@
|
|||
/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */
|
||||
/* These include files are added by the preprocessor */
|
||||
#include <ecpglib.h>
|
||||
#include <ecpgerrno.h>
|
||||
#include <sqlca.h>
|
||||
/* 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 <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
92
app/dbio/au_io_0002.pgc
Normal file
92
app/dbio/au_io_0002.pgc
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
/* @tier medium @module au @transform authorization-dbio */
|
||||
/*
|
||||
* au_io_0002.pgc - 승인한도 보조 DBIO (ECPG) [tier=medium]
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
204
app/dbio/au_io_0003.c
Normal file
204
app/dbio/au_io_0003.c
Normal file
|
|
@ -0,0 +1,204 @@
|
|||
/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */
|
||||
/* These include files are added by the preprocessor */
|
||||
#include <ecpglib.h>
|
||||
#include <ecpgerrno.h>
|
||||
#include <sqlca.h>
|
||||
/* 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 <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
92
app/dbio/au_io_0003.pgc
Normal file
92
app/dbio/au_io_0003.pgc
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
/* @tier easy @module au @transform authorization-dbio */
|
||||
/*
|
||||
* au_io_0003.pgc - 승인한도 보조 DBIO (ECPG) [tier=easy]
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
204
app/dbio/au_io_0004.c
Normal file
204
app/dbio/au_io_0004.c
Normal file
|
|
@ -0,0 +1,204 @@
|
|||
/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */
|
||||
/* These include files are added by the preprocessor */
|
||||
#include <ecpglib.h>
|
||||
#include <ecpgerrno.h>
|
||||
#include <sqlca.h>
|
||||
/* 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 <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
92
app/dbio/au_io_0004.pgc
Normal file
92
app/dbio/au_io_0004.pgc
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
/* @tier medium @module au @transform authorization-dbio */
|
||||
/*
|
||||
* au_io_0004.pgc - 승인한도 보조 DBIO (ECPG) [tier=medium]
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
204
app/dbio/au_io_0005.c
Normal file
204
app/dbio/au_io_0005.c
Normal file
|
|
@ -0,0 +1,204 @@
|
|||
/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */
|
||||
/* These include files are added by the preprocessor */
|
||||
#include <ecpglib.h>
|
||||
#include <ecpgerrno.h>
|
||||
#include <sqlca.h>
|
||||
/* 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 <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
92
app/dbio/au_io_0005.pgc
Normal file
92
app/dbio/au_io_0005.pgc
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
/* @tier easy @module au @transform authorization-dbio */
|
||||
/*
|
||||
* au_io_0005.pgc - 승인한도 보조 DBIO (ECPG) [tier=easy]
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
204
app/dbio/au_io_0006.c
Normal file
204
app/dbio/au_io_0006.c
Normal file
|
|
@ -0,0 +1,204 @@
|
|||
/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */
|
||||
/* These include files are added by the preprocessor */
|
||||
#include <ecpglib.h>
|
||||
#include <ecpgerrno.h>
|
||||
#include <sqlca.h>
|
||||
/* 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 <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
92
app/dbio/au_io_0006.pgc
Normal file
92
app/dbio/au_io_0006.pgc
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
/* @tier medium @module au @transform authorization-dbio */
|
||||
/*
|
||||
* au_io_0006.pgc - 승인한도 보조 DBIO (ECPG) [tier=medium]
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
204
app/dbio/au_io_0007.c
Normal file
204
app/dbio/au_io_0007.c
Normal file
|
|
@ -0,0 +1,204 @@
|
|||
/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */
|
||||
/* These include files are added by the preprocessor */
|
||||
#include <ecpglib.h>
|
||||
#include <ecpgerrno.h>
|
||||
#include <sqlca.h>
|
||||
/* 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 <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
92
app/dbio/au_io_0007.pgc
Normal file
92
app/dbio/au_io_0007.pgc
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
/* @tier easy @module au @transform authorization-dbio */
|
||||
/*
|
||||
* au_io_0007.pgc - 승인한도 보조 DBIO (ECPG) [tier=easy]
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
204
app/dbio/au_io_0008.c
Normal file
204
app/dbio/au_io_0008.c
Normal file
|
|
@ -0,0 +1,204 @@
|
|||
/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */
|
||||
/* These include files are added by the preprocessor */
|
||||
#include <ecpglib.h>
|
||||
#include <ecpgerrno.h>
|
||||
#include <sqlca.h>
|
||||
/* 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 <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
92
app/dbio/au_io_0008.pgc
Normal file
92
app/dbio/au_io_0008.pgc
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
/* @tier hard @module au @transform authorization-dbio */
|
||||
/*
|
||||
* au_io_0008.pgc - 승인한도 보조 DBIO (ECPG) [tier=hard]
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
204
app/dbio/au_io_0009.c
Normal file
204
app/dbio/au_io_0009.c
Normal file
|
|
@ -0,0 +1,204 @@
|
|||
/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */
|
||||
/* These include files are added by the preprocessor */
|
||||
#include <ecpglib.h>
|
||||
#include <ecpgerrno.h>
|
||||
#include <sqlca.h>
|
||||
/* 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 <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
92
app/dbio/au_io_0009.pgc
Normal file
92
app/dbio/au_io_0009.pgc
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
/* @tier easy @module au @transform authorization-dbio */
|
||||
/*
|
||||
* au_io_0009.pgc - 승인한도 보조 DBIO (ECPG) [tier=easy]
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
204
app/dbio/au_io_0010.c
Normal file
204
app/dbio/au_io_0010.c
Normal file
|
|
@ -0,0 +1,204 @@
|
|||
/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */
|
||||
/* These include files are added by the preprocessor */
|
||||
#include <ecpglib.h>
|
||||
#include <ecpgerrno.h>
|
||||
#include <sqlca.h>
|
||||
/* 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 <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
92
app/dbio/au_io_0010.pgc
Normal file
92
app/dbio/au_io_0010.pgc
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
/* @tier easy @module au @transform authorization-dbio */
|
||||
/*
|
||||
* au_io_0010.pgc - 승인한도 보조 DBIO (ECPG) [tier=easy]
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
204
app/dbio/au_io_0011.c
Normal file
204
app/dbio/au_io_0011.c
Normal file
|
|
@ -0,0 +1,204 @@
|
|||
/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */
|
||||
/* These include files are added by the preprocessor */
|
||||
#include <ecpglib.h>
|
||||
#include <ecpgerrno.h>
|
||||
#include <sqlca.h>
|
||||
/* 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 <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
92
app/dbio/au_io_0011.pgc
Normal file
92
app/dbio/au_io_0011.pgc
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
/* @tier medium @module au @transform authorization-dbio */
|
||||
/*
|
||||
* au_io_0011.pgc - 승인한도 보조 DBIO (ECPG) [tier=medium]
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
204
app/dbio/au_io_0012.c
Normal file
204
app/dbio/au_io_0012.c
Normal file
|
|
@ -0,0 +1,204 @@
|
|||
/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */
|
||||
/* These include files are added by the preprocessor */
|
||||
#include <ecpglib.h>
|
||||
#include <ecpgerrno.h>
|
||||
#include <sqlca.h>
|
||||
/* 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 <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
92
app/dbio/au_io_0012.pgc
Normal file
92
app/dbio/au_io_0012.pgc
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
/* @tier easy @module au @transform authorization-dbio */
|
||||
/*
|
||||
* au_io_0012.pgc - 승인한도 보조 DBIO (ECPG) [tier=easy]
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
204
app/dbio/au_io_0013.c
Normal file
204
app/dbio/au_io_0013.c
Normal file
|
|
@ -0,0 +1,204 @@
|
|||
/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */
|
||||
/* These include files are added by the preprocessor */
|
||||
#include <ecpglib.h>
|
||||
#include <ecpgerrno.h>
|
||||
#include <sqlca.h>
|
||||
/* 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 <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
92
app/dbio/au_io_0013.pgc
Normal file
92
app/dbio/au_io_0013.pgc
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
/* @tier medium @module au @transform authorization-dbio */
|
||||
/*
|
||||
* au_io_0013.pgc - 승인한도 보조 DBIO (ECPG) [tier=medium]
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
204
app/dbio/au_io_0014.c
Normal file
204
app/dbio/au_io_0014.c
Normal file
|
|
@ -0,0 +1,204 @@
|
|||
/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */
|
||||
/* These include files are added by the preprocessor */
|
||||
#include <ecpglib.h>
|
||||
#include <ecpgerrno.h>
|
||||
#include <sqlca.h>
|
||||
/* 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 <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
92
app/dbio/au_io_0014.pgc
Normal file
92
app/dbio/au_io_0014.pgc
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
/* @tier easy @module au @transform authorization-dbio */
|
||||
/*
|
||||
* au_io_0014.pgc - 승인한도 보조 DBIO (ECPG) [tier=easy]
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
204
app/dbio/au_io_0015.c
Normal file
204
app/dbio/au_io_0015.c
Normal file
|
|
@ -0,0 +1,204 @@
|
|||
/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */
|
||||
/* These include files are added by the preprocessor */
|
||||
#include <ecpglib.h>
|
||||
#include <ecpgerrno.h>
|
||||
#include <sqlca.h>
|
||||
/* 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 <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
92
app/dbio/au_io_0015.pgc
Normal file
92
app/dbio/au_io_0015.pgc
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
/* @tier medium @module au @transform authorization-dbio */
|
||||
/*
|
||||
* au_io_0015.pgc - 승인한도 보조 DBIO (ECPG) [tier=medium]
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
204
app/dbio/au_io_0016.c
Normal file
204
app/dbio/au_io_0016.c
Normal file
|
|
@ -0,0 +1,204 @@
|
|||
/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */
|
||||
/* These include files are added by the preprocessor */
|
||||
#include <ecpglib.h>
|
||||
#include <ecpgerrno.h>
|
||||
#include <sqlca.h>
|
||||
/* 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 <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
92
app/dbio/au_io_0016.pgc
Normal file
92
app/dbio/au_io_0016.pgc
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
/* @tier easy @module au @transform authorization-dbio */
|
||||
/*
|
||||
* au_io_0016.pgc - 승인한도 보조 DBIO (ECPG) [tier=easy]
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
204
app/dbio/au_io_0017.c
Normal file
204
app/dbio/au_io_0017.c
Normal file
|
|
@ -0,0 +1,204 @@
|
|||
/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */
|
||||
/* These include files are added by the preprocessor */
|
||||
#include <ecpglib.h>
|
||||
#include <ecpgerrno.h>
|
||||
#include <sqlca.h>
|
||||
/* 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 <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
92
app/dbio/au_io_0017.pgc
Normal file
92
app/dbio/au_io_0017.pgc
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
/* @tier hard @module au @transform authorization-dbio */
|
||||
/*
|
||||
* au_io_0017.pgc - 승인한도 보조 DBIO (ECPG) [tier=hard]
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
204
app/dbio/au_io_0018.c
Normal file
204
app/dbio/au_io_0018.c
Normal file
|
|
@ -0,0 +1,204 @@
|
|||
/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */
|
||||
/* These include files are added by the preprocessor */
|
||||
#include <ecpglib.h>
|
||||
#include <ecpgerrno.h>
|
||||
#include <sqlca.h>
|
||||
/* 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 <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
92
app/dbio/au_io_0018.pgc
Normal file
92
app/dbio/au_io_0018.pgc
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
/* @tier easy @module au @transform authorization-dbio */
|
||||
/*
|
||||
* au_io_0018.pgc - 승인한도 보조 DBIO (ECPG) [tier=easy]
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
204
app/dbio/au_io_0019.c
Normal file
204
app/dbio/au_io_0019.c
Normal file
|
|
@ -0,0 +1,204 @@
|
|||
/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */
|
||||
/* These include files are added by the preprocessor */
|
||||
#include <ecpglib.h>
|
||||
#include <ecpgerrno.h>
|
||||
#include <sqlca.h>
|
||||
/* 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 <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
92
app/dbio/au_io_0019.pgc
Normal file
92
app/dbio/au_io_0019.pgc
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
/* @tier hard @module au @transform authorization-dbio */
|
||||
/*
|
||||
* au_io_0019.pgc - 승인한도 보조 DBIO (ECPG) [tier=hard]
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
204
app/dbio/au_io_0020.c
Normal file
204
app/dbio/au_io_0020.c
Normal file
|
|
@ -0,0 +1,204 @@
|
|||
/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */
|
||||
/* These include files are added by the preprocessor */
|
||||
#include <ecpglib.h>
|
||||
#include <ecpgerrno.h>
|
||||
#include <sqlca.h>
|
||||
/* 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 <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
92
app/dbio/au_io_0020.pgc
Normal file
92
app/dbio/au_io_0020.pgc
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
/* @tier easy @module au @transform authorization-dbio */
|
||||
/*
|
||||
* au_io_0020.pgc - 승인한도 보조 DBIO (ECPG) [tier=easy]
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
204
app/dbio/au_io_0021.c
Normal file
204
app/dbio/au_io_0021.c
Normal file
|
|
@ -0,0 +1,204 @@
|
|||
/* Processed by ecpg (15.18 (Debian 15.18-0+deb12u1)) */
|
||||
/* These include files are added by the preprocessor */
|
||||
#include <ecpglib.h>
|
||||
#include <ecpgerrno.h>
|
||||
#include <sqlca.h>
|
||||
/* 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 <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
92
app/dbio/au_io_0021.pgc
Normal file
92
app/dbio/au_io_0021.pgc
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
/* @tier easy @module au @transform authorization-dbio */
|
||||
/*
|
||||
* au_io_0021.pgc - 승인한도 보조 DBIO (ECPG) [tier=easy]
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show more
Reference in a new issue