/*
 * vl_open_dbio.pgc - 미결(OPEN) 의심거래 총수 (libvldbio.a).
 * ECPG functions; run on the caller's XA branch. No EXEC SQL CONNECT.
 */
#include <string.h>
#include <userlog.h>
#include "vl_open_dbio.h"

long vldb_open_count(void)
{
    EXEC SQL BEGIN DECLARE SECTION;
    long h_cnt;
    EXEC SQL END DECLARE SECTION;
    EXEC SQL SELECT count(*) INTO :h_cnt FROM vl_suspect WHERE status = 'OPEN';
    if (sqlca.sqlcode < 0) { userlog("vldb_open_count FAIL [%d]", sqlca.sqlcode); return -1; }
    return h_cnt;
}
