车商方案表导入功能完成!

This commit is contained in:
Kane Wang 2020-03-16 21:14:50 +08:00
parent 89192f2a82
commit 87a729cbaf
2 changed files with 270 additions and 244 deletions

View File

@ -1,4 +1,5 @@
#include <ocilib.hpp> //如果文件是utf-8编码存放要注意sql语句编码和ocilib库版本的问题。
#include <ocilib.hpp>
#include <stdexcept> #include <stdexcept>
#include <QString> #include <QString>
#include "ImportToOracle.h" #include "ImportToOracle.h"
@ -8,10 +9,10 @@ using namespace std;
using namespace ocilib; using namespace ocilib;
void ImportCarDealerAchievementToOracleCpp( std::string userName, void ImportCarDealerAchievementToOracleCpp(const std::string& userName,
std::string password, const std::string& password,
std::string tnsName, const std::string& tnsName,
std::vector<CarDealerAchievement> & achievementVector ) const std::vector<CarDealerAchievement>& achievementVector)
{ {
ostring sqlImport = ostring sqlImport =
"BEGIN " "BEGIN "
@ -171,9 +172,9 @@ void ImportCarDealerAchievementToOracle( std::string use
* \param tnsName oracle TNS名称 * \param tnsName oracle TNS名称
* \param orderVector * \param orderVector
************************************************/ ************************************************/
void ImportCarDealerSchemeToOracle( std::string userName, void ImportCarDealerSchemeToOracle(const std::string& userName,
std::string password, const std::string& password,
std::string tnsName, const std::string& tnsName,
std::vector<CarDealerScheme>& schemeVector) std::vector<CarDealerScheme>& schemeVector)
{ {
//防御性验证 //防御性验证
@ -189,7 +190,16 @@ void ImportCarDealerSchemeToOracle( std::string userName,
Statement* pStatement = nullptr; Statement* pStatement = nullptr;
ostring sqlInsertScheme = ostring sqlInsertScheme =
""; "begin \n"
" car_dealer.data_import_util_pkg.import_carder_scheme( :the_year, \n"
" :the_month, \n"
" :car_dealer_code, \n"
" :man_hour_price, \n"
" :part_price, \n"
" :claim_support, \n"
" :scheme, \n"
" :is_qualified ); \n"
"end; ";
//初始化 //初始化
try try
@ -236,15 +246,31 @@ void ImportCarDealerSchemeToOracle( std::string userName,
try try
{ {
pStatement->Bind<ostring, int>(ostring(":the_year"), theYear, theYear.size(), BindInfo::BindDirectionValues::In);
pStatement->Bind<ostring, int>(ostring(":the_month"), theMonth, theMonth.size(), BindInfo::BindDirectionValues::In);
pStatement->Bind<ostring, int>(ostring(":car_dealer_code"), carDealerCode, carDealerCode.size(), BindInfo::BindDirectionValues::In);
pStatement->Bind<ostring, int>(ostring(":man_hour_price"), manHourPrice, manHourPrice.size(), BindInfo::BindDirectionValues::In);
pStatement->Bind<ostring, int>(ostring(":claim_support"), claimSupport, claimSupport.size(), BindInfo::BindDirectionValues::In);
pStatement->Bind<ostring, int>(ostring(":part_price"), partPrice, partPrice.size(), BindInfo::BindDirectionValues::In);
pStatement->Bind<ostring, int>(ostring(":scheme"), scheme, scheme.size(), BindInfo::BindDirectionValues::In);
pStatement->Bind<ostring, int>(ostring(":is_qualified"), isQualified, isQualified.size(), BindInfo::BindDirectionValues::In);
pStatement->ExecutePrepared();
} }
catch (exception & error) catch (exception & error)
{ {
} }
} }
} }
catch ( exception & erro ) catch (exception & error)
{ {
Environment::Cleanup();
throw runtime_error(error.what());
} }
Environment::Cleanup();
} }

View File

@ -14,10 +14,10 @@
* \param tnsName oracle TNS名称 * \param tnsName oracle TNS名称
* \param orderVector * \param orderVector
************************************************/ ************************************************/
void ImportCarDealerAchievementToOracle( std::string userName, void ImportCarDealerAchievementToOracleCpp(const std::string& userName,
std::string password, const std::string& password,
std::string tnsName, const std::string& tnsName,
std::vector<CarDealerAchievement> & achievementVector ); const std::vector<CarDealerAchievement>& achievementVector);
/************************************************ /************************************************
* \brief oracle数据库写入车商方案表 * \brief oracle数据库写入车商方案表
@ -26,9 +26,9 @@ void ImportCarDealerAchievementToOracle( std::string use
* \param tnsName oracle TNS名称 * \param tnsName oracle TNS名称
* \param orderVector * \param orderVector
************************************************/ ************************************************/
void ImportCarDealerSchemeToOracle( std::string userName, void ImportCarDealerSchemeToOracle(const std::string& userName,
std::string password, const std::string& password,
std::string tnsName, const std::string& tnsName,
std::vector<CarDealerScheme>& achievementVector); std::vector<CarDealerScheme>& achievementVector);
/************************************************ /************************************************