This commit is contained in:
Kane Wang 2019-12-29 15:02:41 +08:00
parent 8a7ff68090
commit 99ad1a491d
2 changed files with 64 additions and 0 deletions

View File

@ -97,3 +97,60 @@ void ImportCarDealerAchievementToOracle( std::string use
Environment::Cleanup();
}
void ImportCarDealerAchievementToOracle( std::string userName,
std::string password,
std::string tnsName,
std::vector<RepairOrder> & orderVector )
{
ostring sqlImport =
"";
//初始化
try
{
Environment::Initialize();
}
catch (exception & error)
{
string errorMessage = "ocilib初始化失败";
errorMessage.append(error.what());
throw runtime_error(errorMessage);
}
Connection* pConn = nullptr;
Statement* pStmt = nullptr;
try
{
pConn = new Connection(userName, password, tnsName);
}
catch (exception & error)
{
string errorMessage = "连接oracle失败";
errorMessage.append(error.what());
Environment::Cleanup();
throw runtime_error(errorMessage);
}
try
{
pStmt = new Statement(*pConn);
pStmt->AllowRebinding(true);
}
catch ( exception & error )
{
string errorMessage = "语句执行失败!";
errorMessage.append(error.what());
Environment::Cleanup();
throw runtime_error(errorMessage);
}
Environment::Cleanup();
}

View File

@ -3,9 +3,16 @@
#include <string>
#include <vector>
#include "../../Datastructure/CarDealerAchievement/CarDealerAchievement.h"
#include "../../Datastructure/RepairOrder/RepairOrder.h"
void ImportCarDealerAchievementToOracle( std::string userName,
std::string password,
std::string tnsName,
std::vector<CarDealerAchievement> & achievementVector );
void ImportCarDealerAchievementToOracle( std::string userName,
std::string password,
std::string tnsName,
std::vector<RepairOrder> & orderVector )