oracle读取ip_num用uint32_t接收,出错及解决
start_ip_num = rset->getNumber(1);
end_ip_num = rset->getNumber(2);
2988 info_log("GetIpLibraryFromOracle data rset [%zu,%zu,%d]\n",rset->getNumber(1),rset->getNumber(2),rset->getNumber(3));
src/ResultToDB.cpp:2988: warning: cannot pass objects of non-POD type 'class oracle::occi::Number' through '...'; call will abort at runtime
ip_num是ip转成数字的32位无符号整数。我用uint32_t 来接收从oracle读取的start_ip_num 和end_ip_num ,然后打印到Log里。结果是[3395598328,46913028405240,242],第一个数是正确的,第二个是错误的,原本第一个数和第个二数要相同(数据库里是相同的)。
uint32_t start_ip_num = 0;
uint32_t end_ip_num = 0;
start_ip_num = rset->getNumber(1);
end_ip_num = rset->getNumber(2);
int departid= rset->getNumber(3);
2018-06-12 15:44:17 src/ResultToDB.cpp:2723|flow_discover <INFO>GetIpLibraryFromOracle start
2018-06-12 15:44:17 src/ResultToDB.cpp:2990|GetIpLibraryFromOracle <INFO>GetIpLibraryFromOracle data [339
5598328,46913028405240,242]
2018-06-12 15:44:17 src/ResultToDB.cpp:2990|GetIpLibraryFromOracle <INFO>GetIpLibraryFromOracle data [339
5596779,46913028403691,242]
2018-06-12 15:44:17 src/ResultToDB.cpp:2990|GetIpLibraryFromOracle <INFO>GetIpLibraryFromOracle data [339
5598326,46913028405238,242]
2018-06-12 15:44:17 src/ResultToDB.cpp:2990|GetIpLibraryFromOracle <INFO>GetIpLibraryFromOracle data [339
5596757,46913028403669,242]
2018-06-12 15:44:17 src/ResultToDB.cpp:2990|GetIpLibraryFromOracle <INFO>GetIpLibraryFromOracle data [339
5598327,46913028405239,242]
2018-06-12 15:44:17 src/ResultToDB.cpp:2725|flow_discover <INFO>GetIpLibraryFromOracle end size[0]
第一个rset->getNumber(1)对了,rset->getNumber(2);错了
用uint64_t 接收就第一个数和第个二数相同。
2018-06-12 15:50:23 src/ResultToDB.cpp:2723|flow_discover <INFO>GetIpLibraryFromOracle start
2018-06-12 15:50:23 src/ResultToDB.cpp:2990|GetIpLibraryFromOracle <INFO>GetIpLibraryFromOracle data [339
5598328,3395598328,242]
2018-06-12 15:50:23 src/ResultToDB.cpp:2990|GetIpLibraryFromOracle <INFO>GetIpLibraryFromOracle data [339
5596779,3395596779,242]
2018-06-12 15:50:23 src/ResultToDB.cpp:2990|GetIpLibraryFromOracle <INFO>GetIpLibraryFromOracle data [339
5598326,3395598326,242]
2018-06-12 15:50:23 src/ResultToDB.cpp:2990|GetIpLibraryFromOracle <INFO>GetIpLibraryFromOracle data [339
5596757,3395596757,242]
2018-06-12 15:50:23 src/ResultToDB.cpp:2990|GetIpLibraryFromOracle <INFO>GetIpLibraryFromOracle data [339
5598327,3395598327,242]
2018-06-12 15:50:23 src/ResultToDB.cpp:2725|flow_discover <INFO>GetIpLibraryFromOracle end size[0]
为什么用uint32_t 第一个是对的,用uint64_t 两个都是对的??我目前还没有找出答案!