1. 程式人生 > >oracle讀取ip_num用uint32_t接收,出錯及解決

oracle讀取ip_num用uint32_t接收,出錯及解決

art 無符號 rac tip PE 第一個 答案 start runtime

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 兩個都是對的??我目前還沒有找出答案!

oracle讀取ip_num用uint32_t接收,出錯及解決