*.pc 파일을 작성하여
아래 [소스] 와 같이 소스 구현을 하였습니다.
이때 발생하는 에러가 구조체가 중첩구조체나 union 을 포함한다는 에러인데요...
구조체 정의 후 사용하는데 rec 객체를 인식 못하는 듯 한데....
조언 부탁드립니다. 파일 한개인데도 정상 동작을 하지 못하네요...
[에러]========================================================================
Pro*C/C++: Release 12.2.0.1.0 - Production on Fri Jun 14 14:28:24 2019
Copyright (c) 1982, 2017, Oracle and/or its affiliates. All rights reserved.
System default option values taken from: /usr/lib/oracle/12.2/client64/precomp/admin/pcscfg.cfg
Semantic error at line 112, column 8, file test.pc:
INTO :rec
.......1
PCC-S-02338, structure contains a nested struct or union
[ 소스 ]========================================================================
EXEC SQL INCLUDE sqlca;
struct timestamp
{
signed short year;
unsigned short month;
unsigned short day;
unsigned short hour;
unsigned short minute;
unsigned short second;
unsigned int fraction;
};
struct _top_tag
{
unsigned short shop_cd;
unsigned short tag_id;
unsigned short tag_typ_cd;
char tag_ip_addr[40+1];
char tag_mac_addr[20+1];
unsigned int tag_port_num;
char tag_bcd_val[20+1];
char rgstr_id[30+1];
struct timestamp rgst_dtm;
unsigned short curr_dnload_upgr_file_ver_num;
unsigned short curr_upgr_file_ver_num;
char last_chgr_id[30+1];
struct timestamp last_chg_dtm;
unsigned short tag_chg_cl_cd;
} topTag;
/*struct _top_tag rec;*/
EXEC SQL END DECLARE SECTION;
int selectTopTag(unsigned short shop_code, unsigned short tag_id, topTag *top_tag, char *conn_name)
{
/* 호스트 변수 */
EXEC SQL BEGIN DECLARE SECTION;
/*struct topTag rec; */
char *H_conn_name;
unsigned short shop_code;
unsigned short tag_id;
struct _top_tag rec;
EXEC SQL END DECLARE SECTION;
H_conn_name = conn_name;
/* 호스트 변수 초기화 */
memset(&rec, 0x00, sizeof(topTag));
/* SELECT */
EXEC SQL AT :H_conn_name
SELECT
SHOP_CD,
TO_NUMBER(TAG_ID),
TO_NUMBER(TAG_TYP_CD),
TAG_IP_ADDR,
UPPER(TAG_MAC_ADDR),
TAG_PORT_NUM,
TAG_BCD_VAL,
RGSTR_ID,
RGST_DTM,
CURR_DNLOAD_UPGR_FILE_VER_NUM,
CURR_UPGR_FILE_VER_NUM,
LAST_CHGR_ID,
LAST_CHG_DTM,
TO_NUMBER(TAG_CHG_CL_CD)
INTO :rec
FROM TOP_TAG
WHERE SHOP_CD = :shop_code
AND TO_NUMBER(TAG_ID) = :tag_id;
if (sqlca.sqlcode == SQL_SUCCESS)
{
memcpy(top_tag, &rec, sizeof(topTag));
return 1;
}
else if (sqlca.sqlcode == SQL_NO_DATA)
return 0;
else /* SQL_ERROR 또는 SQL_SUCCESS_WITH_INFO */
return -1;
}
========================================================================
|