/*
 * py_dbio.h - py 모듈 (지급) DB 접근 계층 (libpydbio.a).
 * ECPG (EXEC SQL) functions compiled into a static library and linked into
 * py_svr and the py batches. They run on the caller's XA branch/connection
 * (no EXEC SQL CONNECT); sqlca is the shared per-thread ECPG SQLCA.
 * Return convention: 0 = ok, -1 = SQL error (caller may also inspect sqlca).
 */
#ifndef PY_DBIO_H
#define PY_DBIO_H

/* payout */
long pydb_next_payout_id(void);
int  pydb_insert_payout(long payout_id, const char *merch, const char *acct, long amount,
                        long fee, long net, const char *status, const char *channel,
                        const char *bizdate);
int  pydb_update_status(long payout_id, const char *status);
int  pydb_get_status(long payout_id, char *out /* >= 2 bytes */);
int  pydb_set_file(long payout_id, long file_id, const char *status);
int  pydb_upsert_summary(const char *merch, const char *bizdate, long cnt, long amount);
long pydb_insert_adjust(long payout_id, long delta, const char *reason, const char *bizdate);

/* account */
int  pydb_account_check(const char *acct, char *status_out /* >= 8 */, long *balance_out);
int  pydb_account_add(const char *acct, long delta);

#endif /* PY_DBIO_H */
