/*
 * st_adjpurge_dbio.pgc - 영향 없는 조정 정리 (st_adjpurge_dbio), libstdbio.a.
 * ECPG; DELETE .. WHERE biz_date BETWEEN a AND b AND delta=0 범위 삭제. 반환=삭제 행수.
 */
#include <string.h>
#include <userlog.h>
#include "st_adjpurge_dbio.h"

long stdb_purge_zero_adj(const char *from_date, const char *to_date)
{
    EXEC SQL BEGIN DECLARE SECTION;
    char h_from[16], h_to[16];
    EXEC SQL END DECLARE SECTION;
    strncpy(h_from, from_date, sizeof(h_from)-1); h_from[sizeof(h_from)-1] = 0;
    strncpy(h_to, to_date, sizeof(h_to)-1); h_to[sizeof(h_to)-1] = 0;
    EXEC SQL DELETE FROM st_adjust WHERE biz_date BETWEEN :h_from AND :h_to AND delta = 0;
    if (sqlca.sqlcode < 0) { userlog("stdb_purge_zero_adj FAIL [%d] %s", sqlca.sqlcode, sqlca.sqlerrm.sqlerrmc); return -1; }
    return (long) sqlca.sqlerrd[2];
}
