From 06f18d2080faec44080b764248eec11be2a1be78 Mon Sep 17 00:00:00 2001 From: Kane Wang Date: Sat, 18 Jan 2020 16:33:28 +0800 Subject: [PATCH] ... --- .../car_dealer_util/source/qrc_resource.cpp | 60 ++++++------- .../oracle/ImportToOracle.cpp | 86 ++++++++----------- 2 files changed, 65 insertions(+), 81 deletions(-) diff --git a/代码/cpp/car_dealer_util/proj/vs2019/car_dealer_util/source/qrc_resource.cpp b/代码/cpp/car_dealer_util/proj/vs2019/car_dealer_util/source/qrc_resource.cpp index aa62165..e52aa54 100644 --- a/代码/cpp/car_dealer_util/proj/vs2019/car_dealer_util/source/qrc_resource.cpp +++ b/代码/cpp/car_dealer_util/proj/vs2019/car_dealer_util/source/qrc_resource.cpp @@ -36909,94 +36909,94 @@ static const unsigned char qt_resource_struct[] = { 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, // :/QMainFrame/Resources/8218_box1.png 0x0,0x0,0x1,0x2,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x1,0x3f,0xef, -0x0,0x0,0x1,0x6f,0x14,0x6a,0x33,0xae, +0x0,0x0,0x1,0x68,0x54,0x2f,0x0,0xf6, // :/QMainFrame/Resources/find.png 0x0,0x0,0x1,0x22,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x1,0xaa,0x5f, -0x0,0x0,0x1,0x6f,0x14,0x6a,0x33,0xb8, +0x0,0x0,0x1,0x68,0x54,0x2f,0x0,0xfd, // :/QMainFrame/Resources/print.png 0x0,0x0,0x1,0x62,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x2,0x47,0x63, -0x0,0x0,0x1,0x6f,0x14,0x6a,0x33,0xbe, +0x0,0x0,0x1,0x68,0x54,0x2f,0x1,0x2, // :/QMainFrame/Resources/option.png 0x0,0x0,0x2,0x94,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x7,0x6,0xb8, -0x0,0x0,0x1,0x6f,0x14,0x6a,0x33,0xbc, +0x0,0x0,0x1,0x68,0x54,0x2f,0x1,0x1, // :/QMainFrame/Resources/x.png 0x0,0x0,0x2,0x2c,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x5,0x6a,0x2d, -0x0,0x0,0x1,0x6f,0x14,0x6a,0x33,0xc1, +0x0,0x0,0x1,0x68,0x54,0x2f,0x1,0x6, // :/QMainFrame/Resources/telephone.png 0x0,0x0,0x2,0xc4,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x7,0xb2,0x8, -0x0,0x0,0x1,0x6f,0x14,0x6a,0x33,0xc0, +0x0,0x0,0x1,0x68,0x54,0x2f,0x1,0x5, // :/QMainFrame/Resources/plus.png 0x0,0x0,0x2,0x52,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x6,0x5d,0x5f, -0x0,0x0,0x1,0x6f,0x14,0x6a,0x33,0xbd, +0x0,0x0,0x1,0x68,0x54,0x2f,0x1,0x2, // :/QMainFrame/Resources/20121016085311441_easyicon_cn_128.png 0x0,0x0,0x0,0x82,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x77,0x17, -0x0,0x0,0x1,0x6f,0x14,0x6a,0x33,0xae, +0x0,0x0,0x1,0x68,0x54,0x2f,0x0,0xf5, // :/QMainFrame/Resources/new.png 0x0,0x0,0x2,0xe4,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x7,0xcc,0x61, -0x0,0x0,0x1,0x6f,0x14,0x6a,0x33,0xbc, +0x0,0x0,0x1,0x68,0x54,0x2f,0x1,0x0, // :/QMainFrame/Resources/CPIC.png 0x0,0x0,0x2,0x3c,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x5,0xc9,0x50, -0x0,0x0,0x1,0x6f,0x14,0x6a,0x33,0xb1, +0x0,0x0,0x1,0x68,0x54,0x2f,0x0,0xf7, // :/QMainFrame/Resources/ok.png 0x0,0x0,0x1,0x38,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x1,0xe8,0x27, -0x0,0x0,0x1,0x6f,0x14,0x6a,0x33,0xbc, +0x0,0x0,0x1,0x68,0x54,0x2f,0x1,0x1, // :/QMainFrame/Resources/face.png 0x0,0x0,0x1,0xc8,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x4,0x29,0xa6, -0x0,0x0,0x1,0x6f,0x14,0x6a,0x33,0xb8, +0x0,0x0,0x1,0x68,0x54,0x2f,0x0,0xfd, // :/QMainFrame/Resources/CNY_Red.png 0x0,0x0,0x1,0xf8,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x4,0xfc,0xe0, -0x0,0x0,0x1,0x6f,0x14,0x6a,0x33,0xb0, +0x0,0x0,0x1,0x68,0x54,0x2f,0x0,0xf6, // :/QMainFrame/Resources/car2.png 0x0,0x0,0x3,0x10,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x8,0x69,0x71, -0x0,0x0,0x1,0x6f,0x14,0x6a,0x33,0xb4, +0x0,0x0,0x1,0x68,0x54,0x2f,0x0,0xfa, // :/QMainFrame/Resources/app.ico 0x0,0x0,0x0,0x46,0x0,0x1,0x0,0x0,0x0,0x1,0x0,0x0,0x2,0x22, -0x0,0x0,0x1,0x6f,0x14,0x6a,0x33,0xb3, +0x0,0x0,0x1,0x68,0x54,0x2f,0x0,0xf9, // :/QMainFrame/Resources/save.png 0x0,0x0,0x2,0x7e,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x6,0xcf,0x1, -0x0,0x0,0x1,0x6f,0x14,0x6a,0x33,0xbf, +0x0,0x0,0x1,0x68,0x54,0x2f,0x1,0x4, // :/QMainFrame/Resources/car.png 0x0,0x0,0x0,0x5a,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x1f,0x7e, -0x0,0x0,0x1,0x6f,0x14,0x6a,0x33,0xb4, +0x0,0x0,0x1,0x68,0x54,0x2f,0x0,0xf9, // :/QMainFrame/Resources/cat.png 0x0,0x0,0x0,0x6e,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x55,0x58, -0x0,0x0,0x1,0x6f,0x14,0x6a,0x33,0xb5, +0x0,0x0,0x1,0x68,0x54,0x2f,0x0,0xfa, // :/QMainFrame/Resources/excel.png 0x0,0x0,0x2,0x14,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x5,0x51,0x43, -0x0,0x0,0x1,0x6f,0x14,0x6a,0x33,0xb7, +0x0,0x0,0x1,0x68,0x54,0x2f,0x0,0xfc, // :/QMainFrame/Resources/CPIC??.png 0x0,0x0,0x1,0x7a,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x2,0x9e,0xab, -0x0,0x0,0x1,0x6f,0x14,0x6a,0x33,0xb2, +0x0,0x0,0x1,0x68,0x54,0x2f,0x0,0xf8, // :/QMainFrame/Resources/dec.png 0x0,0x0,0x0,0x32,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x0, -0x0,0x0,0x1,0x6f,0x14,0x6a,0x33,0xb6, +0x0,0x0,0x1,0x68,0x54,0x2f,0x0,0xfb, // :/QMainFrame/Resources/folder.png 0x0,0x0,0x0,0xd2,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0xcc,0x2a, -0x0,0x0,0x1,0x6f,0x14,0x6a,0x33,0xb9, +0x0,0x0,0x1,0x68,0x54,0x2f,0x0,0xfe, // :/QMainFrame/Resources/edit.png 0x0,0x0,0x2,0x68,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x6,0x61,0x1b, -0x0,0x0,0x1,0x6f,0x14,0x6a,0x33,0xb6, +0x0,0x0,0x1,0x68,0x54,0x2f,0x0,0xfc, // :/QMainFrame/Resources/clean.png 0x0,0x0,0x2,0xf8,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x8,0x3a,0x47, -0x0,0x0,0x1,0x6f,0x14,0x6a,0x33,0xb6, +0x0,0x0,0x1,0x68,0x54,0x2f,0x0,0xfb, // :/QMainFrame/Resources/gear.png 0x0,0x0,0x2,0xae,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x7,0x5c,0x60, -0x0,0x0,0x1,0x6f,0x14,0x6a,0x33,0xb9, +0x0,0x0,0x1,0x68,0x54,0x2f,0x0,0xfe, // :/QMainFrame/Resources/quit.png 0x0,0x0,0x0,0xec,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0xe0,0xcc, -0x0,0x0,0x1,0x6f,0x14,0x6a,0x33,0xbf, +0x0,0x0,0x1,0x68,0x54,0x2f,0x1,0x3, // :/QMainFrame/Resources/save2.png 0x0,0x0,0x1,0x4a,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x2,0x29,0x5d, -0x0,0x0,0x1,0x6f,0x14,0x6a,0x33,0xc0, +0x0,0x0,0x1,0x68,0x54,0x2f,0x1,0x4, // :/QMainFrame/Resources/manager.png 0x0,0x0,0x1,0x94,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x3,0x55,0x8f, -0x0,0x0,0x1,0x6f,0x14,0x6a,0x33,0xbb, +0x0,0x0,0x1,0x68,0x54,0x2f,0x1,0x0, // :/QMainFrame/Resources/login.png 0x0,0x0,0x1,0xb0,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x3,0xb9,0xe4, -0x0,0x0,0x1,0x6f,0x14,0x6a,0x33,0xba, +0x0,0x0,0x1,0x68,0x54,0x2f,0x0,0xff, // :/QMainFrame/Resources/tongji.png 0x0,0x0,0x1,0xde,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x4,0x8a,0x1, -0x0,0x0,0x1,0x6f,0x14,0x6a,0x33,0xc1, +0x0,0x0,0x1,0x68,0x54,0x2f,0x1,0x5, }; diff --git a/代码/cpp/car_dealer_util/source/Data/DataManipulation/oracle/ImportToOracle.cpp b/代码/cpp/car_dealer_util/source/Data/DataManipulation/oracle/ImportToOracle.cpp index 2522324..91557ba 100644 --- a/代码/cpp/car_dealer_util/source/Data/DataManipulation/oracle/ImportToOracle.cpp +++ b/代码/cpp/car_dealer_util/source/Data/DataManipulation/oracle/ImportToOracle.cpp @@ -2,15 +2,16 @@ #include #include #include "ImportToOracle.h" +#include "../../../db/ocilib/db_oper.h" using namespace std; using namespace ocilib; -void l_error_handler(OCI_Error* pError) +void l_error_handler( OCI_Error * pError ) { - string errorString = OCI_ErrorGetString(pError); + string errorString = OCI_ErrorGetString( pError ); - std::runtime_error error(OCI_ErrorGetString(pError)); + std::runtime_error error( OCI_ErrorGetString( pError ) ); throw error; } @@ -116,8 +117,9 @@ void ImportCarDealerAchievementToOracle( std::string use { OCI_Connection * pConnection = nullptr; OCI_Statement * pStatement = nullptr; + int returnCode = 0; - ostring sqlImport = + const otext * szSqlImport = "BEGIN " " car_dealer.data_import_util_pkg.import_cardealer_achvmnt( :a_the_year, " " :a_the_month, " @@ -129,6 +131,34 @@ void ImportCarDealerAchievementToOracle( std::string use " :a_pingan_amount, " " :a_others_amount ); " "END; "; + + //初始化 + returnCode = OCI_Initialize( l_error_handler, nullptr, OCI_ENV_DEFAULT ); + + if ( static_cast(returnCode) == false ) + { + string errorMessage( "ocilib初始化错误:" ); + errorMessage.append( get_last_error_message() ); + + throw runtime_error( errorMessage ); + } + + pConnection = OCI_ConnectionCreate( tnsName.c_str(), + userName.c_str(), + password.c_str(), + OCI_SESSION_DEFAULT ); + + pStatement = OCI_StatementCreate( pConnection ); + + OCI_AllowRebinding( pStatement, true ); + OCI_Prepare( pStatement, szSqlImport ); + + for ( auto iterAchievement = achievementVector.begin(); + iterAchievement != achievementVector.end(); + ++iterAchievement ) + { + + } } @@ -137,7 +167,7 @@ void ImportRepairOrderToOracle( std::string userName, std::string tnsName, std::vector & orderVector ) { - ostring sqlImport = + const otext * szSqlImport = "BEGIN" " car_dealer.dat:a_import_util_pkg.import_repairing_order(:a_branch_name," " :a_order_no," @@ -168,50 +198,4 @@ void ImportRepairOrderToOracle( std::string userName, "END;"; //初始化 - 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(); }