#pragma once
// I am automatically generated by ParseCTPHeaders.py
#include "ThostFtdcUserApiStruct.h"
#include <map>
#include <string>
#include "../ctpStatus.h"// gbk_to_utf8, utf8_to_gbk, CloseDetail
namespace localCTP{
struct CThostFtdcDisseminationFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcDisseminationField data;
CThostFtdcDisseminationFieldWrapper(const CThostFtdcDisseminationField& _data = { 0 }) :data(_data) { }
CThostFtdcDisseminationFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcDisseminationField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
data.SequenceSeries = std::stoi(rowValue.at("SequenceSeries"));
data.SequenceNo = std::stoi(rowValue.at("SequenceNo"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
std::to_string(data.SequenceSeries) + "','" + std::to_string(data.SequenceNo)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcReqUserLoginFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcReqUserLoginField data;
CThostFtdcReqUserLoginFieldWrapper(const CThostFtdcReqUserLoginField& _data = { 0 }) :data(_data) { }
CThostFtdcReqUserLoginFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcReqUserLoginField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
strncpy(data.Password, rowValue.at("Password").c_str(), sizeof(TThostFtdcPasswordType));
strncpy(data.UserProductInfo, rowValue.at("UserProductInfo").c_str(), sizeof(TThostFtdcProductInfoType));
strncpy(data.InterfaceProductInfo, rowValue.at("InterfaceProductInfo").c_str(), sizeof(TThostFtdcProductInfoType));
strncpy(data.ProtocolInfo, rowValue.at("ProtocolInfo").c_str(), sizeof(TThostFtdcProtocolInfoType));
strncpy(data.MacAddress, rowValue.at("MacAddress").c_str(), sizeof(TThostFtdcMacAddressType));
strncpy(data.OneTimePassword, rowValue.at("OneTimePassword").c_str(), sizeof(TThostFtdcPasswordType));
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldIPAddressType));
strncpy(data.LoginRemark, rowValue.at("LoginRemark").c_str(), sizeof(TThostFtdcLoginRemarkType));
data.ClientIPPort = std::stoi(rowValue.at("ClientIPPort"));
strncpy(data.ClientIPAddress, rowValue.at("ClientIPAddress").c_str(), sizeof(TThostFtdcIPAddressType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.TradingDay + "','" + data.BrokerID + "','" + data.UserID + "','" + data.Password + "','" + data.UserProductInfo + "','" + data.InterfaceProductInfo + "','" + data.ProtocolInfo + "','" + data.MacAddress + "','" + data.OneTimePassword + "','" + data.reserve1 + "','" + data.LoginRemark + "','" + std::to_string(data.ClientIPPort) + "','" + data.ClientIPAddress
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.UserID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& UserID) {
return "SELECT * FROM 'CThostFtdcReqUserLoginField' where BrokerID='" + BrokerID + "' and UserID='" + UserID + "';";
}
};
struct CThostFtdcRspUserLoginFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcRspUserLoginField data;
CThostFtdcRspUserLoginFieldWrapper(const CThostFtdcRspUserLoginField& _data = { 0 }) :data(_data) { }
CThostFtdcRspUserLoginFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcRspUserLoginField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.LoginTime, rowValue.at("LoginTime").c_str(), sizeof(TThostFtdcTimeType));
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
strncpy(data.SystemName, rowValue.at("SystemName").c_str(), sizeof(TThostFtdcSystemNameType));
data.FrontID = std::stoi(rowValue.at("FrontID"));
data.SessionID = std::stoi(rowValue.at("SessionID"));
strncpy(data.MaxOrderRef, rowValue.at("MaxOrderRef").c_str(), sizeof(TThostFtdcOrderRefType));
strncpy(data.SHFETime, rowValue.at("SHFETime").c_str(), sizeof(TThostFtdcTimeType));
strncpy(data.DCETime, rowValue.at("DCETime").c_str(), sizeof(TThostFtdcTimeType));
strncpy(data.CZCETime, rowValue.at("CZCETime").c_str(), sizeof(TThostFtdcTimeType));
strncpy(data.FFEXTime, rowValue.at("FFEXTime").c_str(), sizeof(TThostFtdcTimeType));
strncpy(data.INETime, rowValue.at("INETime").c_str(), sizeof(TThostFtdcTimeType));
strncpy(data.SysVersion, rowValue.at("SysVersion").c_str(), sizeof(TThostFtdcSysVersionType));
strncpy(data.GFEXTime, rowValue.at("GFEXTime").c_str(), sizeof(TThostFtdcTimeType));
data.LoginDRIdentityID = std::stoi(rowValue.at("LoginDRIdentityID"));
data.UserDRIdentityID = std::stoi(rowValue.at("UserDRIdentityID"));
strncpy(data.LastLoginTime, rowValue.at("LastLoginTime").c_str(), sizeof(TThostFtdcDateTimeType));
strncpy(data.ReserveInfo, rowValue.at("ReserveInfo").c_str(), sizeof(TThostFtdcReserveInfoType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.TradingDay + "','" + data.LoginTime + "','" + data.BrokerID + "','" + data.UserID + "','" + data.SystemName + "','" + std::to_string(data.FrontID) + "','" + std::to_string(data.SessionID) + "','" + data.MaxOrderRef + "','" + data.SHFETime + "','" + data.DCETime + "','" + data.CZCETime + "','" + data.FFEXTime + "','" + data.INETime + "','" + data.SysVersion + "','" + data.GFEXTime + "','" + std::to_string(data.LoginDRIdentityID) + "','" + std::to_string(data.UserDRIdentityID) + "','" + data.LastLoginTime + "','" + data.ReserveInfo
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.UserID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& UserID) {
return "SELECT * FROM 'CThostFtdcRspUserLoginField' where BrokerID='" + BrokerID + "' and UserID='" + UserID + "';";
}
};
struct CThostFtdcUserLogoutFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcUserLogoutField data;
CThostFtdcUserLogoutFieldWrapper(const CThostFtdcUserLogoutField& _data = { 0 }) :data(_data) { }
CThostFtdcUserLogoutFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcUserLogoutField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.UserID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.UserID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& UserID) {
return "SELECT * FROM 'CThostFtdcUserLogoutField' where BrokerID='" + BrokerID + "' and UserID='" + UserID + "';";
}
};
struct CThostFtdcForceUserLogoutFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcForceUserLogoutField data;
CThostFtdcForceUserLogoutFieldWrapper(const CThostFtdcForceUserLogoutField& _data = { 0 }) :data(_data) { }
CThostFtdcForceUserLogoutFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcForceUserLogoutField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.UserID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.UserID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& UserID) {
return "SELECT * FROM 'CThostFtdcForceUserLogoutField' where BrokerID='" + BrokerID + "' and UserID='" + UserID + "';";
}
};
struct CThostFtdcReqAuthenticateFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcReqAuthenticateField data;
CThostFtdcReqAuthenticateFieldWrapper(const CThostFtdcReqAuthenticateField& _data = { 0 }) :data(_data) { }
CThostFtdcReqAuthenticateFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcReqAuthenticateField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
strncpy(data.UserProductInfo, rowValue.at("UserProductInfo").c_str(), sizeof(TThostFtdcProductInfoType));
strncpy(data.AuthCode, rowValue.at("AuthCode").c_str(), sizeof(TThostFtdcAuthCodeType));
strncpy(data.AppID, rowValue.at("AppID").c_str(), sizeof(TThostFtdcAppIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.UserID + "','" + data.UserProductInfo + "','" + data.AuthCode + "','" + data.AppID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.UserID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& UserID) {
return "SELECT * FROM 'CThostFtdcReqAuthenticateField' where BrokerID='" + BrokerID + "' and UserID='" + UserID + "';";
}
};
struct CThostFtdcRspAuthenticateFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcRspAuthenticateField data;
CThostFtdcRspAuthenticateFieldWrapper(const CThostFtdcRspAuthenticateField& _data = { 0 }) :data(_data) { }
CThostFtdcRspAuthenticateFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcRspAuthenticateField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
strncpy(data.UserProductInfo, rowValue.at("UserProductInfo").c_str(), sizeof(TThostFtdcProductInfoType));
strncpy(data.AppID, rowValue.at("AppID").c_str(), sizeof(TThostFtdcAppIDType));
data.AppType = rowValue.at("AppType").empty() ? '0' : rowValue.at("AppType")[0];
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.UserID + "','" + data.UserProductInfo + "','" + data.AppID + "','" + (data.AppType == 0 ? '0' : data.AppType)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.UserID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& UserID) {
return "SELECT * FROM 'CThostFtdcRspAuthenticateField' where BrokerID='" + BrokerID + "' and UserID='" + UserID + "';";
}
};
struct CThostFtdcAuthenticationInfoFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcAuthenticationInfoField data;
CThostFtdcAuthenticationInfoFieldWrapper(const CThostFtdcAuthenticationInfoField& _data = { 0 }) :data(_data) { }
CThostFtdcAuthenticationInfoFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcAuthenticationInfoField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
strncpy(data.UserProductInfo, rowValue.at("UserProductInfo").c_str(), sizeof(TThostFtdcProductInfoType));
strncpy(data.AuthInfo, rowValue.at("AuthInfo").c_str(), sizeof(TThostFtdcAuthInfoType));
data.IsResult = std::stoi(rowValue.at("IsResult"));
strncpy(data.AppID, rowValue.at("AppID").c_str(), sizeof(TThostFtdcAppIDType));
data.AppType = rowValue.at("AppType").empty() ? '0' : rowValue.at("AppType")[0];
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldIPAddressType));
strncpy(data.ClientIPAddress, rowValue.at("ClientIPAddress").c_str(), sizeof(TThostFtdcIPAddressType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.UserID + "','" + data.UserProductInfo + "','" + data.AuthInfo + "','" + std::to_string(data.IsResult) + "','" + data.AppID + "','" + (data.AppType == 0 ? '0' : data.AppType) + "','" + data.reserve1 + "','" + data.ClientIPAddress
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.UserID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& UserID) {
return "SELECT * FROM 'CThostFtdcAuthenticationInfoField' where BrokerID='" + BrokerID + "' and UserID='" + UserID + "';";
}
};
struct CThostFtdcRspUserLogin2FieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcRspUserLogin2Field data;
CThostFtdcRspUserLogin2FieldWrapper(const CThostFtdcRspUserLogin2Field& _data = { 0 }) :data(_data) { }
CThostFtdcRspUserLogin2FieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcRspUserLogin2Field() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.LoginTime, rowValue.at("LoginTime").c_str(), sizeof(TThostFtdcTimeType));
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
strncpy(data.SystemName, rowValue.at("SystemName").c_str(), sizeof(TThostFtdcSystemNameType));
data.FrontID = std::stoi(rowValue.at("FrontID"));
data.SessionID = std::stoi(rowValue.at("SessionID"));
strncpy(data.MaxOrderRef, rowValue.at("MaxOrderRef").c_str(), sizeof(TThostFtdcOrderRefType));
strncpy(data.SHFETime, rowValue.at("SHFETime").c_str(), sizeof(TThostFtdcTimeType));
strncpy(data.DCETime, rowValue.at("DCETime").c_str(), sizeof(TThostFtdcTimeType));
strncpy(data.CZCETime, rowValue.at("CZCETime").c_str(), sizeof(TThostFtdcTimeType));
strncpy(data.FFEXTime, rowValue.at("FFEXTime").c_str(), sizeof(TThostFtdcTimeType));
strncpy(data.INETime, rowValue.at("INETime").c_str(), sizeof(TThostFtdcTimeType));
strncpy(data.RandomString, rowValue.at("RandomString").c_str(), sizeof(TThostFtdcRandomStringType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.TradingDay + "','" + data.LoginTime + "','" + data.BrokerID + "','" + data.UserID + "','" + data.SystemName + "','" + std::to_string(data.FrontID) + "','" + std::to_string(data.SessionID) + "','" + data.MaxOrderRef + "','" + data.SHFETime + "','" + data.DCETime + "','" + data.CZCETime + "','" + data.FFEXTime + "','" + data.INETime + "','" + data.RandomString
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.UserID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& UserID) {
return "SELECT * FROM 'CThostFtdcRspUserLogin2Field' where BrokerID='" + BrokerID + "' and UserID='" + UserID + "';";
}
};
struct CThostFtdcTransferHeaderFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcTransferHeaderField data;
CThostFtdcTransferHeaderFieldWrapper(const CThostFtdcTransferHeaderField& _data = { 0 }) :data(_data) { }
CThostFtdcTransferHeaderFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcTransferHeaderField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.Version, rowValue.at("Version").c_str(), sizeof(TThostFtdcVersionType));
strncpy(data.TradeCode, rowValue.at("TradeCode").c_str(), sizeof(TThostFtdcTradeCodeType));
strncpy(data.TradeDate, rowValue.at("TradeDate").c_str(), sizeof(TThostFtdcTradeDateType));
strncpy(data.TradeTime, rowValue.at("TradeTime").c_str(), sizeof(TThostFtdcTradeTimeType));
strncpy(data.TradeSerial, rowValue.at("TradeSerial").c_str(), sizeof(TThostFtdcTradeSerialType));
strncpy(data.FutureID, rowValue.at("FutureID").c_str(), sizeof(TThostFtdcFutureIDType));
strncpy(data.BankID, rowValue.at("BankID").c_str(), sizeof(TThostFtdcBankIDType));
strncpy(data.BankBrchID, rowValue.at("BankBrchID").c_str(), sizeof(TThostFtdcBankBrchIDType));
strncpy(data.OperNo, rowValue.at("OperNo").c_str(), sizeof(TThostFtdcOperNoType));
strncpy(data.DeviceID, rowValue.at("DeviceID").c_str(), sizeof(TThostFtdcDeviceIDType));
strncpy(data.RecordNum, rowValue.at("RecordNum").c_str(), sizeof(TThostFtdcRecordNumType));
data.SessionID = std::stoi(rowValue.at("SessionID"));
data.RequestID = std::stoi(rowValue.at("RequestID"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.Version + "','" + data.TradeCode + "','" + data.TradeDate + "','" + data.TradeTime + "','" + data.TradeSerial + "','" + data.FutureID + "','" + data.BankID + "','" + data.BankBrchID + "','" + data.OperNo + "','" + data.DeviceID + "','" + data.RecordNum + "','" + std::to_string(data.SessionID) + "','" + std::to_string(data.RequestID)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcTransferBankToFutureReqFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcTransferBankToFutureReqField data;
CThostFtdcTransferBankToFutureReqFieldWrapper(const CThostFtdcTransferBankToFutureReqField& _data = { 0 }) :data(_data) { }
CThostFtdcTransferBankToFutureReqFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcTransferBankToFutureReqField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.FutureAccount, rowValue.at("FutureAccount").c_str(), sizeof(TThostFtdcAccountIDType));
data.FuturePwdFlag = rowValue.at("FuturePwdFlag").empty() ? '0' : rowValue.at("FuturePwdFlag")[0];
strncpy(data.FutureAccPwd, rowValue.at("FutureAccPwd").c_str(), sizeof(TThostFtdcFutureAccPwdType));
data.TradeAmt = std::stod(rowValue.at("TradeAmt"));
data.CustFee = std::stod(rowValue.at("CustFee"));
strncpy(data.CurrencyCode, rowValue.at("CurrencyCode").c_str(), sizeof(TThostFtdcCurrencyCodeType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.FutureAccount + "','" + (data.FuturePwdFlag == 0 ? '0' : data.FuturePwdFlag) + "','" + data.FutureAccPwd + "','" + std::to_string(data.TradeAmt) + "','" + std::to_string(data.CustFee) + "','" + data.CurrencyCode
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcTransferBankToFutureRspFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcTransferBankToFutureRspField data;
CThostFtdcTransferBankToFutureRspFieldWrapper(const CThostFtdcTransferBankToFutureRspField& _data = { 0 }) :data(_data) { }
CThostFtdcTransferBankToFutureRspFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcTransferBankToFutureRspField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.RetCode, rowValue.at("RetCode").c_str(), sizeof(TThostFtdcRetCodeType));
strncpy(data.RetInfo, rowValue.at("RetInfo").c_str(), sizeof(TThostFtdcRetInfoType));
strncpy(data.FutureAccount, rowValue.at("FutureAccount").c_str(), sizeof(TThostFtdcAccountIDType));
data.TradeAmt = std::stod(rowValue.at("TradeAmt"));
data.CustFee = std::stod(rowValue.at("CustFee"));
strncpy(data.CurrencyCode, rowValue.at("CurrencyCode").c_str(), sizeof(TThostFtdcCurrencyCodeType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.RetCode + "','" + data.RetInfo + "','" + data.FutureAccount + "','" + std::to_string(data.TradeAmt) + "','" + std::to_string(data.CustFee) + "','" + data.CurrencyCode
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcTransferFutureToBankReqFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcTransferFutureToBankReqField data;
CThostFtdcTransferFutureToBankReqFieldWrapper(const CThostFtdcTransferFutureToBankReqField& _data = { 0 }) :data(_data) { }
CThostFtdcTransferFutureToBankReqFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcTransferFutureToBankReqField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.FutureAccount, rowValue.at("FutureAccount").c_str(), sizeof(TThostFtdcAccountIDType));
data.FuturePwdFlag = rowValue.at("FuturePwdFlag").empty() ? '0' : rowValue.at("FuturePwdFlag")[0];
strncpy(data.FutureAccPwd, rowValue.at("FutureAccPwd").c_str(), sizeof(TThostFtdcFutureAccPwdType));
data.TradeAmt = std::stod(rowValue.at("TradeAmt"));
data.CustFee = std::stod(rowValue.at("CustFee"));
strncpy(data.CurrencyCode, rowValue.at("CurrencyCode").c_str(), sizeof(TThostFtdcCurrencyCodeType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.FutureAccount + "','" + (data.FuturePwdFlag == 0 ? '0' : data.FuturePwdFlag) + "','" + data.FutureAccPwd + "','" + std::to_string(data.TradeAmt) + "','" + std::to_string(data.CustFee) + "','" + data.CurrencyCode
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcTransferFutureToBankRspFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcTransferFutureToBankRspField data;
CThostFtdcTransferFutureToBankRspFieldWrapper(const CThostFtdcTransferFutureToBankRspField& _data = { 0 }) :data(_data) { }
CThostFtdcTransferFutureToBankRspFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcTransferFutureToBankRspField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.RetCode, rowValue.at("RetCode").c_str(), sizeof(TThostFtdcRetCodeType));
strncpy(data.RetInfo, rowValue.at("RetInfo").c_str(), sizeof(TThostFtdcRetInfoType));
strncpy(data.FutureAccount, rowValue.at("FutureAccount").c_str(), sizeof(TThostFtdcAccountIDType));
data.TradeAmt = std::stod(rowValue.at("TradeAmt"));
data.CustFee = std::stod(rowValue.at("CustFee"));
strncpy(data.CurrencyCode, rowValue.at("CurrencyCode").c_str(), sizeof(TThostFtdcCurrencyCodeType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.RetCode + "','" + data.RetInfo + "','" + data.FutureAccount + "','" + std::to_string(data.TradeAmt) + "','" + std::to_string(data.CustFee) + "','" + data.CurrencyCode
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcTransferQryBankReqFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcTransferQryBankReqField data;
CThostFtdcTransferQryBankReqFieldWrapper(const CThostFtdcTransferQryBankReqField& _data = { 0 }) :data(_data) { }
CThostFtdcTransferQryBankReqFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcTransferQryBankReqField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.FutureAccount, rowValue.at("FutureAccount").c_str(), sizeof(TThostFtdcAccountIDType));
data.FuturePwdFlag = rowValue.at("FuturePwdFlag").empty() ? '0' : rowValue.at("FuturePwdFlag")[0];
strncpy(data.FutureAccPwd, rowValue.at("FutureAccPwd").c_str(), sizeof(TThostFtdcFutureAccPwdType));
strncpy(data.CurrencyCode, rowValue.at("CurrencyCode").c_str(), sizeof(TThostFtdcCurrencyCodeType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.FutureAccount + "','" + (data.FuturePwdFlag == 0 ? '0' : data.FuturePwdFlag) + "','" + data.FutureAccPwd + "','" + data.CurrencyCode
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcTransferQryBankRspFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcTransferQryBankRspField data;
CThostFtdcTransferQryBankRspFieldWrapper(const CThostFtdcTransferQryBankRspField& _data = { 0 }) :data(_data) { }
CThostFtdcTransferQryBankRspFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcTransferQryBankRspField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.RetCode, rowValue.at("RetCode").c_str(), sizeof(TThostFtdcRetCodeType));
strncpy(data.RetInfo, rowValue.at("RetInfo").c_str(), sizeof(TThostFtdcRetInfoType));
strncpy(data.FutureAccount, rowValue.at("FutureAccount").c_str(), sizeof(TThostFtdcAccountIDType));
data.TradeAmt = std::stod(rowValue.at("TradeAmt"));
data.UseAmt = std::stod(rowValue.at("UseAmt"));
data.FetchAmt = std::stod(rowValue.at("FetchAmt"));
strncpy(data.CurrencyCode, rowValue.at("CurrencyCode").c_str(), sizeof(TThostFtdcCurrencyCodeType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.RetCode + "','" + data.RetInfo + "','" + data.FutureAccount + "','" + std::to_string(data.TradeAmt) + "','" + std::to_string(data.UseAmt) + "','" + std::to_string(data.FetchAmt) + "','" + data.CurrencyCode
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcTransferQryDetailReqFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcTransferQryDetailReqField data;
CThostFtdcTransferQryDetailReqFieldWrapper(const CThostFtdcTransferQryDetailReqField& _data = { 0 }) :data(_data) { }
CThostFtdcTransferQryDetailReqFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcTransferQryDetailReqField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.FutureAccount, rowValue.at("FutureAccount").c_str(), sizeof(TThostFtdcAccountIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.FutureAccount
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcTransferQryDetailRspFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcTransferQryDetailRspField data;
CThostFtdcTransferQryDetailRspFieldWrapper(const CThostFtdcTransferQryDetailRspField& _data = { 0 }) :data(_data) { }
CThostFtdcTransferQryDetailRspFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcTransferQryDetailRspField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.TradeDate, rowValue.at("TradeDate").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.TradeTime, rowValue.at("TradeTime").c_str(), sizeof(TThostFtdcTradeTimeType));
strncpy(data.TradeCode, rowValue.at("TradeCode").c_str(), sizeof(TThostFtdcTradeCodeType));
data.FutureSerial = std::stoi(rowValue.at("FutureSerial"));
strncpy(data.FutureID, rowValue.at("FutureID").c_str(), sizeof(TThostFtdcFutureIDType));
strncpy(data.FutureAccount, rowValue.at("FutureAccount").c_str(), sizeof(TThostFtdcFutureAccountType));
data.BankSerial = std::stoi(rowValue.at("BankSerial"));
strncpy(data.BankID, rowValue.at("BankID").c_str(), sizeof(TThostFtdcBankIDType));
strncpy(data.BankBrchID, rowValue.at("BankBrchID").c_str(), sizeof(TThostFtdcBankBrchIDType));
strncpy(data.BankAccount, rowValue.at("BankAccount").c_str(), sizeof(TThostFtdcBankAccountType));
strncpy(data.CertCode, rowValue.at("CertCode").c_str(), sizeof(TThostFtdcCertCodeType));
strncpy(data.CurrencyCode, rowValue.at("CurrencyCode").c_str(), sizeof(TThostFtdcCurrencyCodeType));
data.TxAmount = std::stod(rowValue.at("TxAmount"));
data.Flag = rowValue.at("Flag").empty() ? '0' : rowValue.at("Flag")[0];
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.TradeDate + "','" + data.TradeTime + "','" + data.TradeCode + "','" + std::to_string(data.FutureSerial) + "','" + data.FutureID + "','" + data.FutureAccount + "','" + std::to_string(data.BankSerial) + "','" + data.BankID + "','" + data.BankBrchID + "','" + data.BankAccount + "','" + data.CertCode + "','" + data.CurrencyCode + "','" + std::to_string(data.TxAmount) + "','" + (data.Flag == 0 ? '0' : data.Flag)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcRspInfoFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcRspInfoField data;
CThostFtdcRspInfoFieldWrapper(const CThostFtdcRspInfoField& _data = { 0 }) :data(_data) { }
CThostFtdcRspInfoFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcRspInfoField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
data.ErrorID = std::stoi(rowValue.at("ErrorID"));
strncpy(data.ErrorMsg, utf8_to_gbk(rowValue.at("ErrorMsg")).c_str(), sizeof(TThostFtdcErrorMsgType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
std::to_string(data.ErrorID) + "','" + gbk_to_utf8(data.ErrorMsg)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcExchangeFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcExchangeField data;
CThostFtdcExchangeFieldWrapper(const CThostFtdcExchangeField& _data = { 0 }) :data(_data) { }
CThostFtdcExchangeFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcExchangeField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.ExchangeName, utf8_to_gbk(rowValue.at("ExchangeName")).c_str(), sizeof(TThostFtdcExchangeNameType));
data.ExchangeProperty = rowValue.at("ExchangeProperty").empty() ? '0' : rowValue.at("ExchangeProperty")[0];
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.ExchangeID + "','" + gbk_to_utf8(data.ExchangeName) + "','" + (data.ExchangeProperty == 0 ? '0' : data.ExchangeProperty)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcProductFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcProductField data;
CThostFtdcProductFieldWrapper(const CThostFtdcProductField& _data = { 0 }) :data(_data) { }
CThostFtdcProductFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcProductField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
strncpy(data.ProductName, utf8_to_gbk(rowValue.at("ProductName")).c_str(), sizeof(TThostFtdcProductNameType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
data.ProductClass = rowValue.at("ProductClass").empty() ? '0' : rowValue.at("ProductClass")[0];
data.VolumeMultiple = std::stoi(rowValue.at("VolumeMultiple"));
data.PriceTick = std::stod(rowValue.at("PriceTick"));
data.MaxMarketOrderVolume = std::stoi(rowValue.at("MaxMarketOrderVolume"));
data.MinMarketOrderVolume = std::stoi(rowValue.at("MinMarketOrderVolume"));
data.MaxLimitOrderVolume = std::stoi(rowValue.at("MaxLimitOrderVolume"));
data.MinLimitOrderVolume = std::stoi(rowValue.at("MinLimitOrderVolume"));
data.PositionType = rowValue.at("PositionType").empty() ? '0' : rowValue.at("PositionType")[0];
data.PositionDateType = rowValue.at("PositionDateType").empty() ? '0' : rowValue.at("PositionDateType")[0];
data.CloseDealType = rowValue.at("CloseDealType").empty() ? '0' : rowValue.at("CloseDealType")[0];
strncpy(data.TradeCurrencyID, rowValue.at("TradeCurrencyID").c_str(), sizeof(TThostFtdcCurrencyIDType));
data.MortgageFundUseRange = rowValue.at("MortgageFundUseRange").empty() ? '0' : rowValue.at("MortgageFundUseRange")[0];
strncpy(data.reserve2, rowValue.at("reserve2").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
data.UnderlyingMultiple = std::stod(rowValue.at("UnderlyingMultiple"));
strncpy(data.ProductID, rowValue.at("ProductID").c_str(), sizeof(TThostFtdcInstrumentIDType));
strncpy(data.ExchangeProductID, rowValue.at("ExchangeProductID").c_str(), sizeof(TThostFtdcInstrumentIDType));
data.OpenLimitControlLevel = rowValue.at("OpenLimitControlLevel").empty() ? '0' : rowValue.at("OpenLimitControlLevel")[0];
data.OrderFreqControlLevel = rowValue.at("OrderFreqControlLevel").empty() ? '0' : rowValue.at("OrderFreqControlLevel")[0];
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.reserve1 + "','" + gbk_to_utf8(data.ProductName) + "','" + data.ExchangeID + "','" + (data.ProductClass == 0 ? '0' : data.ProductClass) + "','" + std::to_string(data.VolumeMultiple) + "','" + std::to_string(data.PriceTick) + "','" + std::to_string(data.MaxMarketOrderVolume) + "','" + std::to_string(data.MinMarketOrderVolume) + "','" + std::to_string(data.MaxLimitOrderVolume) + "','" + std::to_string(data.MinLimitOrderVolume) + "','" + (data.PositionType == 0 ? '0' : data.PositionType) + "','" + (data.PositionDateType == 0 ? '0' : data.PositionDateType) + "','" + (data.CloseDealType == 0 ? '0' : data.CloseDealType) + "','" + data.TradeCurrencyID + "','" + (data.MortgageFundUseRange == 0 ? '0' : data.MortgageFundUseRange) + "','" + data.reserve2 + "','" + std::to_string(data.UnderlyingMultiple) + "','" + data.ProductID + "','" + data.ExchangeProductID + "','" + (data.OpenLimitControlLevel == 0 ? '0' : data.OpenLimitControlLevel) + "','" + (data.OrderFreqControlLevel == 0 ? '0' : data.OrderFreqControlLevel)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcInstrumentFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcInstrumentField data;
CThostFtdcInstrumentFieldWrapper(const CThostFtdcInstrumentField& _data = { 0 }) :data(_data) { }
CThostFtdcInstrumentFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcInstrumentField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.InstrumentName, utf8_to_gbk(rowValue.at("InstrumentName")).c_str(), sizeof(TThostFtdcInstrumentNameType));
strncpy(data.reserve2, rowValue.at("reserve2").c_str(), sizeof(TThostFtdcOldExchangeInstIDType));
strncpy(data.reserve3, rowValue.at("reserve3").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
data.ProductClass = rowValue.at("ProductClass").empty() ? '0' : rowValue.at("ProductClass")[0];
data.DeliveryYear = std::stoi(rowValue.at("DeliveryYear"));
data.DeliveryMonth = std::stoi(rowValue.at("DeliveryMonth"));
data.MaxMarketOrderVolume = std::stoi(rowValue.at("MaxMarketOrderVolume"));
data.MinMarketOrderVolume = std::stoi(rowValue.at("MinMarketOrderVolume"));
data.MaxLimitOrderVolume = std::stoi(rowValue.at("MaxLimitOrderVolume"));
data.MinLimitOrderVolume = std::stoi(rowValue.at("MinLimitOrderVolume"));
data.VolumeMultiple = std::stoi(rowValue.at("VolumeMultiple"));
data.PriceTick = std::stod(rowValue.at("PriceTick"));
strncpy(data.CreateDate, rowValue.at("CreateDate").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.OpenDate, rowValue.at("OpenDate").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.ExpireDate, rowValue.at("ExpireDate").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.StartDelivDate, rowValue.at("StartDelivDate").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.EndDelivDate, rowValue.at("EndDelivDate").c_str(), sizeof(TThostFtdcDateType));
data.InstLifePhase = rowValue.at("InstLifePhase").empty() ? '0' : rowValue.at("InstLifePhase")[0];
data.IsTrading = std::stoi(rowValue.at("IsTrading"));
data.PositionType = rowValue.at("PositionType").empty() ? '0' : rowValue.at("PositionType")[0];
data.PositionDateType = rowValue.at("PositionDateType").empty() ? '0' : rowValue.at("PositionDateType")[0];
data.LongMarginRatio = std::stod(rowValue.at("LongMarginRatio"));
data.ShortMarginRatio = std::stod(rowValue.at("ShortMarginRatio"));
data.MaxMarginSideAlgorithm = rowValue.at("MaxMarginSideAlgorithm").empty() ? '0' : rowValue.at("MaxMarginSideAlgorithm")[0];
strncpy(data.reserve4, rowValue.at("reserve4").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
data.StrikePrice = std::stod(rowValue.at("StrikePrice"));
data.OptionsType = rowValue.at("OptionsType").empty() ? '0' : rowValue.at("OptionsType")[0];
data.UnderlyingMultiple = std::stod(rowValue.at("UnderlyingMultiple"));
data.CombinationType = rowValue.at("CombinationType").empty() ? '0' : rowValue.at("CombinationType")[0];
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
strncpy(data.ExchangeInstID, rowValue.at("ExchangeInstID").c_str(), sizeof(TThostFtdcExchangeInstIDType));
strncpy(data.ProductID, rowValue.at("ProductID").c_str(), sizeof(TThostFtdcInstrumentIDType));
strncpy(data.UnderlyingInstrID, rowValue.at("UnderlyingInstrID").c_str(), sizeof(TThostFtdcInstrumentIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.reserve1 + "','" + data.ExchangeID + "','" + gbk_to_utf8(data.InstrumentName) + "','" + data.reserve2 + "','" + data.reserve3 + "','" + (data.ProductClass == 0 ? '0' : data.ProductClass) + "','" + std::to_string(data.DeliveryYear) + "','" + std::to_string(data.DeliveryMonth) + "','" + std::to_string(data.MaxMarketOrderVolume) + "','" + std::to_string(data.MinMarketOrderVolume) + "','" + std::to_string(data.MaxLimitOrderVolume) + "','" + std::to_string(data.MinLimitOrderVolume) + "','" + std::to_string(data.VolumeMultiple) + "','" + std::to_string(data.PriceTick) + "','" + data.CreateDate + "','" + data.OpenDate + "','" + data.ExpireDate + "','" + data.StartDelivDate + "','" + data.EndDelivDate + "','" + (data.InstLifePhase == 0 ? '0' : data.InstLifePhase) + "','" + std::to_string(data.IsTrading) + "','" + (data.PositionType == 0 ? '0' : data.PositionType) + "','" + (data.PositionDateType == 0 ? '0' : data.PositionDateType) + "','" + std::to_string(data.LongMarginRatio) + "','" + std::to_string(data.ShortMarginRatio) + "','" + (data.MaxMarginSideAlgorithm == 0 ? '0' : data.MaxMarginSideAlgorithm) + "','" + data.reserve4 + "','" + std::to_string(data.StrikePrice) + "','" + (data.OptionsType == 0 ? '0' : data.OptionsType) + "','" + std::to_string(data.UnderlyingMultiple) + "','" + (data.CombinationType == 0 ? '0' : data.CombinationType) + "','" + data.InstrumentID + "','" + data.ExchangeInstID + "','" + data.ProductID + "','" + data.UnderlyingInstrID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcBrokerFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcBrokerField data;
CThostFtdcBrokerFieldWrapper(const CThostFtdcBrokerField& _data = { 0 }) :data(_data) { }
CThostFtdcBrokerFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcBrokerField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.BrokerAbbr, rowValue.at("BrokerAbbr").c_str(), sizeof(TThostFtdcBrokerAbbrType));
strncpy(data.BrokerName, rowValue.at("BrokerName").c_str(), sizeof(TThostFtdcBrokerNameType));
data.IsActive = std::stoi(rowValue.at("IsActive"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.BrokerAbbr + "','" + data.BrokerName + "','" + std::to_string(data.IsActive)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcTraderFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcTraderField data;
CThostFtdcTraderFieldWrapper(const CThostFtdcTraderField& _data = { 0 }) :data(_data) { }
CThostFtdcTraderFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcTraderField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.TraderID, rowValue.at("TraderID").c_str(), sizeof(TThostFtdcTraderIDType));
strncpy(data.ParticipantID, rowValue.at("ParticipantID").c_str(), sizeof(TThostFtdcParticipantIDType));
strncpy(data.Password, rowValue.at("Password").c_str(), sizeof(TThostFtdcPasswordType));
data.InstallCount = std::stoi(rowValue.at("InstallCount"));
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
data.OrderCancelAlg = rowValue.at("OrderCancelAlg").empty() ? '0' : rowValue.at("OrderCancelAlg")[0];
data.TradeInstallCount = std::stoi(rowValue.at("TradeInstallCount"));
data.MDInstallCount = std::stoi(rowValue.at("MDInstallCount"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.ExchangeID + "','" + data.TraderID + "','" + data.ParticipantID + "','" + data.Password + "','" + std::to_string(data.InstallCount) + "','" + data.BrokerID + "','" + (data.OrderCancelAlg == 0 ? '0' : data.OrderCancelAlg) + "','" + std::to_string(data.TradeInstallCount) + "','" + std::to_string(data.MDInstallCount)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcInvestorFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcInvestorField data;
CThostFtdcInvestorFieldWrapper(const CThostFtdcInvestorField& _data = { 0 }) :data(_data) { }
CThostFtdcInvestorFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcInvestorField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorGroupID, rowValue.at("InvestorGroupID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.InvestorName, rowValue.at("InvestorName").c_str(), sizeof(TThostFtdcPartyNameType));
data.IdentifiedCardType = rowValue.at("IdentifiedCardType").empty() ? '0' : rowValue.at("IdentifiedCardType")[0];
strncpy(data.IdentifiedCardNo, rowValue.at("IdentifiedCardNo").c_str(), sizeof(TThostFtdcIdentifiedCardNoType));
data.IsActive = std::stoi(rowValue.at("IsActive"));
strncpy(data.Telephone, rowValue.at("Telephone").c_str(), sizeof(TThostFtdcTelephoneType));
strncpy(data.Address, rowValue.at("Address").c_str(), sizeof(TThostFtdcAddressType));
strncpy(data.OpenDate, rowValue.at("OpenDate").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.Mobile, rowValue.at("Mobile").c_str(), sizeof(TThostFtdcMobileType));
strncpy(data.CommModelID, rowValue.at("CommModelID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.MarginModelID, rowValue.at("MarginModelID").c_str(), sizeof(TThostFtdcInvestorIDType));
data.IsOrderFreq = rowValue.at("IsOrderFreq").empty() ? '0' : rowValue.at("IsOrderFreq")[0];
data.IsOpenVolLimit = rowValue.at("IsOpenVolLimit").empty() ? '0' : rowValue.at("IsOpenVolLimit")[0];
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.InvestorID + "','" + data.BrokerID + "','" + data.InvestorGroupID + "','" + data.InvestorName + "','" + (data.IdentifiedCardType == 0 ? '0' : data.IdentifiedCardType) + "','" + data.IdentifiedCardNo + "','" + std::to_string(data.IsActive) + "','" + data.Telephone + "','" + data.Address + "','" + data.OpenDate + "','" + data.Mobile + "','" + data.CommModelID + "','" + data.MarginModelID + "','" + (data.IsOrderFreq == 0 ? '0' : data.IsOrderFreq) + "','" + (data.IsOpenVolLimit == 0 ? '0' : data.IsOpenVolLimit)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcInvestorField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcTradingCodeFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcTradingCodeField data;
CThostFtdcTradingCodeFieldWrapper(const CThostFtdcTradingCodeField& _data = { 0 }) :data(_data) { }
CThostFtdcTradingCodeFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcTradingCodeField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.ClientID, rowValue.at("ClientID").c_str(), sizeof(TThostFtdcClientIDType));
data.IsActive = std::stoi(rowValue.at("IsActive"));
data.ClientIDType = rowValue.at("ClientIDType").empty() ? '0' : rowValue.at("ClientIDType")[0];
strncpy(data.BranchID, rowValue.at("BranchID").c_str(), sizeof(TThostFtdcBranchIDType));
data.BizType = rowValue.at("BizType").empty() ? '0' : rowValue.at("BizType")[0];
strncpy(data.InvestUnitID, rowValue.at("InvestUnitID").c_str(), sizeof(TThostFtdcInvestUnitIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.InvestorID + "','" + data.BrokerID + "','" + data.ExchangeID + "','" + data.ClientID + "','" + std::to_string(data.IsActive) + "','" + (data.ClientIDType == 0 ? '0' : data.ClientIDType) + "','" + data.BranchID + "','" + (data.BizType == 0 ? '0' : data.BizType) + "','" + data.InvestUnitID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcTradingCodeField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcPartBrokerFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcPartBrokerField data;
CThostFtdcPartBrokerFieldWrapper(const CThostFtdcPartBrokerField& _data = { 0 }) :data(_data) { }
CThostFtdcPartBrokerFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcPartBrokerField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.ParticipantID, rowValue.at("ParticipantID").c_str(), sizeof(TThostFtdcParticipantIDType));
data.IsActive = std::stoi(rowValue.at("IsActive"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.ExchangeID + "','" + data.ParticipantID + "','" + std::to_string(data.IsActive)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcSuperUserFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcSuperUserField data;
CThostFtdcSuperUserFieldWrapper(const CThostFtdcSuperUserField& _data = { 0 }) :data(_data) { }
CThostFtdcSuperUserFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcSuperUserField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
strncpy(data.UserName, rowValue.at("UserName").c_str(), sizeof(TThostFtdcUserNameType));
strncpy(data.Password, rowValue.at("Password").c_str(), sizeof(TThostFtdcPasswordType));
data.IsActive = std::stoi(rowValue.at("IsActive"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.UserID + "','" + data.UserName + "','" + data.Password + "','" + std::to_string(data.IsActive)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcSuperUserFunctionFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcSuperUserFunctionField data;
CThostFtdcSuperUserFunctionFieldWrapper(const CThostFtdcSuperUserFunctionField& _data = { 0 }) :data(_data) { }
CThostFtdcSuperUserFunctionFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcSuperUserFunctionField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
data.FunctionCode = rowValue.at("FunctionCode").empty() ? '0' : rowValue.at("FunctionCode")[0];
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.UserID + "','" + (data.FunctionCode == 0 ? '0' : data.FunctionCode)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcInvestorGroupFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcInvestorGroupField data;
CThostFtdcInvestorGroupFieldWrapper(const CThostFtdcInvestorGroupField& _data = { 0 }) :data(_data) { }
CThostFtdcInvestorGroupFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcInvestorGroupField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorGroupID, rowValue.at("InvestorGroupID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.InvestorGroupName, rowValue.at("InvestorGroupName").c_str(), sizeof(TThostFtdcInvestorGroupNameType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorGroupID + "','" + data.InvestorGroupName
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcTradingAccountFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcTradingAccountField data;
CThostFtdcTradingAccountFieldWrapper(const CThostFtdcTradingAccountField& _data = { 0 }) :data(_data) { }
CThostFtdcTradingAccountFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcTradingAccountField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.AccountID, rowValue.at("AccountID").c_str(), sizeof(TThostFtdcAccountIDType));
data.PreMortgage = std::stod(rowValue.at("PreMortgage"));
data.PreCredit = std::stod(rowValue.at("PreCredit"));
data.PreDeposit = std::stod(rowValue.at("PreDeposit"));
data.PreBalance = std::stod(rowValue.at("PreBalance"));
data.PreMargin = std::stod(rowValue.at("PreMargin"));
data.InterestBase = std::stod(rowValue.at("InterestBase"));
data.Interest = std::stod(rowValue.at("Interest"));
data.Deposit = std::stod(rowValue.at("Deposit"));
data.Withdraw = std::stod(rowValue.at("Withdraw"));
data.FrozenMargin = std::stod(rowValue.at("FrozenMargin"));
data.FrozenCash = std::stod(rowValue.at("FrozenCash"));
data.FrozenCommission = std::stod(rowValue.at("FrozenCommission"));
data.CurrMargin = std::stod(rowValue.at("CurrMargin"));
data.CashIn = std::stod(rowValue.at("CashIn"));
data.Commission = std::stod(rowValue.at("Commission"));
data.CloseProfit = std::stod(rowValue.at("CloseProfit"));
data.PositionProfit = std::stod(rowValue.at("PositionProfit"));
data.Balance = std::stod(rowValue.at("Balance"));
data.Available = std::stod(rowValue.at("Available"));
data.WithdrawQuota = std::stod(rowValue.at("WithdrawQuota"));
data.Reserve = std::stod(rowValue.at("Reserve"));
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcDateType));
data.SettlementID = std::stoi(rowValue.at("SettlementID"));
data.Credit = std::stod(rowValue.at("Credit"));
data.Mortgage = std::stod(rowValue.at("Mortgage"));
data.ExchangeMargin = std::stod(rowValue.at("ExchangeMargin"));
data.DeliveryMargin = std::stod(rowValue.at("DeliveryMargin"));
data.ExchangeDeliveryMargin = std::stod(rowValue.at("ExchangeDeliveryMargin"));
data.ReserveBalance = std::stod(rowValue.at("ReserveBalance"));
strncpy(data.CurrencyID, rowValue.at("CurrencyID").c_str(), sizeof(TThostFtdcCurrencyIDType));
data.PreFundMortgageIn = std::stod(rowValue.at("PreFundMortgageIn"));
data.PreFundMortgageOut = std::stod(rowValue.at("PreFundMortgageOut"));
data.FundMortgageIn = std::stod(rowValue.at("FundMortgageIn"));
data.FundMortgageOut = std::stod(rowValue.at("FundMortgageOut"));
data.FundMortgageAvailable = std::stod(rowValue.at("FundMortgageAvailable"));
data.MortgageableFund = std::stod(rowValue.at("MortgageableFund"));
data.SpecProductMargin = std::stod(rowValue.at("SpecProductMargin"));
data.SpecProductFrozenMargin = std::stod(rowValue.at("SpecProductFrozenMargin"));
data.SpecProductCommission = std::stod(rowValue.at("SpecProductCommission"));
data.SpecProductFrozenCommission = std::stod(rowValue.at("SpecProductFrozenCommission"));
data.SpecProductPositionProfit = std::stod(rowValue.at("SpecProductPositionProfit"));
data.SpecProductCloseProfit = std::stod(rowValue.at("SpecProductCloseProfit"));
data.SpecProductPositionProfitByAlg = std::stod(rowValue.at("SpecProductPositionProfitByAlg"));
data.SpecProductExchangeMargin = std::stod(rowValue.at("SpecProductExchangeMargin"));
data.BizType = rowValue.at("BizType").empty() ? '0' : rowValue.at("BizType")[0];
data.FrozenSwap = std::stod(rowValue.at("FrozenSwap"));
data.RemainSwap = std::stod(rowValue.at("RemainSwap"));
data.OptionValue = std::stod(rowValue.at("OptionValue"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.AccountID + "','" + std::to_string(data.PreMortgage) + "','" + std::to_string(data.PreCredit) + "','" + std::to_string(data.PreDeposit) + "','" + std::to_string(data.PreBalance) + "','" + std::to_string(data.PreMargin) + "','" + std::to_string(data.InterestBase) + "','" + std::to_string(data.Interest) + "','" + std::to_string(data.Deposit) + "','" + std::to_string(data.Withdraw) + "','" + std::to_string(data.FrozenMargin) + "','" + std::to_string(data.FrozenCash) + "','" + std::to_string(data.FrozenCommission) + "','" + std::to_string(data.CurrMargin) + "','" + std::to_string(data.CashIn) + "','" + std::to_string(data.Commission) + "','" + std::to_string(data.CloseProfit) + "','" + std::to_string(data.PositionProfit) + "','" + std::to_string(data.Balance) + "','" + std::to_string(data.Available) + "','" + std::to_string(data.WithdrawQuota) + "','" + std::to_string(data.Reserve) + "','" + data.TradingDay + "','" + std::to_string(data.SettlementID) + "','" + std::to_string(data.Credit) + "','" + std::to_string(data.Mortgage) + "','" + std::to_string(data.ExchangeMargin) + "','" + std::to_string(data.DeliveryMargin) + "','" + std::to_string(data.ExchangeDeliveryMargin) + "','" + std::to_string(data.ReserveBalance) + "','" + data.CurrencyID + "','" + std::to_string(data.PreFundMortgageIn) + "','" + std::to_string(data.PreFundMortgageOut) + "','" + std::to_string(data.FundMortgageIn) + "','" + std::to_string(data.FundMortgageOut) + "','" + std::to_string(data.FundMortgageAvailable) + "','" + std::to_string(data.MortgageableFund) + "','" + std::to_string(data.SpecProductMargin) + "','" + std::to_string(data.SpecProductFrozenMargin) + "','" + std::to_string(data.SpecProductCommission) + "','" + std::to_string(data.SpecProductFrozenCommission) + "','" + std::to_string(data.SpecProductPositionProfit) + "','" + std::to_string(data.SpecProductCloseProfit) + "','" + std::to_string(data.SpecProductPositionProfitByAlg) + "','" + std::to_string(data.SpecProductExchangeMargin) + "','" + (data.BizType == 0 ? '0' : data.BizType) + "','" + std::to_string(data.FrozenSwap) + "','" + std::to_string(data.RemainSwap) + "','" + std::to_string(data.OptionValue)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.AccountID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& AccountID) {
return "SELECT * FROM 'CThostFtdcTradingAccountField' where BrokerID='" + BrokerID + "' and AccountID='" + AccountID + "';";
}
};
struct CThostFtdcInvestorPositionFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcInvestorPositionField data;
CThostFtdcInvestorPositionFieldWrapper(const CThostFtdcInvestorPositionField& _data = { 0 }) :data(_data) { }
CThostFtdcInvestorPositionFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcInvestorPositionField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
data.PosiDirection = rowValue.at("PosiDirection").empty() ? '0' : rowValue.at("PosiDirection")[0];
data.HedgeFlag = rowValue.at("HedgeFlag").empty() ? '0' : rowValue.at("HedgeFlag")[0];
data.PositionDate = rowValue.at("PositionDate").empty() ? '0' : rowValue.at("PositionDate")[0];
data.YdPosition = std::stoi(rowValue.at("YdPosition"));
data.Position = std::stoi(rowValue.at("Position"));
data.LongFrozen = std::stoi(rowValue.at("LongFrozen"));
data.ShortFrozen = std::stoi(rowValue.at("ShortFrozen"));
data.LongFrozenAmount = std::stod(rowValue.at("LongFrozenAmount"));
data.ShortFrozenAmount = std::stod(rowValue.at("ShortFrozenAmount"));
data.OpenVolume = std::stoi(rowValue.at("OpenVolume"));
data.CloseVolume = std::stoi(rowValue.at("CloseVolume"));
data.OpenAmount = std::stod(rowValue.at("OpenAmount"));
data.CloseAmount = std::stod(rowValue.at("CloseAmount"));
data.PositionCost = std::stod(rowValue.at("PositionCost"));
data.PreMargin = std::stod(rowValue.at("PreMargin"));
data.UseMargin = std::stod(rowValue.at("UseMargin"));
data.FrozenMargin = std::stod(rowValue.at("FrozenMargin"));
data.FrozenCash = std::stod(rowValue.at("FrozenCash"));
data.FrozenCommission = std::stod(rowValue.at("FrozenCommission"));
data.CashIn = std::stod(rowValue.at("CashIn"));
data.Commission = std::stod(rowValue.at("Commission"));
data.CloseProfit = std::stod(rowValue.at("CloseProfit"));
data.PositionProfit = std::stod(rowValue.at("PositionProfit"));
data.PreSettlementPrice = std::stod(rowValue.at("PreSettlementPrice"));
data.SettlementPrice = std::stod(rowValue.at("SettlementPrice"));
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcDateType));
data.SettlementID = std::stoi(rowValue.at("SettlementID"));
data.OpenCost = std::stod(rowValue.at("OpenCost"));
data.ExchangeMargin = std::stod(rowValue.at("ExchangeMargin"));
data.CombPosition = std::stoi(rowValue.at("CombPosition"));
data.CombLongFrozen = std::stoi(rowValue.at("CombLongFrozen"));
data.CombShortFrozen = std::stoi(rowValue.at("CombShortFrozen"));
data.CloseProfitByDate = std::stod(rowValue.at("CloseProfitByDate"));
data.CloseProfitByTrade = std::stod(rowValue.at("CloseProfitByTrade"));
data.TodayPosition = std::stoi(rowValue.at("TodayPosition"));
data.MarginRateByMoney = std::stod(rowValue.at("MarginRateByMoney"));
data.MarginRateByVolume = std::stod(rowValue.at("MarginRateByVolume"));
data.StrikeFrozen = std::stoi(rowValue.at("StrikeFrozen"));
data.StrikeFrozenAmount = std::stod(rowValue.at("StrikeFrozenAmount"));
data.AbandonFrozen = std::stoi(rowValue.at("AbandonFrozen"));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
data.YdStrikeFrozen = std::stoi(rowValue.at("YdStrikeFrozen"));
strncpy(data.InvestUnitID, rowValue.at("InvestUnitID").c_str(), sizeof(TThostFtdcInvestUnitIDType));
data.PositionCostOffset = std::stod(rowValue.at("PositionCostOffset"));
data.TasPosition = std::stoi(rowValue.at("TasPosition"));
data.TasPositionCost = std::stod(rowValue.at("TasPositionCost"));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
data.OptionValue = std::stod(rowValue.at("OptionValue"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.reserve1 + "','" + data.BrokerID + "','" + data.InvestorID + "','" + (data.PosiDirection == 0 ? '0' : data.PosiDirection) + "','" + (data.HedgeFlag == 0 ? '0' : data.HedgeFlag) + "','" + (data.PositionDate == 0 ? '0' : data.PositionDate) + "','" + std::to_string(data.YdPosition) + "','" + std::to_string(data.Position) + "','" + std::to_string(data.LongFrozen) + "','" + std::to_string(data.ShortFrozen) + "','" + std::to_string(data.LongFrozenAmount) + "','" + std::to_string(data.ShortFrozenAmount) + "','" + std::to_string(data.OpenVolume) + "','" + std::to_string(data.CloseVolume) + "','" + std::to_string(data.OpenAmount) + "','" + std::to_string(data.CloseAmount) + "','" + std::to_string(data.PositionCost) + "','" + std::to_string(data.PreMargin) + "','" + std::to_string(data.UseMargin) + "','" + std::to_string(data.FrozenMargin) + "','" + std::to_string(data.FrozenCash) + "','" + std::to_string(data.FrozenCommission) + "','" + std::to_string(data.CashIn) + "','" + std::to_string(data.Commission) + "','" + std::to_string(data.CloseProfit) + "','" + std::to_string(data.PositionProfit) + "','" + std::to_string(data.PreSettlementPrice) + "','" + std::to_string(data.SettlementPrice) + "','" + data.TradingDay + "','" + std::to_string(data.SettlementID) + "','" + std::to_string(data.OpenCost) + "','" + std::to_string(data.ExchangeMargin) + "','" + std::to_string(data.CombPosition) + "','" + std::to_string(data.CombLongFrozen) + "','" + std::to_string(data.CombShortFrozen) + "','" + std::to_string(data.CloseProfitByDate) + "','" + std::to_string(data.CloseProfitByTrade) + "','" + std::to_string(data.TodayPosition) + "','" + std::to_string(data.MarginRateByMoney) + "','" + std::to_string(data.MarginRateByVolume) + "','" + std::to_string(data.StrikeFrozen) + "','" + std::to_string(data.StrikeFrozenAmount) + "','" + std::to_string(data.AbandonFrozen) + "','" + data.ExchangeID + "','" + std::to_string(data.YdStrikeFrozen) + "','" + data.InvestUnitID + "','" + std::to_string(data.PositionCostOffset) + "','" + std::to_string(data.TasPosition) + "','" + std::to_string(data.TasPositionCost) + "','" + data.InstrumentID + "','" + std::to_string(data.OptionValue)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcInvestorPositionField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcInstrumentMarginRateFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcInstrumentMarginRateField data;
CThostFtdcInstrumentMarginRateFieldWrapper(const CThostFtdcInstrumentMarginRateField& _data = { 0 }) :data(_data) { }
CThostFtdcInstrumentMarginRateFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcInstrumentMarginRateField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
data.InvestorRange = rowValue.at("InvestorRange").empty() ? '0' : rowValue.at("InvestorRange")[0];
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
data.HedgeFlag = rowValue.at("HedgeFlag").empty() ? '0' : rowValue.at("HedgeFlag")[0];
data.LongMarginRatioByMoney = std::stod(rowValue.at("LongMarginRatioByMoney"));
data.LongMarginRatioByVolume = std::stod(rowValue.at("LongMarginRatioByVolume"));
data.ShortMarginRatioByMoney = std::stod(rowValue.at("ShortMarginRatioByMoney"));
data.ShortMarginRatioByVolume = std::stod(rowValue.at("ShortMarginRatioByVolume"));
data.IsRelative = std::stoi(rowValue.at("IsRelative"));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.InvestUnitID, rowValue.at("InvestUnitID").c_str(), sizeof(TThostFtdcInvestUnitIDType));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.reserve1 + "','" + (data.InvestorRange == 0 ? '0' : data.InvestorRange) + "','" + data.BrokerID + "','" + data.InvestorID + "','" + (data.HedgeFlag == 0 ? '0' : data.HedgeFlag) + "','" + std::to_string(data.LongMarginRatioByMoney) + "','" + std::to_string(data.LongMarginRatioByVolume) + "','" + std::to_string(data.ShortMarginRatioByMoney) + "','" + std::to_string(data.ShortMarginRatioByVolume) + "','" + std::to_string(data.IsRelative) + "','" + data.ExchangeID + "','" + data.InvestUnitID + "','" + data.InstrumentID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcInstrumentMarginRateField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcInstrumentCommissionRateFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcInstrumentCommissionRateField data;
CThostFtdcInstrumentCommissionRateFieldWrapper(const CThostFtdcInstrumentCommissionRateField& _data = { 0 }) :data(_data) { }
CThostFtdcInstrumentCommissionRateFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcInstrumentCommissionRateField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
data.InvestorRange = rowValue.at("InvestorRange").empty() ? '0' : rowValue.at("InvestorRange")[0];
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
data.OpenRatioByMoney = std::stod(rowValue.at("OpenRatioByMoney"));
data.OpenRatioByVolume = std::stod(rowValue.at("OpenRatioByVolume"));
data.CloseRatioByMoney = std::stod(rowValue.at("CloseRatioByMoney"));
data.CloseRatioByVolume = std::stod(rowValue.at("CloseRatioByVolume"));
data.CloseTodayRatioByMoney = std::stod(rowValue.at("CloseTodayRatioByMoney"));
data.CloseTodayRatioByVolume = std::stod(rowValue.at("CloseTodayRatioByVolume"));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
data.BizType = rowValue.at("BizType").empty() ? '0' : rowValue.at("BizType")[0];
strncpy(data.InvestUnitID, rowValue.at("InvestUnitID").c_str(), sizeof(TThostFtdcInvestUnitIDType));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.reserve1 + "','" + (data.InvestorRange == 0 ? '0' : data.InvestorRange) + "','" + data.BrokerID + "','" + data.InvestorID + "','" + std::to_string(data.OpenRatioByMoney) + "','" + std::to_string(data.OpenRatioByVolume) + "','" + std::to_string(data.CloseRatioByMoney) + "','" + std::to_string(data.CloseRatioByVolume) + "','" + std::to_string(data.CloseTodayRatioByMoney) + "','" + std::to_string(data.CloseTodayRatioByVolume) + "','" + data.ExchangeID + "','" + (data.BizType == 0 ? '0' : data.BizType) + "','" + data.InvestUnitID + "','" + data.InstrumentID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcInstrumentCommissionRateField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcDepthMarketDataFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcDepthMarketDataField data;
CThostFtdcDepthMarketDataFieldWrapper(const CThostFtdcDepthMarketDataField& _data = { 0 }) :data(_data) { }
CThostFtdcDepthMarketDataFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcDepthMarketDataField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.reserve2, rowValue.at("reserve2").c_str(), sizeof(TThostFtdcOldExchangeInstIDType));
data.LastPrice = std::stod(rowValue.at("LastPrice"));
data.PreSettlementPrice = std::stod(rowValue.at("PreSettlementPrice"));
data.PreClosePrice = std::stod(rowValue.at("PreClosePrice"));
data.PreOpenInterest = std::stod(rowValue.at("PreOpenInterest"));
data.OpenPrice = std::stod(rowValue.at("OpenPrice"));
data.HighestPrice = std::stod(rowValue.at("HighestPrice"));
data.LowestPrice = std::stod(rowValue.at("LowestPrice"));
data.Volume = std::stoi(rowValue.at("Volume"));
data.Turnover = std::stod(rowValue.at("Turnover"));
data.OpenInterest = std::stod(rowValue.at("OpenInterest"));
data.ClosePrice = std::stod(rowValue.at("ClosePrice"));
data.SettlementPrice = std::stod(rowValue.at("SettlementPrice"));
data.UpperLimitPrice = std::stod(rowValue.at("UpperLimitPrice"));
data.LowerLimitPrice = std::stod(rowValue.at("LowerLimitPrice"));
data.PreDelta = std::stod(rowValue.at("PreDelta"));
data.CurrDelta = std::stod(rowValue.at("CurrDelta"));
strncpy(data.UpdateTime, rowValue.at("UpdateTime").c_str(), sizeof(TThostFtdcTimeType));
data.UpdateMillisec = std::stoi(rowValue.at("UpdateMillisec"));
data.BidPrice1 = std::stod(rowValue.at("BidPrice1"));
data.BidVolume1 = std::stoi(rowValue.at("BidVolume1"));
data.AskPrice1 = std::stod(rowValue.at("AskPrice1"));
data.AskVolume1 = std::stoi(rowValue.at("AskVolume1"));
data.BidPrice2 = std::stod(rowValue.at("BidPrice2"));
data.BidVolume2 = std::stoi(rowValue.at("BidVolume2"));
data.AskPrice2 = std::stod(rowValue.at("AskPrice2"));
data.AskVolume2 = std::stoi(rowValue.at("AskVolume2"));
data.BidPrice3 = std::stod(rowValue.at("BidPrice3"));
data.BidVolume3 = std::stoi(rowValue.at("BidVolume3"));
data.AskPrice3 = std::stod(rowValue.at("AskPrice3"));
data.AskVolume3 = std::stoi(rowValue.at("AskVolume3"));
data.BidPrice4 = std::stod(rowValue.at("BidPrice4"));
data.BidVolume4 = std::stoi(rowValue.at("BidVolume4"));
data.AskPrice4 = std::stod(rowValue.at("AskPrice4"));
data.AskVolume4 = std::stoi(rowValue.at("AskVolume4"));
data.BidPrice5 = std::stod(rowValue.at("BidPrice5"));
data.BidVolume5 = std::stoi(rowValue.at("BidVolume5"));
data.AskPrice5 = std::stod(rowValue.at("AskPrice5"));
data.AskVolume5 = std::stoi(rowValue.at("AskVolume5"));
data.AveragePrice = std::stod(rowValue.at("AveragePrice"));
strncpy(data.ActionDay, rowValue.at("ActionDay").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
strncpy(data.ExchangeInstID, rowValue.at("ExchangeInstID").c_str(), sizeof(TThostFtdcExchangeInstIDType));
data.BandingUpperPrice = std::stod(rowValue.at("BandingUpperPrice"));
data.BandingLowerPrice = std::stod(rowValue.at("BandingLowerPrice"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.TradingDay + "','" + data.reserve1 + "','" + data.ExchangeID + "','" + data.reserve2 + "','" + std::to_string(data.LastPrice) + "','" + std::to_string(data.PreSettlementPrice) + "','" + std::to_string(data.PreClosePrice) + "','" + std::to_string(data.PreOpenInterest) + "','" + std::to_string(data.OpenPrice) + "','" + std::to_string(data.HighestPrice) + "','" + std::to_string(data.LowestPrice) + "','" + std::to_string(data.Volume) + "','" + std::to_string(data.Turnover) + "','" + std::to_string(data.OpenInterest) + "','" + std::to_string(data.ClosePrice) + "','" + std::to_string(data.SettlementPrice) + "','" + std::to_string(data.UpperLimitPrice) + "','" + std::to_string(data.LowerLimitPrice) + "','" + std::to_string(data.PreDelta) + "','" + std::to_string(data.CurrDelta) + "','" + data.UpdateTime + "','" + std::to_string(data.UpdateMillisec) + "','" + std::to_string(data.BidPrice1) + "','" + std::to_string(data.BidVolume1) + "','" + std::to_string(data.AskPrice1) + "','" + std::to_string(data.AskVolume1) + "','" + std::to_string(data.BidPrice2) + "','" + std::to_string(data.BidVolume2) + "','" + std::to_string(data.AskPrice2) + "','" + std::to_string(data.AskVolume2) + "','" + std::to_string(data.BidPrice3) + "','" + std::to_string(data.BidVolume3) + "','" + std::to_string(data.AskPrice3) + "','" + std::to_string(data.AskVolume3) + "','" + std::to_string(data.BidPrice4) + "','" + std::to_string(data.BidVolume4) + "','" + std::to_string(data.AskPrice4) + "','" + std::to_string(data.AskVolume4) + "','" + std::to_string(data.BidPrice5) + "','" + std::to_string(data.BidVolume5) + "','" + std::to_string(data.AskPrice5) + "','" + std::to_string(data.AskVolume5) + "','" + std::to_string(data.AveragePrice) + "','" + data.ActionDay + "','" + data.InstrumentID + "','" + data.ExchangeInstID + "','" + std::to_string(data.BandingUpperPrice) + "','" + std::to_string(data.BandingLowerPrice)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcInstrumentTradingRightFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcInstrumentTradingRightField data;
CThostFtdcInstrumentTradingRightFieldWrapper(const CThostFtdcInstrumentTradingRightField& _data = { 0 }) :data(_data) { }
CThostFtdcInstrumentTradingRightFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcInstrumentTradingRightField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
data.InvestorRange = rowValue.at("InvestorRange").empty() ? '0' : rowValue.at("InvestorRange")[0];
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
data.TradingRight = rowValue.at("TradingRight").empty() ? '0' : rowValue.at("TradingRight")[0];
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.reserve1 + "','" + (data.InvestorRange == 0 ? '0' : data.InvestorRange) + "','" + data.BrokerID + "','" + data.InvestorID + "','" + (data.TradingRight == 0 ? '0' : data.TradingRight) + "','" + data.InstrumentID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcInstrumentTradingRightField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcBrokerUserFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcBrokerUserField data;
CThostFtdcBrokerUserFieldWrapper(const CThostFtdcBrokerUserField& _data = { 0 }) :data(_data) { }
CThostFtdcBrokerUserFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcBrokerUserField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
strncpy(data.UserName, rowValue.at("UserName").c_str(), sizeof(TThostFtdcUserNameType));
data.UserType = rowValue.at("UserType").empty() ? '0' : rowValue.at("UserType")[0];
data.IsActive = std::stoi(rowValue.at("IsActive"));
data.IsUsingOTP = std::stoi(rowValue.at("IsUsingOTP"));
data.IsAuthForce = std::stoi(rowValue.at("IsAuthForce"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.UserID + "','" + data.UserName + "','" + (data.UserType == 0 ? '0' : data.UserType) + "','" + std::to_string(data.IsActive) + "','" + std::to_string(data.IsUsingOTP) + "','" + std::to_string(data.IsAuthForce)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.UserID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& UserID) {
return "SELECT * FROM 'CThostFtdcBrokerUserField' where BrokerID='" + BrokerID + "' and UserID='" + UserID + "';";
}
};
struct CThostFtdcBrokerUserPasswordFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcBrokerUserPasswordField data;
CThostFtdcBrokerUserPasswordFieldWrapper(const CThostFtdcBrokerUserPasswordField& _data = { 0 }) :data(_data) { }
CThostFtdcBrokerUserPasswordFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcBrokerUserPasswordField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
strncpy(data.Password, rowValue.at("Password").c_str(), sizeof(TThostFtdcPasswordType));
strncpy(data.LastUpdateTime, rowValue.at("LastUpdateTime").c_str(), sizeof(TThostFtdcDateTimeType));
strncpy(data.LastLoginTime, rowValue.at("LastLoginTime").c_str(), sizeof(TThostFtdcDateTimeType));
strncpy(data.ExpireDate, rowValue.at("ExpireDate").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.WeakExpireDate, rowValue.at("WeakExpireDate").c_str(), sizeof(TThostFtdcDateType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.UserID + "','" + data.Password + "','" + data.LastUpdateTime + "','" + data.LastLoginTime + "','" + data.ExpireDate + "','" + data.WeakExpireDate
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.UserID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& UserID) {
return "SELECT * FROM 'CThostFtdcBrokerUserPasswordField' where BrokerID='" + BrokerID + "' and UserID='" + UserID + "';";
}
};
struct CThostFtdcBrokerUserFunctionFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcBrokerUserFunctionField data;
CThostFtdcBrokerUserFunctionFieldWrapper(const CThostFtdcBrokerUserFunctionField& _data = { 0 }) :data(_data) { }
CThostFtdcBrokerUserFunctionFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcBrokerUserFunctionField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
data.BrokerFunctionCode = rowValue.at("BrokerFunctionCode").empty() ? '0' : rowValue.at("BrokerFunctionCode")[0];
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.UserID + "','" + (data.BrokerFunctionCode == 0 ? '0' : data.BrokerFunctionCode)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.UserID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& UserID) {
return "SELECT * FROM 'CThostFtdcBrokerUserFunctionField' where BrokerID='" + BrokerID + "' and UserID='" + UserID + "';";
}
};
struct CThostFtdcTraderOfferFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcTraderOfferField data;
CThostFtdcTraderOfferFieldWrapper(const CThostFtdcTraderOfferField& _data = { 0 }) :data(_data) { }
CThostFtdcTraderOfferFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcTraderOfferField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.TraderID, rowValue.at("TraderID").c_str(), sizeof(TThostFtdcTraderIDType));
strncpy(data.ParticipantID, rowValue.at("ParticipantID").c_str(), sizeof(TThostFtdcParticipantIDType));
strncpy(data.Password, rowValue.at("Password").c_str(), sizeof(TThostFtdcPasswordType));
data.InstallID = std::stoi(rowValue.at("InstallID"));
strncpy(data.OrderLocalID, rowValue.at("OrderLocalID").c_str(), sizeof(TThostFtdcOrderLocalIDType));
data.TraderConnectStatus = rowValue.at("TraderConnectStatus").empty() ? '0' : rowValue.at("TraderConnectStatus")[0];
strncpy(data.ConnectRequestDate, rowValue.at("ConnectRequestDate").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.ConnectRequestTime, rowValue.at("ConnectRequestTime").c_str(), sizeof(TThostFtdcTimeType));
strncpy(data.LastReportDate, rowValue.at("LastReportDate").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.LastReportTime, rowValue.at("LastReportTime").c_str(), sizeof(TThostFtdcTimeType));
strncpy(data.ConnectDate, rowValue.at("ConnectDate").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.ConnectTime, rowValue.at("ConnectTime").c_str(), sizeof(TThostFtdcTimeType));
strncpy(data.StartDate, rowValue.at("StartDate").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.StartTime, rowValue.at("StartTime").c_str(), sizeof(TThostFtdcTimeType));
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.MaxTradeID, rowValue.at("MaxTradeID").c_str(), sizeof(TThostFtdcTradeIDType));
strncpy(data.MaxOrderMessageReference, rowValue.at("MaxOrderMessageReference").c_str(), sizeof(TThostFtdcReturnCodeType));
data.OrderCancelAlg = rowValue.at("OrderCancelAlg").empty() ? '0' : rowValue.at("OrderCancelAlg")[0];
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.ExchangeID + "','" + data.TraderID + "','" + data.ParticipantID + "','" + data.Password + "','" + std::to_string(data.InstallID) + "','" + data.OrderLocalID + "','" + (data.TraderConnectStatus == 0 ? '0' : data.TraderConnectStatus) + "','" + data.ConnectRequestDate + "','" + data.ConnectRequestTime + "','" + data.LastReportDate + "','" + data.LastReportTime + "','" + data.ConnectDate + "','" + data.ConnectTime + "','" + data.StartDate + "','" + data.StartTime + "','" + data.TradingDay + "','" + data.BrokerID + "','" + data.MaxTradeID + "','" + data.MaxOrderMessageReference + "','" + (data.OrderCancelAlg == 0 ? '0' : data.OrderCancelAlg)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcSettlementInfoFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcSettlementInfoField data;
CThostFtdcSettlementInfoFieldWrapper(const CThostFtdcSettlementInfoField& _data = { 0 }) :data(_data) { }
CThostFtdcSettlementInfoFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcSettlementInfoField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcDateType));
data.SettlementID = std::stoi(rowValue.at("SettlementID"));
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
data.SequenceNo = std::stoi(rowValue.at("SequenceNo"));
strncpy(data.Content, rowValue.at("Content").c_str(), sizeof(TThostFtdcContentType));
strncpy(data.AccountID, rowValue.at("AccountID").c_str(), sizeof(TThostFtdcAccountIDType));
strncpy(data.CurrencyID, rowValue.at("CurrencyID").c_str(), sizeof(TThostFtdcCurrencyIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.TradingDay + "','" + std::to_string(data.SettlementID) + "','" + data.BrokerID + "','" + data.InvestorID + "','" + std::to_string(data.SequenceNo) + "','" + data.Content + "','" + data.AccountID + "','" + data.CurrencyID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcSettlementInfoField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcInstrumentMarginRateAdjustFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcInstrumentMarginRateAdjustField data;
CThostFtdcInstrumentMarginRateAdjustFieldWrapper(const CThostFtdcInstrumentMarginRateAdjustField& _data = { 0 }) :data(_data) { }
CThostFtdcInstrumentMarginRateAdjustFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcInstrumentMarginRateAdjustField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
data.InvestorRange = rowValue.at("InvestorRange").empty() ? '0' : rowValue.at("InvestorRange")[0];
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
data.HedgeFlag = rowValue.at("HedgeFlag").empty() ? '0' : rowValue.at("HedgeFlag")[0];
data.LongMarginRatioByMoney = std::stod(rowValue.at("LongMarginRatioByMoney"));
data.LongMarginRatioByVolume = std::stod(rowValue.at("LongMarginRatioByVolume"));
data.ShortMarginRatioByMoney = std::stod(rowValue.at("ShortMarginRatioByMoney"));
data.ShortMarginRatioByVolume = std::stod(rowValue.at("ShortMarginRatioByVolume"));
data.IsRelative = std::stoi(rowValue.at("IsRelative"));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.reserve1 + "','" + (data.InvestorRange == 0 ? '0' : data.InvestorRange) + "','" + data.BrokerID + "','" + data.InvestorID + "','" + (data.HedgeFlag == 0 ? '0' : data.HedgeFlag) + "','" + std::to_string(data.LongMarginRatioByMoney) + "','" + std::to_string(data.LongMarginRatioByVolume) + "','" + std::to_string(data.ShortMarginRatioByMoney) + "','" + std::to_string(data.ShortMarginRatioByVolume) + "','" + std::to_string(data.IsRelative) + "','" + data.InstrumentID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcInstrumentMarginRateAdjustField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcExchangeMarginRateFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcExchangeMarginRateField data;
CThostFtdcExchangeMarginRateFieldWrapper(const CThostFtdcExchangeMarginRateField& _data = { 0 }) :data(_data) { }
CThostFtdcExchangeMarginRateFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcExchangeMarginRateField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
data.HedgeFlag = rowValue.at("HedgeFlag").empty() ? '0' : rowValue.at("HedgeFlag")[0];
data.LongMarginRatioByMoney = std::stod(rowValue.at("LongMarginRatioByMoney"));
data.LongMarginRatioByVolume = std::stod(rowValue.at("LongMarginRatioByVolume"));
data.ShortMarginRatioByMoney = std::stod(rowValue.at("ShortMarginRatioByMoney"));
data.ShortMarginRatioByVolume = std::stod(rowValue.at("ShortMarginRatioByVolume"));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.reserve1 + "','" + (data.HedgeFlag == 0 ? '0' : data.HedgeFlag) + "','" + std::to_string(data.LongMarginRatioByMoney) + "','" + std::to_string(data.LongMarginRatioByVolume) + "','" + std::to_string(data.ShortMarginRatioByMoney) + "','" + std::to_string(data.ShortMarginRatioByVolume) + "','" + data.ExchangeID + "','" + data.InstrumentID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcExchangeMarginRateAdjustFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcExchangeMarginRateAdjustField data;
CThostFtdcExchangeMarginRateAdjustFieldWrapper(const CThostFtdcExchangeMarginRateAdjustField& _data = { 0 }) :data(_data) { }
CThostFtdcExchangeMarginRateAdjustFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcExchangeMarginRateAdjustField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
data.HedgeFlag = rowValue.at("HedgeFlag").empty() ? '0' : rowValue.at("HedgeFlag")[0];
data.LongMarginRatioByMoney = std::stod(rowValue.at("LongMarginRatioByMoney"));
data.LongMarginRatioByVolume = std::stod(rowValue.at("LongMarginRatioByVolume"));
data.ShortMarginRatioByMoney = std::stod(rowValue.at("ShortMarginRatioByMoney"));
data.ShortMarginRatioByVolume = std::stod(rowValue.at("ShortMarginRatioByVolume"));
data.ExchLongMarginRatioByMoney = std::stod(rowValue.at("ExchLongMarginRatioByMoney"));
data.ExchLongMarginRatioByVolume = std::stod(rowValue.at("ExchLongMarginRatioByVolume"));
data.ExchShortMarginRatioByMoney = std::stod(rowValue.at("ExchShortMarginRatioByMoney"));
data.ExchShortMarginRatioByVolume = std::stod(rowValue.at("ExchShortMarginRatioByVolume"));
data.NoLongMarginRatioByMoney = std::stod(rowValue.at("NoLongMarginRatioByMoney"));
data.NoLongMarginRatioByVolume = std::stod(rowValue.at("NoLongMarginRatioByVolume"));
data.NoShortMarginRatioByMoney = std::stod(rowValue.at("NoShortMarginRatioByMoney"));
data.NoShortMarginRatioByVolume = std::stod(rowValue.at("NoShortMarginRatioByVolume"));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.reserve1 + "','" + (data.HedgeFlag == 0 ? '0' : data.HedgeFlag) + "','" + std::to_string(data.LongMarginRatioByMoney) + "','" + std::to_string(data.LongMarginRatioByVolume) + "','" + std::to_string(data.ShortMarginRatioByMoney) + "','" + std::to_string(data.ShortMarginRatioByVolume) + "','" + std::to_string(data.ExchLongMarginRatioByMoney) + "','" + std::to_string(data.ExchLongMarginRatioByVolume) + "','" + std::to_string(data.ExchShortMarginRatioByMoney) + "','" + std::to_string(data.ExchShortMarginRatioByVolume) + "','" + std::to_string(data.NoLongMarginRatioByMoney) + "','" + std::to_string(data.NoLongMarginRatioByVolume) + "','" + std::to_string(data.NoShortMarginRatioByMoney) + "','" + std::to_string(data.NoShortMarginRatioByVolume) + "','" + data.InstrumentID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcExchangeRateFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcExchangeRateField data;
CThostFtdcExchangeRateFieldWrapper(const CThostFtdcExchangeRateField& _data = { 0 }) :data(_data) { }
CThostFtdcExchangeRateFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcExchangeRateField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.FromCurrencyID, rowValue.at("FromCurrencyID").c_str(), sizeof(TThostFtdcCurrencyIDType));
data.FromCurrencyUnit = std::stod(rowValue.at("FromCurrencyUnit"));
strncpy(data.ToCurrencyID, rowValue.at("ToCurrencyID").c_str(), sizeof(TThostFtdcCurrencyIDType));
data.ExchangeRate = std::stod(rowValue.at("ExchangeRate"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.FromCurrencyID + "','" + std::to_string(data.FromCurrencyUnit) + "','" + data.ToCurrencyID + "','" + std::to_string(data.ExchangeRate)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcSettlementRefFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcSettlementRefField data;
CThostFtdcSettlementRefFieldWrapper(const CThostFtdcSettlementRefField& _data = { 0 }) :data(_data) { }
CThostFtdcSettlementRefFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcSettlementRefField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcDateType));
data.SettlementID = std::stoi(rowValue.at("SettlementID"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.TradingDay + "','" + std::to_string(data.SettlementID)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcCurrentTimeFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcCurrentTimeField data;
CThostFtdcCurrentTimeFieldWrapper(const CThostFtdcCurrentTimeField& _data = { 0 }) :data(_data) { }
CThostFtdcCurrentTimeFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcCurrentTimeField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.CurrDate, rowValue.at("CurrDate").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.CurrTime, rowValue.at("CurrTime").c_str(), sizeof(TThostFtdcTimeType));
data.CurrMillisec = std::stoi(rowValue.at("CurrMillisec"));
strncpy(data.ActionDay, rowValue.at("ActionDay").c_str(), sizeof(TThostFtdcDateType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.CurrDate + "','" + data.CurrTime + "','" + std::to_string(data.CurrMillisec) + "','" + data.ActionDay
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcCommPhaseFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcCommPhaseField data;
CThostFtdcCommPhaseFieldWrapper(const CThostFtdcCommPhaseField& _data = { 0 }) :data(_data) { }
CThostFtdcCommPhaseFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcCommPhaseField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcDateType));
data.CommPhaseNo = std::stoi(rowValue.at("CommPhaseNo"));
strncpy(data.SystemID, rowValue.at("SystemID").c_str(), sizeof(TThostFtdcSystemIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.TradingDay + "','" + std::to_string(data.CommPhaseNo) + "','" + data.SystemID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcLoginInfoFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcLoginInfoField data;
CThostFtdcLoginInfoFieldWrapper(const CThostFtdcLoginInfoField& _data = { 0 }) :data(_data) { }
CThostFtdcLoginInfoFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcLoginInfoField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
data.FrontID = std::stoi(rowValue.at("FrontID"));
data.SessionID = std::stoi(rowValue.at("SessionID"));
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
strncpy(data.LoginDate, rowValue.at("LoginDate").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.LoginTime, rowValue.at("LoginTime").c_str(), sizeof(TThostFtdcTimeType));
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldIPAddressType));
strncpy(data.UserProductInfo, rowValue.at("UserProductInfo").c_str(), sizeof(TThostFtdcProductInfoType));
strncpy(data.InterfaceProductInfo, rowValue.at("InterfaceProductInfo").c_str(), sizeof(TThostFtdcProductInfoType));
strncpy(data.ProtocolInfo, rowValue.at("ProtocolInfo").c_str(), sizeof(TThostFtdcProtocolInfoType));
strncpy(data.SystemName, rowValue.at("SystemName").c_str(), sizeof(TThostFtdcSystemNameType));
strncpy(data.PasswordDeprecated, rowValue.at("PasswordDeprecated").c_str(), sizeof(TThostFtdcPasswordType));
strncpy(data.MaxOrderRef, rowValue.at("MaxOrderRef").c_str(), sizeof(TThostFtdcOrderRefType));
strncpy(data.SHFETime, rowValue.at("SHFETime").c_str(), sizeof(TThostFtdcTimeType));
strncpy(data.DCETime, rowValue.at("DCETime").c_str(), sizeof(TThostFtdcTimeType));
strncpy(data.CZCETime, rowValue.at("CZCETime").c_str(), sizeof(TThostFtdcTimeType));
strncpy(data.FFEXTime, rowValue.at("FFEXTime").c_str(), sizeof(TThostFtdcTimeType));
strncpy(data.MacAddress, rowValue.at("MacAddress").c_str(), sizeof(TThostFtdcMacAddressType));
strncpy(data.OneTimePassword, rowValue.at("OneTimePassword").c_str(), sizeof(TThostFtdcPasswordType));
strncpy(data.INETime, rowValue.at("INETime").c_str(), sizeof(TThostFtdcTimeType));
data.IsQryControl = std::stoi(rowValue.at("IsQryControl"));
strncpy(data.LoginRemark, rowValue.at("LoginRemark").c_str(), sizeof(TThostFtdcLoginRemarkType));
strncpy(data.Password, rowValue.at("Password").c_str(), sizeof(TThostFtdcPasswordType));
strncpy(data.IPAddress, rowValue.at("IPAddress").c_str(), sizeof(TThostFtdcIPAddressType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
std::to_string(data.FrontID) + "','" + std::to_string(data.SessionID) + "','" + data.BrokerID + "','" + data.UserID + "','" + data.LoginDate + "','" + data.LoginTime + "','" + data.reserve1 + "','" + data.UserProductInfo + "','" + data.InterfaceProductInfo + "','" + data.ProtocolInfo + "','" + data.SystemName + "','" + data.PasswordDeprecated + "','" + data.MaxOrderRef + "','" + data.SHFETime + "','" + data.DCETime + "','" + data.CZCETime + "','" + data.FFEXTime + "','" + data.MacAddress + "','" + data.OneTimePassword + "','" + data.INETime + "','" + std::to_string(data.IsQryControl) + "','" + data.LoginRemark + "','" + data.Password + "','" + data.IPAddress
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.UserID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& UserID) {
return "SELECT * FROM 'CThostFtdcLoginInfoField' where BrokerID='" + BrokerID + "' and UserID='" + UserID + "';";
}
};
struct CThostFtdcLogoutAllFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcLogoutAllField data;
CThostFtdcLogoutAllFieldWrapper(const CThostFtdcLogoutAllField& _data = { 0 }) :data(_data) { }
CThostFtdcLogoutAllFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcLogoutAllField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
data.FrontID = std::stoi(rowValue.at("FrontID"));
data.SessionID = std::stoi(rowValue.at("SessionID"));
strncpy(data.SystemName, rowValue.at("SystemName").c_str(), sizeof(TThostFtdcSystemNameType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
std::to_string(data.FrontID) + "','" + std::to_string(data.SessionID) + "','" + data.SystemName
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcFrontStatusFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcFrontStatusField data;
CThostFtdcFrontStatusFieldWrapper(const CThostFtdcFrontStatusField& _data = { 0 }) :data(_data) { }
CThostFtdcFrontStatusFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcFrontStatusField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
data.FrontID = std::stoi(rowValue.at("FrontID"));
strncpy(data.LastReportDate, rowValue.at("LastReportDate").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.LastReportTime, rowValue.at("LastReportTime").c_str(), sizeof(TThostFtdcTimeType));
data.IsActive = std::stoi(rowValue.at("IsActive"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
std::to_string(data.FrontID) + "','" + data.LastReportDate + "','" + data.LastReportTime + "','" + std::to_string(data.IsActive)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcUserPasswordUpdateFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcUserPasswordUpdateField data;
CThostFtdcUserPasswordUpdateFieldWrapper(const CThostFtdcUserPasswordUpdateField& _data = { 0 }) :data(_data) { }
CThostFtdcUserPasswordUpdateFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcUserPasswordUpdateField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
strncpy(data.OldPassword, rowValue.at("OldPassword").c_str(), sizeof(TThostFtdcPasswordType));
strncpy(data.NewPassword, rowValue.at("NewPassword").c_str(), sizeof(TThostFtdcPasswordType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.UserID + "','" + data.OldPassword + "','" + data.NewPassword
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.UserID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& UserID) {
return "SELECT * FROM 'CThostFtdcUserPasswordUpdateField' where BrokerID='" + BrokerID + "' and UserID='" + UserID + "';";
}
};
struct CThostFtdcInputOrderFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcInputOrderField data;
CThostFtdcInputOrderFieldWrapper(const CThostFtdcInputOrderField& _data = { 0 }) :data(_data) { }
CThostFtdcInputOrderFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcInputOrderField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
strncpy(data.OrderRef, rowValue.at("OrderRef").c_str(), sizeof(TThostFtdcOrderRefType));
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
data.OrderPriceType = rowValue.at("OrderPriceType").empty() ? '0' : rowValue.at("OrderPriceType")[0];
data.Direction = rowValue.at("Direction").empty() ? '0' : rowValue.at("Direction")[0];
strncpy(data.CombOffsetFlag, rowValue.at("CombOffsetFlag").c_str(), sizeof(TThostFtdcCombOffsetFlagType));
strncpy(data.CombHedgeFlag, rowValue.at("CombHedgeFlag").c_str(), sizeof(TThostFtdcCombHedgeFlagType));
data.LimitPrice = std::stod(rowValue.at("LimitPrice"));
data.VolumeTotalOriginal = std::stoi(rowValue.at("VolumeTotalOriginal"));
data.TimeCondition = rowValue.at("TimeCondition").empty() ? '0' : rowValue.at("TimeCondition")[0];
strncpy(data.GTDDate, rowValue.at("GTDDate").c_str(), sizeof(TThostFtdcDateType));
data.VolumeCondition = rowValue.at("VolumeCondition").empty() ? '0' : rowValue.at("VolumeCondition")[0];
data.MinVolume = std::stoi(rowValue.at("MinVolume"));
data.ContingentCondition = rowValue.at("ContingentCondition").empty() ? '0' : rowValue.at("ContingentCondition")[0];
data.StopPrice = std::stod(rowValue.at("StopPrice"));
data.ForceCloseReason = rowValue.at("ForceCloseReason").empty() ? '0' : rowValue.at("ForceCloseReason")[0];
data.IsAutoSuspend = std::stoi(rowValue.at("IsAutoSuspend"));
strncpy(data.BusinessUnit, rowValue.at("BusinessUnit").c_str(), sizeof(TThostFtdcBusinessUnitType));
data.RequestID = std::stoi(rowValue.at("RequestID"));
data.UserForceClose = std::stoi(rowValue.at("UserForceClose"));
data.IsSwapOrder = std::stoi(rowValue.at("IsSwapOrder"));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.InvestUnitID, rowValue.at("InvestUnitID").c_str(), sizeof(TThostFtdcInvestUnitIDType));
strncpy(data.AccountID, rowValue.at("AccountID").c_str(), sizeof(TThostFtdcAccountIDType));
strncpy(data.CurrencyID, rowValue.at("CurrencyID").c_str(), sizeof(TThostFtdcCurrencyIDType));
strncpy(data.ClientID, rowValue.at("ClientID").c_str(), sizeof(TThostFtdcClientIDType));
strncpy(data.reserve2, rowValue.at("reserve2").c_str(), sizeof(TThostFtdcOldIPAddressType));
strncpy(data.MacAddress, rowValue.at("MacAddress").c_str(), sizeof(TThostFtdcMacAddressType));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
strncpy(data.IPAddress, rowValue.at("IPAddress").c_str(), sizeof(TThostFtdcIPAddressType));
strncpy(data.OrderMemo, rowValue.at("OrderMemo").c_str(), sizeof(TThostFtdcOrderMemoType));
data.SessionReqSeq = std::stoi(rowValue.at("SessionReqSeq"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorID + "','" + data.reserve1 + "','" + data.OrderRef + "','" + data.UserID + "','" + (data.OrderPriceType == 0 ? '0' : data.OrderPriceType) + "','" + (data.Direction == 0 ? '0' : data.Direction) + "','" + data.CombOffsetFlag + "','" + data.CombHedgeFlag + "','" + std::to_string(data.LimitPrice) + "','" + std::to_string(data.VolumeTotalOriginal) + "','" + (data.TimeCondition == 0 ? '0' : data.TimeCondition) + "','" + data.GTDDate + "','" + (data.VolumeCondition == 0 ? '0' : data.VolumeCondition) + "','" + std::to_string(data.MinVolume) + "','" + (data.ContingentCondition == 0 ? '0' : data.ContingentCondition) + "','" + std::to_string(data.StopPrice) + "','" + (data.ForceCloseReason == 0 ? '0' : data.ForceCloseReason) + "','" + std::to_string(data.IsAutoSuspend) + "','" + data.BusinessUnit + "','" + std::to_string(data.RequestID) + "','" + std::to_string(data.UserForceClose) + "','" + std::to_string(data.IsSwapOrder) + "','" + data.ExchangeID + "','" + data.InvestUnitID + "','" + data.AccountID + "','" + data.CurrencyID + "','" + data.ClientID + "','" + data.reserve2 + "','" + data.MacAddress + "','" + data.InstrumentID + "','" + data.IPAddress + "','" + data.OrderMemo + "','" + std::to_string(data.SessionReqSeq)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcInputOrderField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcOrderFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcOrderField data;
CThostFtdcOrderFieldWrapper(const CThostFtdcOrderField& _data = { 0 }) :data(_data) { }
CThostFtdcOrderFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcOrderField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
strncpy(data.OrderRef, rowValue.at("OrderRef").c_str(), sizeof(TThostFtdcOrderRefType));
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
data.OrderPriceType = rowValue.at("OrderPriceType").empty() ? '0' : rowValue.at("OrderPriceType")[0];
data.Direction = rowValue.at("Direction").empty() ? '0' : rowValue.at("Direction")[0];
strncpy(data.CombOffsetFlag, rowValue.at("CombOffsetFlag").c_str(), sizeof(TThostFtdcCombOffsetFlagType));
strncpy(data.CombHedgeFlag, rowValue.at("CombHedgeFlag").c_str(), sizeof(TThostFtdcCombHedgeFlagType));
data.LimitPrice = std::stod(rowValue.at("LimitPrice"));
data.VolumeTotalOriginal = std::stoi(rowValue.at("VolumeTotalOriginal"));
data.TimeCondition = rowValue.at("TimeCondition").empty() ? '0' : rowValue.at("TimeCondition")[0];
strncpy(data.GTDDate, rowValue.at("GTDDate").c_str(), sizeof(TThostFtdcDateType));
data.VolumeCondition = rowValue.at("VolumeCondition").empty() ? '0' : rowValue.at("VolumeCondition")[0];
data.MinVolume = std::stoi(rowValue.at("MinVolume"));
data.ContingentCondition = rowValue.at("ContingentCondition").empty() ? '0' : rowValue.at("ContingentCondition")[0];
data.StopPrice = std::stod(rowValue.at("StopPrice"));
data.ForceCloseReason = rowValue.at("ForceCloseReason").empty() ? '0' : rowValue.at("ForceCloseReason")[0];
data.IsAutoSuspend = std::stoi(rowValue.at("IsAutoSuspend"));
strncpy(data.BusinessUnit, rowValue.at("BusinessUnit").c_str(), sizeof(TThostFtdcBusinessUnitType));
data.RequestID = std::stoi(rowValue.at("RequestID"));
strncpy(data.OrderLocalID, rowValue.at("OrderLocalID").c_str(), sizeof(TThostFtdcOrderLocalIDType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.ParticipantID, rowValue.at("ParticipantID").c_str(), sizeof(TThostFtdcParticipantIDType));
strncpy(data.ClientID, rowValue.at("ClientID").c_str(), sizeof(TThostFtdcClientIDType));
strncpy(data.reserve2, rowValue.at("reserve2").c_str(), sizeof(TThostFtdcOldExchangeInstIDType));
strncpy(data.TraderID, rowValue.at("TraderID").c_str(), sizeof(TThostFtdcTraderIDType));
data.InstallID = std::stoi(rowValue.at("InstallID"));
data.OrderSubmitStatus = rowValue.at("OrderSubmitStatus").empty() ? '0' : rowValue.at("OrderSubmitStatus")[0];
data.NotifySequence = std::stoi(rowValue.at("NotifySequence"));
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcDateType));
data.SettlementID = std::stoi(rowValue.at("SettlementID"));
strncpy(data.OrderSysID, rowValue.at("OrderSysID").c_str(), sizeof(TThostFtdcOrderSysIDType));
data.OrderSource = rowValue.at("OrderSource").empty() ? '0' : rowValue.at("OrderSource")[0];
data.OrderStatus = rowValue.at("OrderStatus").empty() ? '0' : rowValue.at("OrderStatus")[0];
data.OrderType = rowValue.at("OrderType").empty() ? '0' : rowValue.at("OrderType")[0];
data.VolumeTraded = std::stoi(rowValue.at("VolumeTraded"));
data.VolumeTotal = std::stoi(rowValue.at("VolumeTotal"));
strncpy(data.InsertDate, rowValue.at("InsertDate").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.InsertTime, rowValue.at("InsertTime").c_str(), sizeof(TThostFtdcTimeType));
strncpy(data.ActiveTime, rowValue.at("ActiveTime").c_str(), sizeof(TThostFtdcTimeType));
strncpy(data.SuspendTime, rowValue.at("SuspendTime").c_str(), sizeof(TThostFtdcTimeType));
strncpy(data.UpdateTime, rowValue.at("UpdateTime").c_str(), sizeof(TThostFtdcTimeType));
strncpy(data.CancelTime, rowValue.at("CancelTime").c_str(), sizeof(TThostFtdcTimeType));
strncpy(data.ActiveTraderID, rowValue.at("ActiveTraderID").c_str(), sizeof(TThostFtdcTraderIDType));
strncpy(data.ClearingPartID, rowValue.at("ClearingPartID").c_str(), sizeof(TThostFtdcParticipantIDType));
data.SequenceNo = std::stoi(rowValue.at("SequenceNo"));
data.FrontID = std::stoi(rowValue.at("FrontID"));
data.SessionID = std::stoi(rowValue.at("SessionID"));
strncpy(data.UserProductInfo, rowValue.at("UserProductInfo").c_str(), sizeof(TThostFtdcProductInfoType));
strncpy(data.StatusMsg, utf8_to_gbk(rowValue.at("StatusMsg")).c_str(), sizeof(TThostFtdcErrorMsgType));
data.UserForceClose = std::stoi(rowValue.at("UserForceClose"));
strncpy(data.ActiveUserID, rowValue.at("ActiveUserID").c_str(), sizeof(TThostFtdcUserIDType));
data.BrokerOrderSeq = std::stoi(rowValue.at("BrokerOrderSeq"));
strncpy(data.RelativeOrderSysID, rowValue.at("RelativeOrderSysID").c_str(), sizeof(TThostFtdcOrderSysIDType));
data.ZCETotalTradedVolume = std::stoi(rowValue.at("ZCETotalTradedVolume"));
data.IsSwapOrder = std::stoi(rowValue.at("IsSwapOrder"));
strncpy(data.BranchID, rowValue.at("BranchID").c_str(), sizeof(TThostFtdcBranchIDType));
strncpy(data.InvestUnitID, rowValue.at("InvestUnitID").c_str(), sizeof(TThostFtdcInvestUnitIDType));
strncpy(data.AccountID, rowValue.at("AccountID").c_str(), sizeof(TThostFtdcAccountIDType));
strncpy(data.CurrencyID, rowValue.at("CurrencyID").c_str(), sizeof(TThostFtdcCurrencyIDType));
strncpy(data.reserve3, rowValue.at("reserve3").c_str(), sizeof(TThostFtdcOldIPAddressType));
strncpy(data.MacAddress, rowValue.at("MacAddress").c_str(), sizeof(TThostFtdcMacAddressType));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
strncpy(data.ExchangeInstID, rowValue.at("ExchangeInstID").c_str(), sizeof(TThostFtdcExchangeInstIDType));
strncpy(data.IPAddress, rowValue.at("IPAddress").c_str(), sizeof(TThostFtdcIPAddressType));
strncpy(data.OrderMemo, rowValue.at("OrderMemo").c_str(), sizeof(TThostFtdcOrderMemoType));
data.SessionReqSeq = std::stoi(rowValue.at("SessionReqSeq"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorID + "','" + data.reserve1 + "','" + data.OrderRef + "','" + data.UserID + "','" + (data.OrderPriceType == 0 ? '0' : data.OrderPriceType) + "','" + (data.Direction == 0 ? '0' : data.Direction) + "','" + data.CombOffsetFlag + "','" + data.CombHedgeFlag + "','" + std::to_string(data.LimitPrice) + "','" + std::to_string(data.VolumeTotalOriginal) + "','" + (data.TimeCondition == 0 ? '0' : data.TimeCondition) + "','" + data.GTDDate + "','" + (data.VolumeCondition == 0 ? '0' : data.VolumeCondition) + "','" + std::to_string(data.MinVolume) + "','" + (data.ContingentCondition == 0 ? '0' : data.ContingentCondition) + "','" + std::to_string(data.StopPrice) + "','" + (data.ForceCloseReason == 0 ? '0' : data.ForceCloseReason) + "','" + std::to_string(data.IsAutoSuspend) + "','" + data.BusinessUnit + "','" + std::to_string(data.RequestID) + "','" + data.OrderLocalID + "','" + data.ExchangeID + "','" + data.ParticipantID + "','" + data.ClientID + "','" + data.reserve2 + "','" + data.TraderID + "','" + std::to_string(data.InstallID) + "','" + (data.OrderSubmitStatus == 0 ? '0' : data.OrderSubmitStatus) + "','" + std::to_string(data.NotifySequence) + "','" + data.TradingDay + "','" + std::to_string(data.SettlementID) + "','" + data.OrderSysID + "','" + (data.OrderSource == 0 ? '0' : data.OrderSource) + "','" + (data.OrderStatus == 0 ? '0' : data.OrderStatus) + "','" + (data.OrderType == 0 ? '0' : data.OrderType) + "','" + std::to_string(data.VolumeTraded) + "','" + std::to_string(data.VolumeTotal) + "','" + data.InsertDate + "','" + data.InsertTime + "','" + data.ActiveTime + "','" + data.SuspendTime + "','" + data.UpdateTime + "','" + data.CancelTime + "','" + data.ActiveTraderID + "','" + data.ClearingPartID + "','" + std::to_string(data.SequenceNo) + "','" + std::to_string(data.FrontID) + "','" + std::to_string(data.SessionID) + "','" + data.UserProductInfo + "','" + gbk_to_utf8(data.StatusMsg) + "','" + std::to_string(data.UserForceClose) + "','" + data.ActiveUserID + "','" + std::to_string(data.BrokerOrderSeq) + "','" + data.RelativeOrderSysID + "','" + std::to_string(data.ZCETotalTradedVolume) + "','" + std::to_string(data.IsSwapOrder) + "','" + data.BranchID + "','" + data.InvestUnitID + "','" + data.AccountID + "','" + data.CurrencyID + "','" + data.reserve3 + "','" + data.MacAddress + "','" + data.InstrumentID + "','" + data.ExchangeInstID + "','" + data.IPAddress + "','" + data.OrderMemo + "','" + std::to_string(data.SessionReqSeq)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcOrderField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcExchangeOrderFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcExchangeOrderField data;
CThostFtdcExchangeOrderFieldWrapper(const CThostFtdcExchangeOrderField& _data = { 0 }) :data(_data) { }
CThostFtdcExchangeOrderFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcExchangeOrderField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
data.OrderPriceType = rowValue.at("OrderPriceType").empty() ? '0' : rowValue.at("OrderPriceType")[0];
data.Direction = rowValue.at("Direction").empty() ? '0' : rowValue.at("Direction")[0];
strncpy(data.CombOffsetFlag, rowValue.at("CombOffsetFlag").c_str(), sizeof(TThostFtdcCombOffsetFlagType));
strncpy(data.CombHedgeFlag, rowValue.at("CombHedgeFlag").c_str(), sizeof(TThostFtdcCombHedgeFlagType));
data.LimitPrice = std::stod(rowValue.at("LimitPrice"));
data.VolumeTotalOriginal = std::stoi(rowValue.at("VolumeTotalOriginal"));
data.TimeCondition = rowValue.at("TimeCondition").empty() ? '0' : rowValue.at("TimeCondition")[0];
strncpy(data.GTDDate, rowValue.at("GTDDate").c_str(), sizeof(TThostFtdcDateType));
data.VolumeCondition = rowValue.at("VolumeCondition").empty() ? '0' : rowValue.at("VolumeCondition")[0];
data.MinVolume = std::stoi(rowValue.at("MinVolume"));
data.ContingentCondition = rowValue.at("ContingentCondition").empty() ? '0' : rowValue.at("ContingentCondition")[0];
data.StopPrice = std::stod(rowValue.at("StopPrice"));
data.ForceCloseReason = rowValue.at("ForceCloseReason").empty() ? '0' : rowValue.at("ForceCloseReason")[0];
data.IsAutoSuspend = std::stoi(rowValue.at("IsAutoSuspend"));
strncpy(data.BusinessUnit, rowValue.at("BusinessUnit").c_str(), sizeof(TThostFtdcBusinessUnitType));
data.RequestID = std::stoi(rowValue.at("RequestID"));
strncpy(data.OrderLocalID, rowValue.at("OrderLocalID").c_str(), sizeof(TThostFtdcOrderLocalIDType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.ParticipantID, rowValue.at("ParticipantID").c_str(), sizeof(TThostFtdcParticipantIDType));
strncpy(data.ClientID, rowValue.at("ClientID").c_str(), sizeof(TThostFtdcClientIDType));
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldExchangeInstIDType));
strncpy(data.TraderID, rowValue.at("TraderID").c_str(), sizeof(TThostFtdcTraderIDType));
data.InstallID = std::stoi(rowValue.at("InstallID"));
data.OrderSubmitStatus = rowValue.at("OrderSubmitStatus").empty() ? '0' : rowValue.at("OrderSubmitStatus")[0];
data.NotifySequence = std::stoi(rowValue.at("NotifySequence"));
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcDateType));
data.SettlementID = std::stoi(rowValue.at("SettlementID"));
strncpy(data.OrderSysID, rowValue.at("OrderSysID").c_str(), sizeof(TThostFtdcOrderSysIDType));
data.OrderSource = rowValue.at("OrderSource").empty() ? '0' : rowValue.at("OrderSource")[0];
data.OrderStatus = rowValue.at("OrderStatus").empty() ? '0' : rowValue.at("OrderStatus")[0];
data.OrderType = rowValue.at("OrderType").empty() ? '0' : rowValue.at("OrderType")[0];
data.VolumeTraded = std::stoi(rowValue.at("VolumeTraded"));
data.VolumeTotal = std::stoi(rowValue.at("VolumeTotal"));
strncpy(data.InsertDate, rowValue.at("InsertDate").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.InsertTime, rowValue.at("InsertTime").c_str(), sizeof(TThostFtdcTimeType));
strncpy(data.ActiveTime, rowValue.at("ActiveTime").c_str(), sizeof(TThostFtdcTimeType));
strncpy(data.SuspendTime, rowValue.at("SuspendTime").c_str(), sizeof(TThostFtdcTimeType));
strncpy(data.UpdateTime, rowValue.at("UpdateTime").c_str(), sizeof(TThostFtdcTimeType));
strncpy(data.CancelTime, rowValue.at("CancelTime").c_str(), sizeof(TThostFtdcTimeType));
strncpy(data.ActiveTraderID, rowValue.at("ActiveTraderID").c_str(), sizeof(TThostFtdcTraderIDType));
strncpy(data.ClearingPartID, rowValue.at("ClearingPartID").c_str(), sizeof(TThostFtdcParticipantIDType));
data.SequenceNo = std::stoi(rowValue.at("SequenceNo"));
strncpy(data.BranchID, rowValue.at("BranchID").c_str(), sizeof(TThostFtdcBranchIDType));
strncpy(data.reserve2, rowValue.at("reserve2").c_str(), sizeof(TThostFtdcOldIPAddressType));
strncpy(data.MacAddress, rowValue.at("MacAddress").c_str(), sizeof(TThostFtdcMacAddressType));
strncpy(data.ExchangeInstID, rowValue.at("ExchangeInstID").c_str(), sizeof(TThostFtdcExchangeInstIDType));
strncpy(data.IPAddress, rowValue.at("IPAddress").c_str(), sizeof(TThostFtdcIPAddressType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
(data.OrderPriceType == 0 ? '0' : data.OrderPriceType) + "','" + (data.Direction == 0 ? '0' : data.Direction) + "','" + data.CombOffsetFlag + "','" + data.CombHedgeFlag + "','" + std::to_string(data.LimitPrice) + "','" + std::to_string(data.VolumeTotalOriginal) + "','" + (data.TimeCondition == 0 ? '0' : data.TimeCondition) + "','" + data.GTDDate + "','" + (data.VolumeCondition == 0 ? '0' : data.VolumeCondition) + "','" + std::to_string(data.MinVolume) + "','" + (data.ContingentCondition == 0 ? '0' : data.ContingentCondition) + "','" + std::to_string(data.StopPrice) + "','" + (data.ForceCloseReason == 0 ? '0' : data.ForceCloseReason) + "','" + std::to_string(data.IsAutoSuspend) + "','" + data.BusinessUnit + "','" + std::to_string(data.RequestID) + "','" + data.OrderLocalID + "','" + data.ExchangeID + "','" + data.ParticipantID + "','" + data.ClientID + "','" + data.reserve1 + "','" + data.TraderID + "','" + std::to_string(data.InstallID) + "','" + (data.OrderSubmitStatus == 0 ? '0' : data.OrderSubmitStatus) + "','" + std::to_string(data.NotifySequence) + "','" + data.TradingDay + "','" + std::to_string(data.SettlementID) + "','" + data.OrderSysID + "','" + (data.OrderSource == 0 ? '0' : data.OrderSource) + "','" + (data.OrderStatus == 0 ? '0' : data.OrderStatus) + "','" + (data.OrderType == 0 ? '0' : data.OrderType) + "','" + std::to_string(data.VolumeTraded) + "','" + std::to_string(data.VolumeTotal) + "','" + data.InsertDate + "','" + data.InsertTime + "','" + data.ActiveTime + "','" + data.SuspendTime + "','" + data.UpdateTime + "','" + data.CancelTime + "','" + data.ActiveTraderID + "','" + data.ClearingPartID + "','" + std::to_string(data.SequenceNo) + "','" + data.BranchID + "','" + data.reserve2 + "','" + data.MacAddress + "','" + data.ExchangeInstID + "','" + data.IPAddress
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcExchangeOrderInsertErrorFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcExchangeOrderInsertErrorField data;
CThostFtdcExchangeOrderInsertErrorFieldWrapper(const CThostFtdcExchangeOrderInsertErrorField& _data = { 0 }) :data(_data) { }
CThostFtdcExchangeOrderInsertErrorFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcExchangeOrderInsertErrorField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.ParticipantID, rowValue.at("ParticipantID").c_str(), sizeof(TThostFtdcParticipantIDType));
strncpy(data.TraderID, rowValue.at("TraderID").c_str(), sizeof(TThostFtdcTraderIDType));
data.InstallID = std::stoi(rowValue.at("InstallID"));
strncpy(data.OrderLocalID, rowValue.at("OrderLocalID").c_str(), sizeof(TThostFtdcOrderLocalIDType));
data.ErrorID = std::stoi(rowValue.at("ErrorID"));
strncpy(data.ErrorMsg, utf8_to_gbk(rowValue.at("ErrorMsg")).c_str(), sizeof(TThostFtdcErrorMsgType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.ExchangeID + "','" + data.ParticipantID + "','" + data.TraderID + "','" + std::to_string(data.InstallID) + "','" + data.OrderLocalID + "','" + std::to_string(data.ErrorID) + "','" + gbk_to_utf8(data.ErrorMsg)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcInputOrderActionFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcInputOrderActionField data;
CThostFtdcInputOrderActionFieldWrapper(const CThostFtdcInputOrderActionField& _data = { 0 }) :data(_data) { }
CThostFtdcInputOrderActionFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcInputOrderActionField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
data.OrderActionRef = std::stoi(rowValue.at("OrderActionRef"));
strncpy(data.OrderRef, rowValue.at("OrderRef").c_str(), sizeof(TThostFtdcOrderRefType));
data.RequestID = std::stoi(rowValue.at("RequestID"));
data.FrontID = std::stoi(rowValue.at("FrontID"));
data.SessionID = std::stoi(rowValue.at("SessionID"));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.OrderSysID, rowValue.at("OrderSysID").c_str(), sizeof(TThostFtdcOrderSysIDType));
data.ActionFlag = rowValue.at("ActionFlag").empty() ? '0' : rowValue.at("ActionFlag")[0];
data.LimitPrice = std::stod(rowValue.at("LimitPrice"));
data.VolumeChange = std::stoi(rowValue.at("VolumeChange"));
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
strncpy(data.InvestUnitID, rowValue.at("InvestUnitID").c_str(), sizeof(TThostFtdcInvestUnitIDType));
strncpy(data.reserve2, rowValue.at("reserve2").c_str(), sizeof(TThostFtdcOldIPAddressType));
strncpy(data.MacAddress, rowValue.at("MacAddress").c_str(), sizeof(TThostFtdcMacAddressType));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
strncpy(data.IPAddress, rowValue.at("IPAddress").c_str(), sizeof(TThostFtdcIPAddressType));
strncpy(data.OrderMemo, rowValue.at("OrderMemo").c_str(), sizeof(TThostFtdcOrderMemoType));
data.SessionReqSeq = std::stoi(rowValue.at("SessionReqSeq"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorID + "','" + std::to_string(data.OrderActionRef) + "','" + data.OrderRef + "','" + std::to_string(data.RequestID) + "','" + std::to_string(data.FrontID) + "','" + std::to_string(data.SessionID) + "','" + data.ExchangeID + "','" + data.OrderSysID + "','" + (data.ActionFlag == 0 ? '0' : data.ActionFlag) + "','" + std::to_string(data.LimitPrice) + "','" + std::to_string(data.VolumeChange) + "','" + data.UserID + "','" + data.reserve1 + "','" + data.InvestUnitID + "','" + data.reserve2 + "','" + data.MacAddress + "','" + data.InstrumentID + "','" + data.IPAddress + "','" + data.OrderMemo + "','" + std::to_string(data.SessionReqSeq)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcInputOrderActionField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcOrderActionFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcOrderActionField data;
CThostFtdcOrderActionFieldWrapper(const CThostFtdcOrderActionField& _data = { 0 }) :data(_data) { }
CThostFtdcOrderActionFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcOrderActionField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
data.OrderActionRef = std::stoi(rowValue.at("OrderActionRef"));
strncpy(data.OrderRef, rowValue.at("OrderRef").c_str(), sizeof(TThostFtdcOrderRefType));
data.RequestID = std::stoi(rowValue.at("RequestID"));
data.FrontID = std::stoi(rowValue.at("FrontID"));
data.SessionID = std::stoi(rowValue.at("SessionID"));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.OrderSysID, rowValue.at("OrderSysID").c_str(), sizeof(TThostFtdcOrderSysIDType));
data.ActionFlag = rowValue.at("ActionFlag").empty() ? '0' : rowValue.at("ActionFlag")[0];
data.LimitPrice = std::stod(rowValue.at("LimitPrice"));
data.VolumeChange = std::stoi(rowValue.at("VolumeChange"));
strncpy(data.ActionDate, rowValue.at("ActionDate").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.ActionTime, rowValue.at("ActionTime").c_str(), sizeof(TThostFtdcTimeType));
strncpy(data.TraderID, rowValue.at("TraderID").c_str(), sizeof(TThostFtdcTraderIDType));
data.InstallID = std::stoi(rowValue.at("InstallID"));
strncpy(data.OrderLocalID, rowValue.at("OrderLocalID").c_str(), sizeof(TThostFtdcOrderLocalIDType));
strncpy(data.ActionLocalID, rowValue.at("ActionLocalID").c_str(), sizeof(TThostFtdcOrderLocalIDType));
strncpy(data.ParticipantID, rowValue.at("ParticipantID").c_str(), sizeof(TThostFtdcParticipantIDType));
strncpy(data.ClientID, rowValue.at("ClientID").c_str(), sizeof(TThostFtdcClientIDType));
strncpy(data.BusinessUnit, rowValue.at("BusinessUnit").c_str(), sizeof(TThostFtdcBusinessUnitType));
data.OrderActionStatus = rowValue.at("OrderActionStatus").empty() ? '0' : rowValue.at("OrderActionStatus")[0];
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
strncpy(data.StatusMsg, utf8_to_gbk(rowValue.at("StatusMsg")).c_str(), sizeof(TThostFtdcErrorMsgType));
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
strncpy(data.BranchID, rowValue.at("BranchID").c_str(), sizeof(TThostFtdcBranchIDType));
strncpy(data.InvestUnitID, rowValue.at("InvestUnitID").c_str(), sizeof(TThostFtdcInvestUnitIDType));
strncpy(data.reserve2, rowValue.at("reserve2").c_str(), sizeof(TThostFtdcOldIPAddressType));
strncpy(data.MacAddress, rowValue.at("MacAddress").c_str(), sizeof(TThostFtdcMacAddressType));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
strncpy(data.IPAddress, rowValue.at("IPAddress").c_str(), sizeof(TThostFtdcIPAddressType));
strncpy(data.OrderMemo, rowValue.at("OrderMemo").c_str(), sizeof(TThostFtdcOrderMemoType));
data.SessionReqSeq = std::stoi(rowValue.at("SessionReqSeq"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorID + "','" + std::to_string(data.OrderActionRef) + "','" + data.OrderRef + "','" + std::to_string(data.RequestID) + "','" + std::to_string(data.FrontID) + "','" + std::to_string(data.SessionID) + "','" + data.ExchangeID + "','" + data.OrderSysID + "','" + (data.ActionFlag == 0 ? '0' : data.ActionFlag) + "','" + std::to_string(data.LimitPrice) + "','" + std::to_string(data.VolumeChange) + "','" + data.ActionDate + "','" + data.ActionTime + "','" + data.TraderID + "','" + std::to_string(data.InstallID) + "','" + data.OrderLocalID + "','" + data.ActionLocalID + "','" + data.ParticipantID + "','" + data.ClientID + "','" + data.BusinessUnit + "','" + (data.OrderActionStatus == 0 ? '0' : data.OrderActionStatus) + "','" + data.UserID + "','" + gbk_to_utf8(data.StatusMsg) + "','" + data.reserve1 + "','" + data.BranchID + "','" + data.InvestUnitID + "','" + data.reserve2 + "','" + data.MacAddress + "','" + data.InstrumentID + "','" + data.IPAddress + "','" + data.OrderMemo + "','" + std::to_string(data.SessionReqSeq)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcOrderActionField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcExchangeOrderActionFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcExchangeOrderActionField data;
CThostFtdcExchangeOrderActionFieldWrapper(const CThostFtdcExchangeOrderActionField& _data = { 0 }) :data(_data) { }
CThostFtdcExchangeOrderActionFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcExchangeOrderActionField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.OrderSysID, rowValue.at("OrderSysID").c_str(), sizeof(TThostFtdcOrderSysIDType));
data.ActionFlag = rowValue.at("ActionFlag").empty() ? '0' : rowValue.at("ActionFlag")[0];
data.LimitPrice = std::stod(rowValue.at("LimitPrice"));
data.VolumeChange = std::stoi(rowValue.at("VolumeChange"));
strncpy(data.ActionDate, rowValue.at("ActionDate").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.ActionTime, rowValue.at("ActionTime").c_str(), sizeof(TThostFtdcTimeType));
strncpy(data.TraderID, rowValue.at("TraderID").c_str(), sizeof(TThostFtdcTraderIDType));
data.InstallID = std::stoi(rowValue.at("InstallID"));
strncpy(data.OrderLocalID, rowValue.at("OrderLocalID").c_str(), sizeof(TThostFtdcOrderLocalIDType));
strncpy(data.ActionLocalID, rowValue.at("ActionLocalID").c_str(), sizeof(TThostFtdcOrderLocalIDType));
strncpy(data.ParticipantID, rowValue.at("ParticipantID").c_str(), sizeof(TThostFtdcParticipantIDType));
strncpy(data.ClientID, rowValue.at("ClientID").c_str(), sizeof(TThostFtdcClientIDType));
strncpy(data.BusinessUnit, rowValue.at("BusinessUnit").c_str(), sizeof(TThostFtdcBusinessUnitType));
data.OrderActionStatus = rowValue.at("OrderActionStatus").empty() ? '0' : rowValue.at("OrderActionStatus")[0];
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
strncpy(data.BranchID, rowValue.at("BranchID").c_str(), sizeof(TThostFtdcBranchIDType));
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldIPAddressType));
strncpy(data.MacAddress, rowValue.at("MacAddress").c_str(), sizeof(TThostFtdcMacAddressType));
strncpy(data.IPAddress, rowValue.at("IPAddress").c_str(), sizeof(TThostFtdcIPAddressType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.ExchangeID + "','" + data.OrderSysID + "','" + (data.ActionFlag == 0 ? '0' : data.ActionFlag) + "','" + std::to_string(data.LimitPrice) + "','" + std::to_string(data.VolumeChange) + "','" + data.ActionDate + "','" + data.ActionTime + "','" + data.TraderID + "','" + std::to_string(data.InstallID) + "','" + data.OrderLocalID + "','" + data.ActionLocalID + "','" + data.ParticipantID + "','" + data.ClientID + "','" + data.BusinessUnit + "','" + (data.OrderActionStatus == 0 ? '0' : data.OrderActionStatus) + "','" + data.UserID + "','" + data.BranchID + "','" + data.reserve1 + "','" + data.MacAddress + "','" + data.IPAddress
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcExchangeOrderActionErrorFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcExchangeOrderActionErrorField data;
CThostFtdcExchangeOrderActionErrorFieldWrapper(const CThostFtdcExchangeOrderActionErrorField& _data = { 0 }) :data(_data) { }
CThostFtdcExchangeOrderActionErrorFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcExchangeOrderActionErrorField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.OrderSysID, rowValue.at("OrderSysID").c_str(), sizeof(TThostFtdcOrderSysIDType));
strncpy(data.TraderID, rowValue.at("TraderID").c_str(), sizeof(TThostFtdcTraderIDType));
data.InstallID = std::stoi(rowValue.at("InstallID"));
strncpy(data.OrderLocalID, rowValue.at("OrderLocalID").c_str(), sizeof(TThostFtdcOrderLocalIDType));
strncpy(data.ActionLocalID, rowValue.at("ActionLocalID").c_str(), sizeof(TThostFtdcOrderLocalIDType));
data.ErrorID = std::stoi(rowValue.at("ErrorID"));
strncpy(data.ErrorMsg, utf8_to_gbk(rowValue.at("ErrorMsg")).c_str(), sizeof(TThostFtdcErrorMsgType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.ExchangeID + "','" + data.OrderSysID + "','" + data.TraderID + "','" + std::to_string(data.InstallID) + "','" + data.OrderLocalID + "','" + data.ActionLocalID + "','" + std::to_string(data.ErrorID) + "','" + gbk_to_utf8(data.ErrorMsg)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcExchangeTradeFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcExchangeTradeField data;
CThostFtdcExchangeTradeFieldWrapper(const CThostFtdcExchangeTradeField& _data = { 0 }) :data(_data) { }
CThostFtdcExchangeTradeFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcExchangeTradeField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.TradeID, rowValue.at("TradeID").c_str(), sizeof(TThostFtdcTradeIDType));
data.Direction = rowValue.at("Direction").empty() ? '0' : rowValue.at("Direction")[0];
strncpy(data.OrderSysID, rowValue.at("OrderSysID").c_str(), sizeof(TThostFtdcOrderSysIDType));
strncpy(data.ParticipantID, rowValue.at("ParticipantID").c_str(), sizeof(TThostFtdcParticipantIDType));
strncpy(data.ClientID, rowValue.at("ClientID").c_str(), sizeof(TThostFtdcClientIDType));
data.TradingRole = rowValue.at("TradingRole").empty() ? '0' : rowValue.at("TradingRole")[0];
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldExchangeInstIDType));
data.OffsetFlag = rowValue.at("OffsetFlag").empty() ? '0' : rowValue.at("OffsetFlag")[0];
data.HedgeFlag = rowValue.at("HedgeFlag").empty() ? '0' : rowValue.at("HedgeFlag")[0];
data.Price = std::stod(rowValue.at("Price"));
data.Volume = std::stoi(rowValue.at("Volume"));
strncpy(data.TradeDate, rowValue.at("TradeDate").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.TradeTime, rowValue.at("TradeTime").c_str(), sizeof(TThostFtdcTimeType));
data.TradeType = rowValue.at("TradeType").empty() ? '0' : rowValue.at("TradeType")[0];
data.PriceSource = rowValue.at("PriceSource").empty() ? '0' : rowValue.at("PriceSource")[0];
strncpy(data.TraderID, rowValue.at("TraderID").c_str(), sizeof(TThostFtdcTraderIDType));
strncpy(data.OrderLocalID, rowValue.at("OrderLocalID").c_str(), sizeof(TThostFtdcOrderLocalIDType));
strncpy(data.ClearingPartID, rowValue.at("ClearingPartID").c_str(), sizeof(TThostFtdcParticipantIDType));
strncpy(data.BusinessUnit, rowValue.at("BusinessUnit").c_str(), sizeof(TThostFtdcBusinessUnitType));
data.SequenceNo = std::stoi(rowValue.at("SequenceNo"));
data.TradeSource = rowValue.at("TradeSource").empty() ? '0' : rowValue.at("TradeSource")[0];
strncpy(data.ExchangeInstID, rowValue.at("ExchangeInstID").c_str(), sizeof(TThostFtdcExchangeInstIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.ExchangeID + "','" + data.TradeID + "','" + (data.Direction == 0 ? '0' : data.Direction) + "','" + data.OrderSysID + "','" + data.ParticipantID + "','" + data.ClientID + "','" + (data.TradingRole == 0 ? '0' : data.TradingRole) + "','" + data.reserve1 + "','" + (data.OffsetFlag == 0 ? '0' : data.OffsetFlag) + "','" + (data.HedgeFlag == 0 ? '0' : data.HedgeFlag) + "','" + std::to_string(data.Price) + "','" + std::to_string(data.Volume) + "','" + data.TradeDate + "','" + data.TradeTime + "','" + (data.TradeType == 0 ? '0' : data.TradeType) + "','" + (data.PriceSource == 0 ? '0' : data.PriceSource) + "','" + data.TraderID + "','" + data.OrderLocalID + "','" + data.ClearingPartID + "','" + data.BusinessUnit + "','" + std::to_string(data.SequenceNo) + "','" + (data.TradeSource == 0 ? '0' : data.TradeSource) + "','" + data.ExchangeInstID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcTradeFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcTradeField data;
TThostFtdcMoneyType Commission;
TThostFtdcMoneyType CloseProfit;
TThostFtdcMoneyType CashIn;
CThostFtdcTradeFieldWrapper(const CThostFtdcTradeField& _data = { 0 }) :data(_data) { ::memset((char*)(this) + sizeof(data), 0, sizeof(*this) - sizeof(data)); }
CThostFtdcTradeFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcTradeField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
strncpy(data.OrderRef, rowValue.at("OrderRef").c_str(), sizeof(TThostFtdcOrderRefType));
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.TradeID, rowValue.at("TradeID").c_str(), sizeof(TThostFtdcTradeIDType));
data.Direction = rowValue.at("Direction").empty() ? '0' : rowValue.at("Direction")[0];
strncpy(data.OrderSysID, rowValue.at("OrderSysID").c_str(), sizeof(TThostFtdcOrderSysIDType));
strncpy(data.ParticipantID, rowValue.at("ParticipantID").c_str(), sizeof(TThostFtdcParticipantIDType));
strncpy(data.ClientID, rowValue.at("ClientID").c_str(), sizeof(TThostFtdcClientIDType));
data.TradingRole = rowValue.at("TradingRole").empty() ? '0' : rowValue.at("TradingRole")[0];
strncpy(data.reserve2, rowValue.at("reserve2").c_str(), sizeof(TThostFtdcOldExchangeInstIDType));
data.OffsetFlag = rowValue.at("OffsetFlag").empty() ? '0' : rowValue.at("OffsetFlag")[0];
data.HedgeFlag = rowValue.at("HedgeFlag").empty() ? '0' : rowValue.at("HedgeFlag")[0];
data.Price = std::stod(rowValue.at("Price"));
data.Volume = std::stoi(rowValue.at("Volume"));
strncpy(data.TradeDate, rowValue.at("TradeDate").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.TradeTime, rowValue.at("TradeTime").c_str(), sizeof(TThostFtdcTimeType));
data.TradeType = rowValue.at("TradeType").empty() ? '0' : rowValue.at("TradeType")[0];
data.PriceSource = rowValue.at("PriceSource").empty() ? '0' : rowValue.at("PriceSource")[0];
strncpy(data.TraderID, rowValue.at("TraderID").c_str(), sizeof(TThostFtdcTraderIDType));
strncpy(data.OrderLocalID, rowValue.at("OrderLocalID").c_str(), sizeof(TThostFtdcOrderLocalIDType));
strncpy(data.ClearingPartID, rowValue.at("ClearingPartID").c_str(), sizeof(TThostFtdcParticipantIDType));
strncpy(data.BusinessUnit, rowValue.at("BusinessUnit").c_str(), sizeof(TThostFtdcBusinessUnitType));
data.SequenceNo = std::stoi(rowValue.at("SequenceNo"));
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcDateType));
data.SettlementID = std::stoi(rowValue.at("SettlementID"));
data.BrokerOrderSeq = std::stoi(rowValue.at("BrokerOrderSeq"));
data.TradeSource = rowValue.at("TradeSource").empty() ? '0' : rowValue.at("TradeSource")[0];
strncpy(data.InvestUnitID, rowValue.at("InvestUnitID").c_str(), sizeof(TThostFtdcInvestUnitIDType));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
strncpy(data.ExchangeInstID, rowValue.at("ExchangeInstID").c_str(), sizeof(TThostFtdcExchangeInstIDType));
Commission = std::stod(rowValue.at("Commission"));
CloseProfit = std::stod(rowValue.at("CloseProfit"));
CashIn = std::stod(rowValue.at("CashIn"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorID + "','" + data.reserve1 + "','" + data.OrderRef + "','" + data.UserID + "','" + data.ExchangeID + "','" + data.TradeID + "','" + (data.Direction == 0 ? '0' : data.Direction) + "','" + data.OrderSysID + "','" + data.ParticipantID + "','" + data.ClientID + "','" + (data.TradingRole == 0 ? '0' : data.TradingRole) + "','" + data.reserve2 + "','" + (data.OffsetFlag == 0 ? '0' : data.OffsetFlag) + "','" + (data.HedgeFlag == 0 ? '0' : data.HedgeFlag) + "','" + std::to_string(data.Price) + "','" + std::to_string(data.Volume) + "','" + data.TradeDate + "','" + data.TradeTime + "','" + (data.TradeType == 0 ? '0' : data.TradeType) + "','" + (data.PriceSource == 0 ? '0' : data.PriceSource) + "','" + data.TraderID + "','" + data.OrderLocalID + "','" + data.ClearingPartID + "','" + data.BusinessUnit + "','" + std::to_string(data.SequenceNo) + "','" + data.TradingDay + "','" + std::to_string(data.SettlementID) + "','" + std::to_string(data.BrokerOrderSeq) + "','" + (data.TradeSource == 0 ? '0' : data.TradeSource) + "','" + data.InvestUnitID + "','" + data.InstrumentID + "','" + data.ExchangeInstID + "','" + std::to_string(Commission) + "','" + std::to_string(CloseProfit) + "','" + std::to_string(CashIn)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcTradeField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcUserSessionFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcUserSessionField data;
CThostFtdcUserSessionFieldWrapper(const CThostFtdcUserSessionField& _data = { 0 }) :data(_data) { }
CThostFtdcUserSessionFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcUserSessionField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
data.FrontID = std::stoi(rowValue.at("FrontID"));
data.SessionID = std::stoi(rowValue.at("SessionID"));
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
strncpy(data.LoginDate, rowValue.at("LoginDate").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.LoginTime, rowValue.at("LoginTime").c_str(), sizeof(TThostFtdcTimeType));
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldIPAddressType));
strncpy(data.UserProductInfo, rowValue.at("UserProductInfo").c_str(), sizeof(TThostFtdcProductInfoType));
strncpy(data.InterfaceProductInfo, rowValue.at("InterfaceProductInfo").c_str(), sizeof(TThostFtdcProductInfoType));
strncpy(data.ProtocolInfo, rowValue.at("ProtocolInfo").c_str(), sizeof(TThostFtdcProtocolInfoType));
strncpy(data.MacAddress, rowValue.at("MacAddress").c_str(), sizeof(TThostFtdcMacAddressType));
strncpy(data.LoginRemark, rowValue.at("LoginRemark").c_str(), sizeof(TThostFtdcLoginRemarkType));
strncpy(data.IPAddress, rowValue.at("IPAddress").c_str(), sizeof(TThostFtdcIPAddressType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
std::to_string(data.FrontID) + "','" + std::to_string(data.SessionID) + "','" + data.BrokerID + "','" + data.UserID + "','" + data.LoginDate + "','" + data.LoginTime + "','" + data.reserve1 + "','" + data.UserProductInfo + "','" + data.InterfaceProductInfo + "','" + data.ProtocolInfo + "','" + data.MacAddress + "','" + data.LoginRemark + "','" + data.IPAddress
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.UserID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& UserID) {
return "SELECT * FROM 'CThostFtdcUserSessionField' where BrokerID='" + BrokerID + "' and UserID='" + UserID + "';";
}
};
struct CThostFtdcQryMaxOrderVolumeFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryMaxOrderVolumeField data;
CThostFtdcQryMaxOrderVolumeFieldWrapper(const CThostFtdcQryMaxOrderVolumeField& _data = { 0 }) :data(_data) { }
CThostFtdcQryMaxOrderVolumeFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryMaxOrderVolumeField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
data.Direction = rowValue.at("Direction").empty() ? '0' : rowValue.at("Direction")[0];
data.OffsetFlag = rowValue.at("OffsetFlag").empty() ? '0' : rowValue.at("OffsetFlag")[0];
data.HedgeFlag = rowValue.at("HedgeFlag").empty() ? '0' : rowValue.at("HedgeFlag")[0];
data.MaxVolume = std::stoi(rowValue.at("MaxVolume"));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.InvestUnitID, rowValue.at("InvestUnitID").c_str(), sizeof(TThostFtdcInvestUnitIDType));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorID + "','" + data.reserve1 + "','" + (data.Direction == 0 ? '0' : data.Direction) + "','" + (data.OffsetFlag == 0 ? '0' : data.OffsetFlag) + "','" + (data.HedgeFlag == 0 ? '0' : data.HedgeFlag) + "','" + std::to_string(data.MaxVolume) + "','" + data.ExchangeID + "','" + data.InvestUnitID + "','" + data.InstrumentID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcQryMaxOrderVolumeField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcSettlementInfoConfirmFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcSettlementInfoConfirmField data;
CThostFtdcSettlementInfoConfirmFieldWrapper(const CThostFtdcSettlementInfoConfirmField& _data = { 0 }) :data(_data) { }
CThostFtdcSettlementInfoConfirmFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcSettlementInfoConfirmField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.ConfirmDate, rowValue.at("ConfirmDate").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.ConfirmTime, rowValue.at("ConfirmTime").c_str(), sizeof(TThostFtdcTimeType));
data.SettlementID = std::stoi(rowValue.at("SettlementID"));
strncpy(data.AccountID, rowValue.at("AccountID").c_str(), sizeof(TThostFtdcAccountIDType));
strncpy(data.CurrencyID, rowValue.at("CurrencyID").c_str(), sizeof(TThostFtdcCurrencyIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorID + "','" + data.ConfirmDate + "','" + data.ConfirmTime + "','" + std::to_string(data.SettlementID) + "','" + data.AccountID + "','" + data.CurrencyID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcSettlementInfoConfirmField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcSyncDepositFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcSyncDepositField data;
CThostFtdcSyncDepositFieldWrapper(const CThostFtdcSyncDepositField& _data = { 0 }) :data(_data) { }
CThostFtdcSyncDepositFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcSyncDepositField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.DepositSeqNo, rowValue.at("DepositSeqNo").c_str(), sizeof(TThostFtdcDepositSeqNoType));
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
data.Deposit = std::stod(rowValue.at("Deposit"));
data.IsForce = std::stoi(rowValue.at("IsForce"));
strncpy(data.CurrencyID, rowValue.at("CurrencyID").c_str(), sizeof(TThostFtdcCurrencyIDType));
data.IsFromSopt = std::stoi(rowValue.at("IsFromSopt"));
strncpy(data.TradingPassword, rowValue.at("TradingPassword").c_str(), sizeof(TThostFtdcPasswordType));
data.IsSecAgentTranfer = std::stoi(rowValue.at("IsSecAgentTranfer"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.DepositSeqNo + "','" + data.BrokerID + "','" + data.InvestorID + "','" + std::to_string(data.Deposit) + "','" + std::to_string(data.IsForce) + "','" + data.CurrencyID + "','" + std::to_string(data.IsFromSopt) + "','" + data.TradingPassword + "','" + std::to_string(data.IsSecAgentTranfer)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcSyncDepositField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcSyncFundMortgageFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcSyncFundMortgageField data;
CThostFtdcSyncFundMortgageFieldWrapper(const CThostFtdcSyncFundMortgageField& _data = { 0 }) :data(_data) { }
CThostFtdcSyncFundMortgageFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcSyncFundMortgageField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.MortgageSeqNo, rowValue.at("MortgageSeqNo").c_str(), sizeof(TThostFtdcDepositSeqNoType));
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.FromCurrencyID, rowValue.at("FromCurrencyID").c_str(), sizeof(TThostFtdcCurrencyIDType));
data.MortgageAmount = std::stod(rowValue.at("MortgageAmount"));
strncpy(data.ToCurrencyID, rowValue.at("ToCurrencyID").c_str(), sizeof(TThostFtdcCurrencyIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.MortgageSeqNo + "','" + data.BrokerID + "','" + data.InvestorID + "','" + data.FromCurrencyID + "','" + std::to_string(data.MortgageAmount) + "','" + data.ToCurrencyID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcSyncFundMortgageField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcBrokerSyncFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcBrokerSyncField data;
CThostFtdcBrokerSyncFieldWrapper(const CThostFtdcBrokerSyncField& _data = { 0 }) :data(_data) { }
CThostFtdcBrokerSyncFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcBrokerSyncField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcSyncingInvestorFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcSyncingInvestorField data;
CThostFtdcSyncingInvestorFieldWrapper(const CThostFtdcSyncingInvestorField& _data = { 0 }) :data(_data) { }
CThostFtdcSyncingInvestorFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcSyncingInvestorField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorGroupID, rowValue.at("InvestorGroupID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.InvestorName, rowValue.at("InvestorName").c_str(), sizeof(TThostFtdcPartyNameType));
data.IdentifiedCardType = rowValue.at("IdentifiedCardType").empty() ? '0' : rowValue.at("IdentifiedCardType")[0];
strncpy(data.IdentifiedCardNo, rowValue.at("IdentifiedCardNo").c_str(), sizeof(TThostFtdcIdentifiedCardNoType));
data.IsActive = std::stoi(rowValue.at("IsActive"));
strncpy(data.Telephone, rowValue.at("Telephone").c_str(), sizeof(TThostFtdcTelephoneType));
strncpy(data.Address, rowValue.at("Address").c_str(), sizeof(TThostFtdcAddressType));
strncpy(data.OpenDate, rowValue.at("OpenDate").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.Mobile, rowValue.at("Mobile").c_str(), sizeof(TThostFtdcMobileType));
strncpy(data.CommModelID, rowValue.at("CommModelID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.MarginModelID, rowValue.at("MarginModelID").c_str(), sizeof(TThostFtdcInvestorIDType));
data.IsOrderFreq = rowValue.at("IsOrderFreq").empty() ? '0' : rowValue.at("IsOrderFreq")[0];
data.IsOpenVolLimit = rowValue.at("IsOpenVolLimit").empty() ? '0' : rowValue.at("IsOpenVolLimit")[0];
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.InvestorID + "','" + data.BrokerID + "','" + data.InvestorGroupID + "','" + data.InvestorName + "','" + (data.IdentifiedCardType == 0 ? '0' : data.IdentifiedCardType) + "','" + data.IdentifiedCardNo + "','" + std::to_string(data.IsActive) + "','" + data.Telephone + "','" + data.Address + "','" + data.OpenDate + "','" + data.Mobile + "','" + data.CommModelID + "','" + data.MarginModelID + "','" + (data.IsOrderFreq == 0 ? '0' : data.IsOrderFreq) + "','" + (data.IsOpenVolLimit == 0 ? '0' : data.IsOpenVolLimit)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcSyncingInvestorField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcSyncingTradingCodeFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcSyncingTradingCodeField data;
CThostFtdcSyncingTradingCodeFieldWrapper(const CThostFtdcSyncingTradingCodeField& _data = { 0 }) :data(_data) { }
CThostFtdcSyncingTradingCodeFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcSyncingTradingCodeField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.ClientID, rowValue.at("ClientID").c_str(), sizeof(TThostFtdcClientIDType));
data.IsActive = std::stoi(rowValue.at("IsActive"));
data.ClientIDType = rowValue.at("ClientIDType").empty() ? '0' : rowValue.at("ClientIDType")[0];
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.InvestorID + "','" + data.BrokerID + "','" + data.ExchangeID + "','" + data.ClientID + "','" + std::to_string(data.IsActive) + "','" + (data.ClientIDType == 0 ? '0' : data.ClientIDType)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcSyncingTradingCodeField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcSyncingInvestorGroupFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcSyncingInvestorGroupField data;
CThostFtdcSyncingInvestorGroupFieldWrapper(const CThostFtdcSyncingInvestorGroupField& _data = { 0 }) :data(_data) { }
CThostFtdcSyncingInvestorGroupFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcSyncingInvestorGroupField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorGroupID, rowValue.at("InvestorGroupID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.InvestorGroupName, rowValue.at("InvestorGroupName").c_str(), sizeof(TThostFtdcInvestorGroupNameType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorGroupID + "','" + data.InvestorGroupName
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcSyncingTradingAccountFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcSyncingTradingAccountField data;
CThostFtdcSyncingTradingAccountFieldWrapper(const CThostFtdcSyncingTradingAccountField& _data = { 0 }) :data(_data) { }
CThostFtdcSyncingTradingAccountFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcSyncingTradingAccountField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.AccountID, rowValue.at("AccountID").c_str(), sizeof(TThostFtdcAccountIDType));
data.PreMortgage = std::stod(rowValue.at("PreMortgage"));
data.PreCredit = std::stod(rowValue.at("PreCredit"));
data.PreDeposit = std::stod(rowValue.at("PreDeposit"));
data.PreBalance = std::stod(rowValue.at("PreBalance"));
data.PreMargin = std::stod(rowValue.at("PreMargin"));
data.InterestBase = std::stod(rowValue.at("InterestBase"));
data.Interest = std::stod(rowValue.at("Interest"));
data.Deposit = std::stod(rowValue.at("Deposit"));
data.Withdraw = std::stod(rowValue.at("Withdraw"));
data.FrozenMargin = std::stod(rowValue.at("FrozenMargin"));
data.FrozenCash = std::stod(rowValue.at("FrozenCash"));
data.FrozenCommission = std::stod(rowValue.at("FrozenCommission"));
data.CurrMargin = std::stod(rowValue.at("CurrMargin"));
data.CashIn = std::stod(rowValue.at("CashIn"));
data.Commission = std::stod(rowValue.at("Commission"));
data.CloseProfit = std::stod(rowValue.at("CloseProfit"));
data.PositionProfit = std::stod(rowValue.at("PositionProfit"));
data.Balance = std::stod(rowValue.at("Balance"));
data.Available = std::stod(rowValue.at("Available"));
data.WithdrawQuota = std::stod(rowValue.at("WithdrawQuota"));
data.Reserve = std::stod(rowValue.at("Reserve"));
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcDateType));
data.SettlementID = std::stoi(rowValue.at("SettlementID"));
data.Credit = std::stod(rowValue.at("Credit"));
data.Mortgage = std::stod(rowValue.at("Mortgage"));
data.ExchangeMargin = std::stod(rowValue.at("ExchangeMargin"));
data.DeliveryMargin = std::stod(rowValue.at("DeliveryMargin"));
data.ExchangeDeliveryMargin = std::stod(rowValue.at("ExchangeDeliveryMargin"));
data.ReserveBalance = std::stod(rowValue.at("ReserveBalance"));
strncpy(data.CurrencyID, rowValue.at("CurrencyID").c_str(), sizeof(TThostFtdcCurrencyIDType));
data.PreFundMortgageIn = std::stod(rowValue.at("PreFundMortgageIn"));
data.PreFundMortgageOut = std::stod(rowValue.at("PreFundMortgageOut"));
data.FundMortgageIn = std::stod(rowValue.at("FundMortgageIn"));
data.FundMortgageOut = std::stod(rowValue.at("FundMortgageOut"));
data.FundMortgageAvailable = std::stod(rowValue.at("FundMortgageAvailable"));
data.MortgageableFund = std::stod(rowValue.at("MortgageableFund"));
data.SpecProductMargin = std::stod(rowValue.at("SpecProductMargin"));
data.SpecProductFrozenMargin = std::stod(rowValue.at("SpecProductFrozenMargin"));
data.SpecProductCommission = std::stod(rowValue.at("SpecProductCommission"));
data.SpecProductFrozenCommission = std::stod(rowValue.at("SpecProductFrozenCommission"));
data.SpecProductPositionProfit = std::stod(rowValue.at("SpecProductPositionProfit"));
data.SpecProductCloseProfit = std::stod(rowValue.at("SpecProductCloseProfit"));
data.SpecProductPositionProfitByAlg = std::stod(rowValue.at("SpecProductPositionProfitByAlg"));
data.SpecProductExchangeMargin = std::stod(rowValue.at("SpecProductExchangeMargin"));
data.FrozenSwap = std::stod(rowValue.at("FrozenSwap"));
data.RemainSwap = std::stod(rowValue.at("RemainSwap"));
data.OptionValue = std::stod(rowValue.at("OptionValue"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.AccountID + "','" + std::to_string(data.PreMortgage) + "','" + std::to_string(data.PreCredit) + "','" + std::to_string(data.PreDeposit) + "','" + std::to_string(data.PreBalance) + "','" + std::to_string(data.PreMargin) + "','" + std::to_string(data.InterestBase) + "','" + std::to_string(data.Interest) + "','" + std::to_string(data.Deposit) + "','" + std::to_string(data.Withdraw) + "','" + std::to_string(data.FrozenMargin) + "','" + std::to_string(data.FrozenCash) + "','" + std::to_string(data.FrozenCommission) + "','" + std::to_string(data.CurrMargin) + "','" + std::to_string(data.CashIn) + "','" + std::to_string(data.Commission) + "','" + std::to_string(data.CloseProfit) + "','" + std::to_string(data.PositionProfit) + "','" + std::to_string(data.Balance) + "','" + std::to_string(data.Available) + "','" + std::to_string(data.WithdrawQuota) + "','" + std::to_string(data.Reserve) + "','" + data.TradingDay + "','" + std::to_string(data.SettlementID) + "','" + std::to_string(data.Credit) + "','" + std::to_string(data.Mortgage) + "','" + std::to_string(data.ExchangeMargin) + "','" + std::to_string(data.DeliveryMargin) + "','" + std::to_string(data.ExchangeDeliveryMargin) + "','" + std::to_string(data.ReserveBalance) + "','" + data.CurrencyID + "','" + std::to_string(data.PreFundMortgageIn) + "','" + std::to_string(data.PreFundMortgageOut) + "','" + std::to_string(data.FundMortgageIn) + "','" + std::to_string(data.FundMortgageOut) + "','" + std::to_string(data.FundMortgageAvailable) + "','" + std::to_string(data.MortgageableFund) + "','" + std::to_string(data.SpecProductMargin) + "','" + std::to_string(data.SpecProductFrozenMargin) + "','" + std::to_string(data.SpecProductCommission) + "','" + std::to_string(data.SpecProductFrozenCommission) + "','" + std::to_string(data.SpecProductPositionProfit) + "','" + std::to_string(data.SpecProductCloseProfit) + "','" + std::to_string(data.SpecProductPositionProfitByAlg) + "','" + std::to_string(data.SpecProductExchangeMargin) + "','" + std::to_string(data.FrozenSwap) + "','" + std::to_string(data.RemainSwap) + "','" + std::to_string(data.OptionValue)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.AccountID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& AccountID) {
return "SELECT * FROM 'CThostFtdcSyncingTradingAccountField' where BrokerID='" + BrokerID + "' and AccountID='" + AccountID + "';";
}
};
struct CThostFtdcSyncingInvestorPositionFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcSyncingInvestorPositionField data;
CThostFtdcSyncingInvestorPositionFieldWrapper(const CThostFtdcSyncingInvestorPositionField& _data = { 0 }) :data(_data) { }
CThostFtdcSyncingInvestorPositionFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcSyncingInvestorPositionField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
data.PosiDirection = rowValue.at("PosiDirection").empty() ? '0' : rowValue.at("PosiDirection")[0];
data.HedgeFlag = rowValue.at("HedgeFlag").empty() ? '0' : rowValue.at("HedgeFlag")[0];
data.PositionDate = rowValue.at("PositionDate").empty() ? '0' : rowValue.at("PositionDate")[0];
data.YdPosition = std::stoi(rowValue.at("YdPosition"));
data.Position = std::stoi(rowValue.at("Position"));
data.LongFrozen = std::stoi(rowValue.at("LongFrozen"));
data.ShortFrozen = std::stoi(rowValue.at("ShortFrozen"));
data.LongFrozenAmount = std::stod(rowValue.at("LongFrozenAmount"));
data.ShortFrozenAmount = std::stod(rowValue.at("ShortFrozenAmount"));
data.OpenVolume = std::stoi(rowValue.at("OpenVolume"));
data.CloseVolume = std::stoi(rowValue.at("CloseVolume"));
data.OpenAmount = std::stod(rowValue.at("OpenAmount"));
data.CloseAmount = std::stod(rowValue.at("CloseAmount"));
data.PositionCost = std::stod(rowValue.at("PositionCost"));
data.PreMargin = std::stod(rowValue.at("PreMargin"));
data.UseMargin = std::stod(rowValue.at("UseMargin"));
data.FrozenMargin = std::stod(rowValue.at("FrozenMargin"));
data.FrozenCash = std::stod(rowValue.at("FrozenCash"));
data.FrozenCommission = std::stod(rowValue.at("FrozenCommission"));
data.CashIn = std::stod(rowValue.at("CashIn"));
data.Commission = std::stod(rowValue.at("Commission"));
data.CloseProfit = std::stod(rowValue.at("CloseProfit"));
data.PositionProfit = std::stod(rowValue.at("PositionProfit"));
data.PreSettlementPrice = std::stod(rowValue.at("PreSettlementPrice"));
data.SettlementPrice = std::stod(rowValue.at("SettlementPrice"));
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcDateType));
data.SettlementID = std::stoi(rowValue.at("SettlementID"));
data.OpenCost = std::stod(rowValue.at("OpenCost"));
data.ExchangeMargin = std::stod(rowValue.at("ExchangeMargin"));
data.CombPosition = std::stoi(rowValue.at("CombPosition"));
data.CombLongFrozen = std::stoi(rowValue.at("CombLongFrozen"));
data.CombShortFrozen = std::stoi(rowValue.at("CombShortFrozen"));
data.CloseProfitByDate = std::stod(rowValue.at("CloseProfitByDate"));
data.CloseProfitByTrade = std::stod(rowValue.at("CloseProfitByTrade"));
data.TodayPosition = std::stoi(rowValue.at("TodayPosition"));
data.MarginRateByMoney = std::stod(rowValue.at("MarginRateByMoney"));
data.MarginRateByVolume = std::stod(rowValue.at("MarginRateByVolume"));
data.StrikeFrozen = std::stoi(rowValue.at("StrikeFrozen"));
data.StrikeFrozenAmount = std::stod(rowValue.at("StrikeFrozenAmount"));
data.AbandonFrozen = std::stoi(rowValue.at("AbandonFrozen"));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
data.YdStrikeFrozen = std::stoi(rowValue.at("YdStrikeFrozen"));
strncpy(data.InvestUnitID, rowValue.at("InvestUnitID").c_str(), sizeof(TThostFtdcInvestUnitIDType));
data.PositionCostOffset = std::stod(rowValue.at("PositionCostOffset"));
data.TasPosition = std::stoi(rowValue.at("TasPosition"));
data.TasPositionCost = std::stod(rowValue.at("TasPositionCost"));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.reserve1 + "','" + data.BrokerID + "','" + data.InvestorID + "','" + (data.PosiDirection == 0 ? '0' : data.PosiDirection) + "','" + (data.HedgeFlag == 0 ? '0' : data.HedgeFlag) + "','" + (data.PositionDate == 0 ? '0' : data.PositionDate) + "','" + std::to_string(data.YdPosition) + "','" + std::to_string(data.Position) + "','" + std::to_string(data.LongFrozen) + "','" + std::to_string(data.ShortFrozen) + "','" + std::to_string(data.LongFrozenAmount) + "','" + std::to_string(data.ShortFrozenAmount) + "','" + std::to_string(data.OpenVolume) + "','" + std::to_string(data.CloseVolume) + "','" + std::to_string(data.OpenAmount) + "','" + std::to_string(data.CloseAmount) + "','" + std::to_string(data.PositionCost) + "','" + std::to_string(data.PreMargin) + "','" + std::to_string(data.UseMargin) + "','" + std::to_string(data.FrozenMargin) + "','" + std::to_string(data.FrozenCash) + "','" + std::to_string(data.FrozenCommission) + "','" + std::to_string(data.CashIn) + "','" + std::to_string(data.Commission) + "','" + std::to_string(data.CloseProfit) + "','" + std::to_string(data.PositionProfit) + "','" + std::to_string(data.PreSettlementPrice) + "','" + std::to_string(data.SettlementPrice) + "','" + data.TradingDay + "','" + std::to_string(data.SettlementID) + "','" + std::to_string(data.OpenCost) + "','" + std::to_string(data.ExchangeMargin) + "','" + std::to_string(data.CombPosition) + "','" + std::to_string(data.CombLongFrozen) + "','" + std::to_string(data.CombShortFrozen) + "','" + std::to_string(data.CloseProfitByDate) + "','" + std::to_string(data.CloseProfitByTrade) + "','" + std::to_string(data.TodayPosition) + "','" + std::to_string(data.MarginRateByMoney) + "','" + std::to_string(data.MarginRateByVolume) + "','" + std::to_string(data.StrikeFrozen) + "','" + std::to_string(data.StrikeFrozenAmount) + "','" + std::to_string(data.AbandonFrozen) + "','" + data.ExchangeID + "','" + std::to_string(data.YdStrikeFrozen) + "','" + data.InvestUnitID + "','" + std::to_string(data.PositionCostOffset) + "','" + std::to_string(data.TasPosition) + "','" + std::to_string(data.TasPositionCost) + "','" + data.InstrumentID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcSyncingInvestorPositionField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcSyncingInstrumentMarginRateFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcSyncingInstrumentMarginRateField data;
CThostFtdcSyncingInstrumentMarginRateFieldWrapper(const CThostFtdcSyncingInstrumentMarginRateField& _data = { 0 }) :data(_data) { }
CThostFtdcSyncingInstrumentMarginRateFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcSyncingInstrumentMarginRateField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
data.InvestorRange = rowValue.at("InvestorRange").empty() ? '0' : rowValue.at("InvestorRange")[0];
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
data.HedgeFlag = rowValue.at("HedgeFlag").empty() ? '0' : rowValue.at("HedgeFlag")[0];
data.LongMarginRatioByMoney = std::stod(rowValue.at("LongMarginRatioByMoney"));
data.LongMarginRatioByVolume = std::stod(rowValue.at("LongMarginRatioByVolume"));
data.ShortMarginRatioByMoney = std::stod(rowValue.at("ShortMarginRatioByMoney"));
data.ShortMarginRatioByVolume = std::stod(rowValue.at("ShortMarginRatioByVolume"));
data.IsRelative = std::stoi(rowValue.at("IsRelative"));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.reserve1 + "','" + (data.InvestorRange == 0 ? '0' : data.InvestorRange) + "','" + data.BrokerID + "','" + data.InvestorID + "','" + (data.HedgeFlag == 0 ? '0' : data.HedgeFlag) + "','" + std::to_string(data.LongMarginRatioByMoney) + "','" + std::to_string(data.LongMarginRatioByVolume) + "','" + std::to_string(data.ShortMarginRatioByMoney) + "','" + std::to_string(data.ShortMarginRatioByVolume) + "','" + std::to_string(data.IsRelative) + "','" + data.InstrumentID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcSyncingInstrumentMarginRateField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcSyncingInstrumentCommissionRateFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcSyncingInstrumentCommissionRateField data;
CThostFtdcSyncingInstrumentCommissionRateFieldWrapper(const CThostFtdcSyncingInstrumentCommissionRateField& _data = { 0 }) :data(_data) { }
CThostFtdcSyncingInstrumentCommissionRateFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcSyncingInstrumentCommissionRateField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
data.InvestorRange = rowValue.at("InvestorRange").empty() ? '0' : rowValue.at("InvestorRange")[0];
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
data.OpenRatioByMoney = std::stod(rowValue.at("OpenRatioByMoney"));
data.OpenRatioByVolume = std::stod(rowValue.at("OpenRatioByVolume"));
data.CloseRatioByMoney = std::stod(rowValue.at("CloseRatioByMoney"));
data.CloseRatioByVolume = std::stod(rowValue.at("CloseRatioByVolume"));
data.CloseTodayRatioByMoney = std::stod(rowValue.at("CloseTodayRatioByMoney"));
data.CloseTodayRatioByVolume = std::stod(rowValue.at("CloseTodayRatioByVolume"));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.reserve1 + "','" + (data.InvestorRange == 0 ? '0' : data.InvestorRange) + "','" + data.BrokerID + "','" + data.InvestorID + "','" + std::to_string(data.OpenRatioByMoney) + "','" + std::to_string(data.OpenRatioByVolume) + "','" + std::to_string(data.CloseRatioByMoney) + "','" + std::to_string(data.CloseRatioByVolume) + "','" + std::to_string(data.CloseTodayRatioByMoney) + "','" + std::to_string(data.CloseTodayRatioByVolume) + "','" + data.InstrumentID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcSyncingInstrumentCommissionRateField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcSyncingInstrumentTradingRightFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcSyncingInstrumentTradingRightField data;
CThostFtdcSyncingInstrumentTradingRightFieldWrapper(const CThostFtdcSyncingInstrumentTradingRightField& _data = { 0 }) :data(_data) { }
CThostFtdcSyncingInstrumentTradingRightFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcSyncingInstrumentTradingRightField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
data.InvestorRange = rowValue.at("InvestorRange").empty() ? '0' : rowValue.at("InvestorRange")[0];
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
data.TradingRight = rowValue.at("TradingRight").empty() ? '0' : rowValue.at("TradingRight")[0];
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.reserve1 + "','" + (data.InvestorRange == 0 ? '0' : data.InvestorRange) + "','" + data.BrokerID + "','" + data.InvestorID + "','" + (data.TradingRight == 0 ? '0' : data.TradingRight) + "','" + data.InstrumentID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcSyncingInstrumentTradingRightField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcQryOrderFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryOrderField data;
CThostFtdcQryOrderFieldWrapper(const CThostFtdcQryOrderField& _data = { 0 }) :data(_data) { }
CThostFtdcQryOrderFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryOrderField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.OrderSysID, rowValue.at("OrderSysID").c_str(), sizeof(TThostFtdcOrderSysIDType));
strncpy(data.InsertTimeStart, rowValue.at("InsertTimeStart").c_str(), sizeof(TThostFtdcTimeType));
strncpy(data.InsertTimeEnd, rowValue.at("InsertTimeEnd").c_str(), sizeof(TThostFtdcTimeType));
strncpy(data.InvestUnitID, rowValue.at("InvestUnitID").c_str(), sizeof(TThostFtdcInvestUnitIDType));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorID + "','" + data.reserve1 + "','" + data.ExchangeID + "','" + data.OrderSysID + "','" + data.InsertTimeStart + "','" + data.InsertTimeEnd + "','" + data.InvestUnitID + "','" + data.InstrumentID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcQryOrderField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcQryTradeFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryTradeField data;
CThostFtdcQryTradeFieldWrapper(const CThostFtdcQryTradeField& _data = { 0 }) :data(_data) { }
CThostFtdcQryTradeFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryTradeField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.TradeID, rowValue.at("TradeID").c_str(), sizeof(TThostFtdcTradeIDType));
strncpy(data.TradeTimeStart, rowValue.at("TradeTimeStart").c_str(), sizeof(TThostFtdcTimeType));
strncpy(data.TradeTimeEnd, rowValue.at("TradeTimeEnd").c_str(), sizeof(TThostFtdcTimeType));
strncpy(data.InvestUnitID, rowValue.at("InvestUnitID").c_str(), sizeof(TThostFtdcInvestUnitIDType));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorID + "','" + data.reserve1 + "','" + data.ExchangeID + "','" + data.TradeID + "','" + data.TradeTimeStart + "','" + data.TradeTimeEnd + "','" + data.InvestUnitID + "','" + data.InstrumentID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcQryTradeField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcQryInvestorPositionFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryInvestorPositionField data;
CThostFtdcQryInvestorPositionFieldWrapper(const CThostFtdcQryInvestorPositionField& _data = { 0 }) :data(_data) { }
CThostFtdcQryInvestorPositionFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryInvestorPositionField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.InvestUnitID, rowValue.at("InvestUnitID").c_str(), sizeof(TThostFtdcInvestUnitIDType));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorID + "','" + data.reserve1 + "','" + data.ExchangeID + "','" + data.InvestUnitID + "','" + data.InstrumentID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcQryInvestorPositionField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcQryTradingAccountFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryTradingAccountField data;
CThostFtdcQryTradingAccountFieldWrapper(const CThostFtdcQryTradingAccountField& _data = { 0 }) :data(_data) { }
CThostFtdcQryTradingAccountFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryTradingAccountField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.CurrencyID, rowValue.at("CurrencyID").c_str(), sizeof(TThostFtdcCurrencyIDType));
data.BizType = rowValue.at("BizType").empty() ? '0' : rowValue.at("BizType")[0];
strncpy(data.AccountID, rowValue.at("AccountID").c_str(), sizeof(TThostFtdcAccountIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorID + "','" + data.CurrencyID + "','" + (data.BizType == 0 ? '0' : data.BizType) + "','" + data.AccountID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcQryTradingAccountField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcQryInvestorFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryInvestorField data;
CThostFtdcQryInvestorFieldWrapper(const CThostFtdcQryInvestorField& _data = { 0 }) :data(_data) { }
CThostFtdcQryInvestorFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryInvestorField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcQryInvestorField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcQryTradingCodeFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryTradingCodeField data;
CThostFtdcQryTradingCodeFieldWrapper(const CThostFtdcQryTradingCodeField& _data = { 0 }) :data(_data) { }
CThostFtdcQryTradingCodeFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryTradingCodeField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.ClientID, rowValue.at("ClientID").c_str(), sizeof(TThostFtdcClientIDType));
data.ClientIDType = rowValue.at("ClientIDType").empty() ? '0' : rowValue.at("ClientIDType")[0];
strncpy(data.InvestUnitID, rowValue.at("InvestUnitID").c_str(), sizeof(TThostFtdcInvestUnitIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorID + "','" + data.ExchangeID + "','" + data.ClientID + "','" + (data.ClientIDType == 0 ? '0' : data.ClientIDType) + "','" + data.InvestUnitID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcQryTradingCodeField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcQryInvestorGroupFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryInvestorGroupField data;
CThostFtdcQryInvestorGroupFieldWrapper(const CThostFtdcQryInvestorGroupField& _data = { 0 }) :data(_data) { }
CThostFtdcQryInvestorGroupFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryInvestorGroupField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcQryInstrumentMarginRateFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryInstrumentMarginRateField data;
CThostFtdcQryInstrumentMarginRateFieldWrapper(const CThostFtdcQryInstrumentMarginRateField& _data = { 0 }) :data(_data) { }
CThostFtdcQryInstrumentMarginRateFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryInstrumentMarginRateField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
data.HedgeFlag = rowValue.at("HedgeFlag").empty() ? '0' : rowValue.at("HedgeFlag")[0];
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.InvestUnitID, rowValue.at("InvestUnitID").c_str(), sizeof(TThostFtdcInvestUnitIDType));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorID + "','" + data.reserve1 + "','" + (data.HedgeFlag == 0 ? '0' : data.HedgeFlag) + "','" + data.ExchangeID + "','" + data.InvestUnitID + "','" + data.InstrumentID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcQryInstrumentMarginRateField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcQryInstrumentCommissionRateFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryInstrumentCommissionRateField data;
CThostFtdcQryInstrumentCommissionRateFieldWrapper(const CThostFtdcQryInstrumentCommissionRateField& _data = { 0 }) :data(_data) { }
CThostFtdcQryInstrumentCommissionRateFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryInstrumentCommissionRateField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.InvestUnitID, rowValue.at("InvestUnitID").c_str(), sizeof(TThostFtdcInvestUnitIDType));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorID + "','" + data.reserve1 + "','" + data.ExchangeID + "','" + data.InvestUnitID + "','" + data.InstrumentID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcQryInstrumentCommissionRateField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcQryInstrumentTradingRightFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryInstrumentTradingRightField data;
CThostFtdcQryInstrumentTradingRightFieldWrapper(const CThostFtdcQryInstrumentTradingRightField& _data = { 0 }) :data(_data) { }
CThostFtdcQryInstrumentTradingRightFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryInstrumentTradingRightField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorID + "','" + data.reserve1 + "','" + data.InstrumentID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcQryInstrumentTradingRightField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcQryBrokerFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryBrokerField data;
CThostFtdcQryBrokerFieldWrapper(const CThostFtdcQryBrokerField& _data = { 0 }) :data(_data) { }
CThostFtdcQryBrokerFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryBrokerField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcQryTraderFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryTraderField data;
CThostFtdcQryTraderFieldWrapper(const CThostFtdcQryTraderField& _data = { 0 }) :data(_data) { }
CThostFtdcQryTraderFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryTraderField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.ParticipantID, rowValue.at("ParticipantID").c_str(), sizeof(TThostFtdcParticipantIDType));
strncpy(data.TraderID, rowValue.at("TraderID").c_str(), sizeof(TThostFtdcTraderIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.ExchangeID + "','" + data.ParticipantID + "','" + data.TraderID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcQrySuperUserFunctionFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQrySuperUserFunctionField data;
CThostFtdcQrySuperUserFunctionFieldWrapper(const CThostFtdcQrySuperUserFunctionField& _data = { 0 }) :data(_data) { }
CThostFtdcQrySuperUserFunctionFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQrySuperUserFunctionField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.UserID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcQryUserSessionFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryUserSessionField data;
CThostFtdcQryUserSessionFieldWrapper(const CThostFtdcQryUserSessionField& _data = { 0 }) :data(_data) { }
CThostFtdcQryUserSessionFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryUserSessionField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
data.FrontID = std::stoi(rowValue.at("FrontID"));
data.SessionID = std::stoi(rowValue.at("SessionID"));
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
std::to_string(data.FrontID) + "','" + std::to_string(data.SessionID) + "','" + data.BrokerID + "','" + data.UserID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.UserID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& UserID) {
return "SELECT * FROM 'CThostFtdcQryUserSessionField' where BrokerID='" + BrokerID + "' and UserID='" + UserID + "';";
}
};
struct CThostFtdcQryPartBrokerFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryPartBrokerField data;
CThostFtdcQryPartBrokerFieldWrapper(const CThostFtdcQryPartBrokerField& _data = { 0 }) :data(_data) { }
CThostFtdcQryPartBrokerFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryPartBrokerField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.ParticipantID, rowValue.at("ParticipantID").c_str(), sizeof(TThostFtdcParticipantIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.ExchangeID + "','" + data.BrokerID + "','" + data.ParticipantID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcQryFrontStatusFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryFrontStatusField data;
CThostFtdcQryFrontStatusFieldWrapper(const CThostFtdcQryFrontStatusField& _data = { 0 }) :data(_data) { }
CThostFtdcQryFrontStatusFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryFrontStatusField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
data.FrontID = std::stoi(rowValue.at("FrontID"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
std::to_string(data.FrontID)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcQryExchangeOrderFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryExchangeOrderField data;
CThostFtdcQryExchangeOrderFieldWrapper(const CThostFtdcQryExchangeOrderField& _data = { 0 }) :data(_data) { }
CThostFtdcQryExchangeOrderFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryExchangeOrderField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.ParticipantID, rowValue.at("ParticipantID").c_str(), sizeof(TThostFtdcParticipantIDType));
strncpy(data.ClientID, rowValue.at("ClientID").c_str(), sizeof(TThostFtdcClientIDType));
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldExchangeInstIDType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.TraderID, rowValue.at("TraderID").c_str(), sizeof(TThostFtdcTraderIDType));
strncpy(data.ExchangeInstID, rowValue.at("ExchangeInstID").c_str(), sizeof(TThostFtdcExchangeInstIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.ParticipantID + "','" + data.ClientID + "','" + data.reserve1 + "','" + data.ExchangeID + "','" + data.TraderID + "','" + data.ExchangeInstID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcQryOrderActionFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryOrderActionField data;
CThostFtdcQryOrderActionFieldWrapper(const CThostFtdcQryOrderActionField& _data = { 0 }) :data(_data) { }
CThostFtdcQryOrderActionFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryOrderActionField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorID + "','" + data.ExchangeID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcQryOrderActionField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcQryExchangeOrderActionFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryExchangeOrderActionField data;
CThostFtdcQryExchangeOrderActionFieldWrapper(const CThostFtdcQryExchangeOrderActionField& _data = { 0 }) :data(_data) { }
CThostFtdcQryExchangeOrderActionFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryExchangeOrderActionField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.ParticipantID, rowValue.at("ParticipantID").c_str(), sizeof(TThostFtdcParticipantIDType));
strncpy(data.ClientID, rowValue.at("ClientID").c_str(), sizeof(TThostFtdcClientIDType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.TraderID, rowValue.at("TraderID").c_str(), sizeof(TThostFtdcTraderIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.ParticipantID + "','" + data.ClientID + "','" + data.ExchangeID + "','" + data.TraderID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcQrySuperUserFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQrySuperUserField data;
CThostFtdcQrySuperUserFieldWrapper(const CThostFtdcQrySuperUserField& _data = { 0 }) :data(_data) { }
CThostFtdcQrySuperUserFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQrySuperUserField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.UserID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcQryExchangeFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryExchangeField data;
CThostFtdcQryExchangeFieldWrapper(const CThostFtdcQryExchangeField& _data = { 0 }) :data(_data) { }
CThostFtdcQryExchangeFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryExchangeField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.ExchangeID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcQryProductFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryProductField data;
CThostFtdcQryProductFieldWrapper(const CThostFtdcQryProductField& _data = { 0 }) :data(_data) { }
CThostFtdcQryProductFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryProductField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
data.ProductClass = rowValue.at("ProductClass").empty() ? '0' : rowValue.at("ProductClass")[0];
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.ProductID, rowValue.at("ProductID").c_str(), sizeof(TThostFtdcInstrumentIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.reserve1 + "','" + (data.ProductClass == 0 ? '0' : data.ProductClass) + "','" + data.ExchangeID + "','" + data.ProductID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcQryInstrumentFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryInstrumentField data;
CThostFtdcQryInstrumentFieldWrapper(const CThostFtdcQryInstrumentField& _data = { 0 }) :data(_data) { }
CThostFtdcQryInstrumentFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryInstrumentField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.reserve2, rowValue.at("reserve2").c_str(), sizeof(TThostFtdcOldExchangeInstIDType));
strncpy(data.reserve3, rowValue.at("reserve3").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
strncpy(data.ExchangeInstID, rowValue.at("ExchangeInstID").c_str(), sizeof(TThostFtdcExchangeInstIDType));
strncpy(data.ProductID, rowValue.at("ProductID").c_str(), sizeof(TThostFtdcInstrumentIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.reserve1 + "','" + data.ExchangeID + "','" + data.reserve2 + "','" + data.reserve3 + "','" + data.InstrumentID + "','" + data.ExchangeInstID + "','" + data.ProductID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcQryDepthMarketDataFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryDepthMarketDataField data;
CThostFtdcQryDepthMarketDataFieldWrapper(const CThostFtdcQryDepthMarketDataField& _data = { 0 }) :data(_data) { }
CThostFtdcQryDepthMarketDataFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryDepthMarketDataField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
data.ProductClass = rowValue.at("ProductClass").empty() ? '0' : rowValue.at("ProductClass")[0];
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.reserve1 + "','" + data.ExchangeID + "','" + data.InstrumentID + "','" + (data.ProductClass == 0 ? '0' : data.ProductClass)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcQryBrokerUserFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryBrokerUserField data;
CThostFtdcQryBrokerUserFieldWrapper(const CThostFtdcQryBrokerUserField& _data = { 0 }) :data(_data) { }
CThostFtdcQryBrokerUserFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryBrokerUserField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.UserID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.UserID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& UserID) {
return "SELECT * FROM 'CThostFtdcQryBrokerUserField' where BrokerID='" + BrokerID + "' and UserID='" + UserID + "';";
}
};
struct CThostFtdcQryBrokerUserFunctionFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryBrokerUserFunctionField data;
CThostFtdcQryBrokerUserFunctionFieldWrapper(const CThostFtdcQryBrokerUserFunctionField& _data = { 0 }) :data(_data) { }
CThostFtdcQryBrokerUserFunctionFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryBrokerUserFunctionField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.UserID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.UserID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& UserID) {
return "SELECT * FROM 'CThostFtdcQryBrokerUserFunctionField' where BrokerID='" + BrokerID + "' and UserID='" + UserID + "';";
}
};
struct CThostFtdcQryTraderOfferFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryTraderOfferField data;
CThostFtdcQryTraderOfferFieldWrapper(const CThostFtdcQryTraderOfferField& _data = { 0 }) :data(_data) { }
CThostFtdcQryTraderOfferFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryTraderOfferField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.ParticipantID, rowValue.at("ParticipantID").c_str(), sizeof(TThostFtdcParticipantIDType));
strncpy(data.TraderID, rowValue.at("TraderID").c_str(), sizeof(TThostFtdcTraderIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.ExchangeID + "','" + data.ParticipantID + "','" + data.TraderID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcQrySyncDepositFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQrySyncDepositField data;
CThostFtdcQrySyncDepositFieldWrapper(const CThostFtdcQrySyncDepositField& _data = { 0 }) :data(_data) { }
CThostFtdcQrySyncDepositFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQrySyncDepositField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.DepositSeqNo, rowValue.at("DepositSeqNo").c_str(), sizeof(TThostFtdcDepositSeqNoType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.DepositSeqNo
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcQrySettlementInfoFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQrySettlementInfoField data;
CThostFtdcQrySettlementInfoFieldWrapper(const CThostFtdcQrySettlementInfoField& _data = { 0 }) :data(_data) { }
CThostFtdcQrySettlementInfoFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQrySettlementInfoField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.AccountID, rowValue.at("AccountID").c_str(), sizeof(TThostFtdcAccountIDType));
strncpy(data.CurrencyID, rowValue.at("CurrencyID").c_str(), sizeof(TThostFtdcCurrencyIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorID + "','" + data.TradingDay + "','" + data.AccountID + "','" + data.CurrencyID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcQrySettlementInfoField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcQryExchangeMarginRateFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryExchangeMarginRateField data;
CThostFtdcQryExchangeMarginRateFieldWrapper(const CThostFtdcQryExchangeMarginRateField& _data = { 0 }) :data(_data) { }
CThostFtdcQryExchangeMarginRateFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryExchangeMarginRateField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
data.HedgeFlag = rowValue.at("HedgeFlag").empty() ? '0' : rowValue.at("HedgeFlag")[0];
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.reserve1 + "','" + (data.HedgeFlag == 0 ? '0' : data.HedgeFlag) + "','" + data.ExchangeID + "','" + data.InstrumentID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcQryExchangeMarginRateAdjustFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryExchangeMarginRateAdjustField data;
CThostFtdcQryExchangeMarginRateAdjustFieldWrapper(const CThostFtdcQryExchangeMarginRateAdjustField& _data = { 0 }) :data(_data) { }
CThostFtdcQryExchangeMarginRateAdjustFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryExchangeMarginRateAdjustField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
data.HedgeFlag = rowValue.at("HedgeFlag").empty() ? '0' : rowValue.at("HedgeFlag")[0];
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.reserve1 + "','" + (data.HedgeFlag == 0 ? '0' : data.HedgeFlag) + "','" + data.InstrumentID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcQryExchangeRateFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryExchangeRateField data;
CThostFtdcQryExchangeRateFieldWrapper(const CThostFtdcQryExchangeRateField& _data = { 0 }) :data(_data) { }
CThostFtdcQryExchangeRateFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryExchangeRateField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.FromCurrencyID, rowValue.at("FromCurrencyID").c_str(), sizeof(TThostFtdcCurrencyIDType));
strncpy(data.ToCurrencyID, rowValue.at("ToCurrencyID").c_str(), sizeof(TThostFtdcCurrencyIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.FromCurrencyID + "','" + data.ToCurrencyID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcQrySyncFundMortgageFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQrySyncFundMortgageField data;
CThostFtdcQrySyncFundMortgageFieldWrapper(const CThostFtdcQrySyncFundMortgageField& _data = { 0 }) :data(_data) { }
CThostFtdcQrySyncFundMortgageFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQrySyncFundMortgageField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.MortgageSeqNo, rowValue.at("MortgageSeqNo").c_str(), sizeof(TThostFtdcDepositSeqNoType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.MortgageSeqNo
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcQryHisOrderFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryHisOrderField data;
CThostFtdcQryHisOrderFieldWrapper(const CThostFtdcQryHisOrderField& _data = { 0 }) :data(_data) { }
CThostFtdcQryHisOrderFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryHisOrderField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.OrderSysID, rowValue.at("OrderSysID").c_str(), sizeof(TThostFtdcOrderSysIDType));
strncpy(data.InsertTimeStart, rowValue.at("InsertTimeStart").c_str(), sizeof(TThostFtdcTimeType));
strncpy(data.InsertTimeEnd, rowValue.at("InsertTimeEnd").c_str(), sizeof(TThostFtdcTimeType));
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcDateType));
data.SettlementID = std::stoi(rowValue.at("SettlementID"));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorID + "','" + data.reserve1 + "','" + data.ExchangeID + "','" + data.OrderSysID + "','" + data.InsertTimeStart + "','" + data.InsertTimeEnd + "','" + data.TradingDay + "','" + std::to_string(data.SettlementID) + "','" + data.InstrumentID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcQryHisOrderField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcOptionInstrMiniMarginFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcOptionInstrMiniMarginField data;
CThostFtdcOptionInstrMiniMarginFieldWrapper(const CThostFtdcOptionInstrMiniMarginField& _data = { 0 }) :data(_data) { }
CThostFtdcOptionInstrMiniMarginFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcOptionInstrMiniMarginField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
data.InvestorRange = rowValue.at("InvestorRange").empty() ? '0' : rowValue.at("InvestorRange")[0];
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
data.MinMargin = std::stod(rowValue.at("MinMargin"));
data.ValueMethod = rowValue.at("ValueMethod").empty() ? '0' : rowValue.at("ValueMethod")[0];
data.IsRelative = std::stoi(rowValue.at("IsRelative"));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.reserve1 + "','" + (data.InvestorRange == 0 ? '0' : data.InvestorRange) + "','" + data.BrokerID + "','" + data.InvestorID + "','" + std::to_string(data.MinMargin) + "','" + (data.ValueMethod == 0 ? '0' : data.ValueMethod) + "','" + std::to_string(data.IsRelative) + "','" + data.InstrumentID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcOptionInstrMiniMarginField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcOptionInstrMarginAdjustFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcOptionInstrMarginAdjustField data;
CThostFtdcOptionInstrMarginAdjustFieldWrapper(const CThostFtdcOptionInstrMarginAdjustField& _data = { 0 }) :data(_data) { }
CThostFtdcOptionInstrMarginAdjustFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcOptionInstrMarginAdjustField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
data.InvestorRange = rowValue.at("InvestorRange").empty() ? '0' : rowValue.at("InvestorRange")[0];
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
data.SShortMarginRatioByMoney = std::stod(rowValue.at("SShortMarginRatioByMoney"));
data.SShortMarginRatioByVolume = std::stod(rowValue.at("SShortMarginRatioByVolume"));
data.HShortMarginRatioByMoney = std::stod(rowValue.at("HShortMarginRatioByMoney"));
data.HShortMarginRatioByVolume = std::stod(rowValue.at("HShortMarginRatioByVolume"));
data.AShortMarginRatioByMoney = std::stod(rowValue.at("AShortMarginRatioByMoney"));
data.AShortMarginRatioByVolume = std::stod(rowValue.at("AShortMarginRatioByVolume"));
data.IsRelative = std::stoi(rowValue.at("IsRelative"));
data.MShortMarginRatioByMoney = std::stod(rowValue.at("MShortMarginRatioByMoney"));
data.MShortMarginRatioByVolume = std::stod(rowValue.at("MShortMarginRatioByVolume"));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.reserve1 + "','" + (data.InvestorRange == 0 ? '0' : data.InvestorRange) + "','" + data.BrokerID + "','" + data.InvestorID + "','" + std::to_string(data.SShortMarginRatioByMoney) + "','" + std::to_string(data.SShortMarginRatioByVolume) + "','" + std::to_string(data.HShortMarginRatioByMoney) + "','" + std::to_string(data.HShortMarginRatioByVolume) + "','" + std::to_string(data.AShortMarginRatioByMoney) + "','" + std::to_string(data.AShortMarginRatioByVolume) + "','" + std::to_string(data.IsRelative) + "','" + std::to_string(data.MShortMarginRatioByMoney) + "','" + std::to_string(data.MShortMarginRatioByVolume) + "','" + data.InstrumentID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcOptionInstrMarginAdjustField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcOptionInstrCommRateFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcOptionInstrCommRateField data;
CThostFtdcOptionInstrCommRateFieldWrapper(const CThostFtdcOptionInstrCommRateField& _data = { 0 }) :data(_data) { }
CThostFtdcOptionInstrCommRateFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcOptionInstrCommRateField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
data.InvestorRange = rowValue.at("InvestorRange").empty() ? '0' : rowValue.at("InvestorRange")[0];
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
data.OpenRatioByMoney = std::stod(rowValue.at("OpenRatioByMoney"));
data.OpenRatioByVolume = std::stod(rowValue.at("OpenRatioByVolume"));
data.CloseRatioByMoney = std::stod(rowValue.at("CloseRatioByMoney"));
data.CloseRatioByVolume = std::stod(rowValue.at("CloseRatioByVolume"));
data.CloseTodayRatioByMoney = std::stod(rowValue.at("CloseTodayRatioByMoney"));
data.CloseTodayRatioByVolume = std::stod(rowValue.at("CloseTodayRatioByVolume"));
data.StrikeRatioByMoney = std::stod(rowValue.at("StrikeRatioByMoney"));
data.StrikeRatioByVolume = std::stod(rowValue.at("StrikeRatioByVolume"));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.InvestUnitID, rowValue.at("InvestUnitID").c_str(), sizeof(TThostFtdcInvestUnitIDType));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.reserve1 + "','" + (data.InvestorRange == 0 ? '0' : data.InvestorRange) + "','" + data.BrokerID + "','" + data.InvestorID + "','" + std::to_string(data.OpenRatioByMoney) + "','" + std::to_string(data.OpenRatioByVolume) + "','" + std::to_string(data.CloseRatioByMoney) + "','" + std::to_string(data.CloseRatioByVolume) + "','" + std::to_string(data.CloseTodayRatioByMoney) + "','" + std::to_string(data.CloseTodayRatioByVolume) + "','" + std::to_string(data.StrikeRatioByMoney) + "','" + std::to_string(data.StrikeRatioByVolume) + "','" + data.ExchangeID + "','" + data.InvestUnitID + "','" + data.InstrumentID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcOptionInstrCommRateField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcOptionInstrTradeCostFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcOptionInstrTradeCostField data;
CThostFtdcOptionInstrTradeCostFieldWrapper(const CThostFtdcOptionInstrTradeCostField& _data = { 0 }) :data(_data) { }
CThostFtdcOptionInstrTradeCostFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcOptionInstrTradeCostField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
data.HedgeFlag = rowValue.at("HedgeFlag").empty() ? '0' : rowValue.at("HedgeFlag")[0];
data.FixedMargin = std::stod(rowValue.at("FixedMargin"));
data.MiniMargin = std::stod(rowValue.at("MiniMargin"));
data.Royalty = std::stod(rowValue.at("Royalty"));
data.ExchFixedMargin = std::stod(rowValue.at("ExchFixedMargin"));
data.ExchMiniMargin = std::stod(rowValue.at("ExchMiniMargin"));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.InvestUnitID, rowValue.at("InvestUnitID").c_str(), sizeof(TThostFtdcInvestUnitIDType));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorID + "','" + data.reserve1 + "','" + (data.HedgeFlag == 0 ? '0' : data.HedgeFlag) + "','" + std::to_string(data.FixedMargin) + "','" + std::to_string(data.MiniMargin) + "','" + std::to_string(data.Royalty) + "','" + std::to_string(data.ExchFixedMargin) + "','" + std::to_string(data.ExchMiniMargin) + "','" + data.ExchangeID + "','" + data.InvestUnitID + "','" + data.InstrumentID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcOptionInstrTradeCostField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcQryOptionInstrTradeCostFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryOptionInstrTradeCostField data;
CThostFtdcQryOptionInstrTradeCostFieldWrapper(const CThostFtdcQryOptionInstrTradeCostField& _data = { 0 }) :data(_data) { }
CThostFtdcQryOptionInstrTradeCostFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryOptionInstrTradeCostField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
data.HedgeFlag = rowValue.at("HedgeFlag").empty() ? '0' : rowValue.at("HedgeFlag")[0];
data.InputPrice = std::stod(rowValue.at("InputPrice"));
data.UnderlyingPrice = std::stod(rowValue.at("UnderlyingPrice"));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.InvestUnitID, rowValue.at("InvestUnitID").c_str(), sizeof(TThostFtdcInvestUnitIDType));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorID + "','" + data.reserve1 + "','" + (data.HedgeFlag == 0 ? '0' : data.HedgeFlag) + "','" + std::to_string(data.InputPrice) + "','" + std::to_string(data.UnderlyingPrice) + "','" + data.ExchangeID + "','" + data.InvestUnitID + "','" + data.InstrumentID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcQryOptionInstrTradeCostField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcQryOptionInstrCommRateFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryOptionInstrCommRateField data;
CThostFtdcQryOptionInstrCommRateFieldWrapper(const CThostFtdcQryOptionInstrCommRateField& _data = { 0 }) :data(_data) { }
CThostFtdcQryOptionInstrCommRateFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryOptionInstrCommRateField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.InvestUnitID, rowValue.at("InvestUnitID").c_str(), sizeof(TThostFtdcInvestUnitIDType));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorID + "','" + data.reserve1 + "','" + data.ExchangeID + "','" + data.InvestUnitID + "','" + data.InstrumentID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcQryOptionInstrCommRateField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcIndexPriceFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcIndexPriceField data;
CThostFtdcIndexPriceFieldWrapper(const CThostFtdcIndexPriceField& _data = { 0 }) :data(_data) { }
CThostFtdcIndexPriceFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcIndexPriceField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
data.ClosePrice = std::stod(rowValue.at("ClosePrice"));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.reserve1 + "','" + std::to_string(data.ClosePrice) + "','" + data.InstrumentID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcInputExecOrderFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcInputExecOrderField data;
CThostFtdcInputExecOrderFieldWrapper(const CThostFtdcInputExecOrderField& _data = { 0 }) :data(_data) { }
CThostFtdcInputExecOrderFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcInputExecOrderField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
strncpy(data.ExecOrderRef, rowValue.at("ExecOrderRef").c_str(), sizeof(TThostFtdcOrderRefType));
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
data.Volume = std::stoi(rowValue.at("Volume"));
data.RequestID = std::stoi(rowValue.at("RequestID"));
strncpy(data.BusinessUnit, rowValue.at("BusinessUnit").c_str(), sizeof(TThostFtdcBusinessUnitType));
data.OffsetFlag = rowValue.at("OffsetFlag").empty() ? '0' : rowValue.at("OffsetFlag")[0];
data.HedgeFlag = rowValue.at("HedgeFlag").empty() ? '0' : rowValue.at("HedgeFlag")[0];
data.ActionType = rowValue.at("ActionType").empty() ? '0' : rowValue.at("ActionType")[0];
data.PosiDirection = rowValue.at("PosiDirection").empty() ? '0' : rowValue.at("PosiDirection")[0];
data.ReservePositionFlag = rowValue.at("ReservePositionFlag").empty() ? '0' : rowValue.at("ReservePositionFlag")[0];
data.CloseFlag = rowValue.at("CloseFlag").empty() ? '0' : rowValue.at("CloseFlag")[0];
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.InvestUnitID, rowValue.at("InvestUnitID").c_str(), sizeof(TThostFtdcInvestUnitIDType));
strncpy(data.AccountID, rowValue.at("AccountID").c_str(), sizeof(TThostFtdcAccountIDType));
strncpy(data.CurrencyID, rowValue.at("CurrencyID").c_str(), sizeof(TThostFtdcCurrencyIDType));
strncpy(data.ClientID, rowValue.at("ClientID").c_str(), sizeof(TThostFtdcClientIDType));
strncpy(data.reserve2, rowValue.at("reserve2").c_str(), sizeof(TThostFtdcOldIPAddressType));
strncpy(data.MacAddress, rowValue.at("MacAddress").c_str(), sizeof(TThostFtdcMacAddressType));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
strncpy(data.IPAddress, rowValue.at("IPAddress").c_str(), sizeof(TThostFtdcIPAddressType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorID + "','" + data.reserve1 + "','" + data.ExecOrderRef + "','" + data.UserID + "','" + std::to_string(data.Volume) + "','" + std::to_string(data.RequestID) + "','" + data.BusinessUnit + "','" + (data.OffsetFlag == 0 ? '0' : data.OffsetFlag) + "','" + (data.HedgeFlag == 0 ? '0' : data.HedgeFlag) + "','" + (data.ActionType == 0 ? '0' : data.ActionType) + "','" + (data.PosiDirection == 0 ? '0' : data.PosiDirection) + "','" + (data.ReservePositionFlag == 0 ? '0' : data.ReservePositionFlag) + "','" + (data.CloseFlag == 0 ? '0' : data.CloseFlag) + "','" + data.ExchangeID + "','" + data.InvestUnitID + "','" + data.AccountID + "','" + data.CurrencyID + "','" + data.ClientID + "','" + data.reserve2 + "','" + data.MacAddress + "','" + data.InstrumentID + "','" + data.IPAddress
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcInputExecOrderField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcInputExecOrderActionFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcInputExecOrderActionField data;
CThostFtdcInputExecOrderActionFieldWrapper(const CThostFtdcInputExecOrderActionField& _data = { 0 }) :data(_data) { }
CThostFtdcInputExecOrderActionFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcInputExecOrderActionField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
data.ExecOrderActionRef = std::stoi(rowValue.at("ExecOrderActionRef"));
strncpy(data.ExecOrderRef, rowValue.at("ExecOrderRef").c_str(), sizeof(TThostFtdcOrderRefType));
data.RequestID = std::stoi(rowValue.at("RequestID"));
data.FrontID = std::stoi(rowValue.at("FrontID"));
data.SessionID = std::stoi(rowValue.at("SessionID"));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.ExecOrderSysID, rowValue.at("ExecOrderSysID").c_str(), sizeof(TThostFtdcExecOrderSysIDType));
data.ActionFlag = rowValue.at("ActionFlag").empty() ? '0' : rowValue.at("ActionFlag")[0];
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
strncpy(data.InvestUnitID, rowValue.at("InvestUnitID").c_str(), sizeof(TThostFtdcInvestUnitIDType));
strncpy(data.reserve2, rowValue.at("reserve2").c_str(), sizeof(TThostFtdcOldIPAddressType));
strncpy(data.MacAddress, rowValue.at("MacAddress").c_str(), sizeof(TThostFtdcMacAddressType));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
strncpy(data.IPAddress, rowValue.at("IPAddress").c_str(), sizeof(TThostFtdcIPAddressType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorID + "','" + std::to_string(data.ExecOrderActionRef) + "','" + data.ExecOrderRef + "','" + std::to_string(data.RequestID) + "','" + std::to_string(data.FrontID) + "','" + std::to_string(data.SessionID) + "','" + data.ExchangeID + "','" + data.ExecOrderSysID + "','" + (data.ActionFlag == 0 ? '0' : data.ActionFlag) + "','" + data.UserID + "','" + data.reserve1 + "','" + data.InvestUnitID + "','" + data.reserve2 + "','" + data.MacAddress + "','" + data.InstrumentID + "','" + data.IPAddress
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcInputExecOrderActionField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcExecOrderFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcExecOrderField data;
CThostFtdcExecOrderFieldWrapper(const CThostFtdcExecOrderField& _data = { 0 }) :data(_data) { }
CThostFtdcExecOrderFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcExecOrderField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
strncpy(data.ExecOrderRef, rowValue.at("ExecOrderRef").c_str(), sizeof(TThostFtdcOrderRefType));
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
data.Volume = std::stoi(rowValue.at("Volume"));
data.RequestID = std::stoi(rowValue.at("RequestID"));
strncpy(data.BusinessUnit, rowValue.at("BusinessUnit").c_str(), sizeof(TThostFtdcBusinessUnitType));
data.OffsetFlag = rowValue.at("OffsetFlag").empty() ? '0' : rowValue.at("OffsetFlag")[0];
data.HedgeFlag = rowValue.at("HedgeFlag").empty() ? '0' : rowValue.at("HedgeFlag")[0];
data.ActionType = rowValue.at("ActionType").empty() ? '0' : rowValue.at("ActionType")[0];
data.PosiDirection = rowValue.at("PosiDirection").empty() ? '0' : rowValue.at("PosiDirection")[0];
data.ReservePositionFlag = rowValue.at("ReservePositionFlag").empty() ? '0' : rowValue.at("ReservePositionFlag")[0];
data.CloseFlag = rowValue.at("CloseFlag").empty() ? '0' : rowValue.at("CloseFlag")[0];
strncpy(data.ExecOrderLocalID, rowValue.at("ExecOrderLocalID").c_str(), sizeof(TThostFtdcOrderLocalIDType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.ParticipantID, rowValue.at("ParticipantID").c_str(), sizeof(TThostFtdcParticipantIDType));
strncpy(data.ClientID, rowValue.at("ClientID").c_str(), sizeof(TThostFtdcClientIDType));
strncpy(data.reserve2, rowValue.at("reserve2").c_str(), sizeof(TThostFtdcOldExchangeInstIDType));
strncpy(data.TraderID, rowValue.at("TraderID").c_str(), sizeof(TThostFtdcTraderIDType));
data.InstallID = std::stoi(rowValue.at("InstallID"));
data.OrderSubmitStatus = rowValue.at("OrderSubmitStatus").empty() ? '0' : rowValue.at("OrderSubmitStatus")[0];
data.NotifySequence = std::stoi(rowValue.at("NotifySequence"));
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcDateType));
data.SettlementID = std::stoi(rowValue.at("SettlementID"));
strncpy(data.ExecOrderSysID, rowValue.at("ExecOrderSysID").c_str(), sizeof(TThostFtdcExecOrderSysIDType));
strncpy(data.InsertDate, rowValue.at("InsertDate").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.InsertTime, rowValue.at("InsertTime").c_str(), sizeof(TThostFtdcTimeType));
strncpy(data.CancelTime, rowValue.at("CancelTime").c_str(), sizeof(TThostFtdcTimeType));
data.ExecResult = rowValue.at("ExecResult").empty() ? '0' : rowValue.at("ExecResult")[0];
strncpy(data.ClearingPartID, rowValue.at("ClearingPartID").c_str(), sizeof(TThostFtdcParticipantIDType));
data.SequenceNo = std::stoi(rowValue.at("SequenceNo"));
data.FrontID = std::stoi(rowValue.at("FrontID"));
data.SessionID = std::stoi(rowValue.at("SessionID"));
strncpy(data.UserProductInfo, rowValue.at("UserProductInfo").c_str(), sizeof(TThostFtdcProductInfoType));
strncpy(data.StatusMsg, utf8_to_gbk(rowValue.at("StatusMsg")).c_str(), sizeof(TThostFtdcErrorMsgType));
strncpy(data.ActiveUserID, rowValue.at("ActiveUserID").c_str(), sizeof(TThostFtdcUserIDType));
data.BrokerExecOrderSeq = std::stoi(rowValue.at("BrokerExecOrderSeq"));
strncpy(data.BranchID, rowValue.at("BranchID").c_str(), sizeof(TThostFtdcBranchIDType));
strncpy(data.InvestUnitID, rowValue.at("InvestUnitID").c_str(), sizeof(TThostFtdcInvestUnitIDType));
strncpy(data.AccountID, rowValue.at("AccountID").c_str(), sizeof(TThostFtdcAccountIDType));
strncpy(data.CurrencyID, rowValue.at("CurrencyID").c_str(), sizeof(TThostFtdcCurrencyIDType));
strncpy(data.reserve3, rowValue.at("reserve3").c_str(), sizeof(TThostFtdcOldIPAddressType));
strncpy(data.MacAddress, rowValue.at("MacAddress").c_str(), sizeof(TThostFtdcMacAddressType));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
strncpy(data.ExchangeInstID, rowValue.at("ExchangeInstID").c_str(), sizeof(TThostFtdcExchangeInstIDType));
strncpy(data.IPAddress, rowValue.at("IPAddress").c_str(), sizeof(TThostFtdcIPAddressType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorID + "','" + data.reserve1 + "','" + data.ExecOrderRef + "','" + data.UserID + "','" + std::to_string(data.Volume) + "','" + std::to_string(data.RequestID) + "','" + data.BusinessUnit + "','" + (data.OffsetFlag == 0 ? '0' : data.OffsetFlag) + "','" + (data.HedgeFlag == 0 ? '0' : data.HedgeFlag) + "','" + (data.ActionType == 0 ? '0' : data.ActionType) + "','" + (data.PosiDirection == 0 ? '0' : data.PosiDirection) + "','" + (data.ReservePositionFlag == 0 ? '0' : data.ReservePositionFlag) + "','" + (data.CloseFlag == 0 ? '0' : data.CloseFlag) + "','" + data.ExecOrderLocalID + "','" + data.ExchangeID + "','" + data.ParticipantID + "','" + data.ClientID + "','" + data.reserve2 + "','" + data.TraderID + "','" + std::to_string(data.InstallID) + "','" + (data.OrderSubmitStatus == 0 ? '0' : data.OrderSubmitStatus) + "','" + std::to_string(data.NotifySequence) + "','" + data.TradingDay + "','" + std::to_string(data.SettlementID) + "','" + data.ExecOrderSysID + "','" + data.InsertDate + "','" + data.InsertTime + "','" + data.CancelTime + "','" + (data.ExecResult == 0 ? '0' : data.ExecResult) + "','" + data.ClearingPartID + "','" + std::to_string(data.SequenceNo) + "','" + std::to_string(data.FrontID) + "','" + std::to_string(data.SessionID) + "','" + data.UserProductInfo + "','" + gbk_to_utf8(data.StatusMsg) + "','" + data.ActiveUserID + "','" + std::to_string(data.BrokerExecOrderSeq) + "','" + data.BranchID + "','" + data.InvestUnitID + "','" + data.AccountID + "','" + data.CurrencyID + "','" + data.reserve3 + "','" + data.MacAddress + "','" + data.InstrumentID + "','" + data.ExchangeInstID + "','" + data.IPAddress
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcExecOrderField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcExecOrderActionFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcExecOrderActionField data;
CThostFtdcExecOrderActionFieldWrapper(const CThostFtdcExecOrderActionField& _data = { 0 }) :data(_data) { }
CThostFtdcExecOrderActionFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcExecOrderActionField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
data.ExecOrderActionRef = std::stoi(rowValue.at("ExecOrderActionRef"));
strncpy(data.ExecOrderRef, rowValue.at("ExecOrderRef").c_str(), sizeof(TThostFtdcOrderRefType));
data.RequestID = std::stoi(rowValue.at("RequestID"));
data.FrontID = std::stoi(rowValue.at("FrontID"));
data.SessionID = std::stoi(rowValue.at("SessionID"));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.ExecOrderSysID, rowValue.at("ExecOrderSysID").c_str(), sizeof(TThostFtdcExecOrderSysIDType));
data.ActionFlag = rowValue.at("ActionFlag").empty() ? '0' : rowValue.at("ActionFlag")[0];
strncpy(data.ActionDate, rowValue.at("ActionDate").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.ActionTime, rowValue.at("ActionTime").c_str(), sizeof(TThostFtdcTimeType));
strncpy(data.TraderID, rowValue.at("TraderID").c_str(), sizeof(TThostFtdcTraderIDType));
data.InstallID = std::stoi(rowValue.at("InstallID"));
strncpy(data.ExecOrderLocalID, rowValue.at("ExecOrderLocalID").c_str(), sizeof(TThostFtdcOrderLocalIDType));
strncpy(data.ActionLocalID, rowValue.at("ActionLocalID").c_str(), sizeof(TThostFtdcOrderLocalIDType));
strncpy(data.ParticipantID, rowValue.at("ParticipantID").c_str(), sizeof(TThostFtdcParticipantIDType));
strncpy(data.ClientID, rowValue.at("ClientID").c_str(), sizeof(TThostFtdcClientIDType));
strncpy(data.BusinessUnit, rowValue.at("BusinessUnit").c_str(), sizeof(TThostFtdcBusinessUnitType));
data.OrderActionStatus = rowValue.at("OrderActionStatus").empty() ? '0' : rowValue.at("OrderActionStatus")[0];
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
data.ActionType = rowValue.at("ActionType").empty() ? '0' : rowValue.at("ActionType")[0];
strncpy(data.StatusMsg, utf8_to_gbk(rowValue.at("StatusMsg")).c_str(), sizeof(TThostFtdcErrorMsgType));
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
strncpy(data.BranchID, rowValue.at("BranchID").c_str(), sizeof(TThostFtdcBranchIDType));
strncpy(data.InvestUnitID, rowValue.at("InvestUnitID").c_str(), sizeof(TThostFtdcInvestUnitIDType));
strncpy(data.reserve2, rowValue.at("reserve2").c_str(), sizeof(TThostFtdcOldIPAddressType));
strncpy(data.MacAddress, rowValue.at("MacAddress").c_str(), sizeof(TThostFtdcMacAddressType));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
strncpy(data.IPAddress, rowValue.at("IPAddress").c_str(), sizeof(TThostFtdcIPAddressType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorID + "','" + std::to_string(data.ExecOrderActionRef) + "','" + data.ExecOrderRef + "','" + std::to_string(data.RequestID) + "','" + std::to_string(data.FrontID) + "','" + std::to_string(data.SessionID) + "','" + data.ExchangeID + "','" + data.ExecOrderSysID + "','" + (data.ActionFlag == 0 ? '0' : data.ActionFlag) + "','" + data.ActionDate + "','" + data.ActionTime + "','" + data.TraderID + "','" + std::to_string(data.InstallID) + "','" + data.ExecOrderLocalID + "','" + data.ActionLocalID + "','" + data.ParticipantID + "','" + data.ClientID + "','" + data.BusinessUnit + "','" + (data.OrderActionStatus == 0 ? '0' : data.OrderActionStatus) + "','" + data.UserID + "','" + (data.ActionType == 0 ? '0' : data.ActionType) + "','" + gbk_to_utf8(data.StatusMsg) + "','" + data.reserve1 + "','" + data.BranchID + "','" + data.InvestUnitID + "','" + data.reserve2 + "','" + data.MacAddress + "','" + data.InstrumentID + "','" + data.IPAddress
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcExecOrderActionField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcQryExecOrderFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryExecOrderField data;
CThostFtdcQryExecOrderFieldWrapper(const CThostFtdcQryExecOrderField& _data = { 0 }) :data(_data) { }
CThostFtdcQryExecOrderFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryExecOrderField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.ExecOrderSysID, rowValue.at("ExecOrderSysID").c_str(), sizeof(TThostFtdcExecOrderSysIDType));
strncpy(data.InsertTimeStart, rowValue.at("InsertTimeStart").c_str(), sizeof(TThostFtdcTimeType));
strncpy(data.InsertTimeEnd, rowValue.at("InsertTimeEnd").c_str(), sizeof(TThostFtdcTimeType));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorID + "','" + data.reserve1 + "','" + data.ExchangeID + "','" + data.ExecOrderSysID + "','" + data.InsertTimeStart + "','" + data.InsertTimeEnd + "','" + data.InstrumentID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcQryExecOrderField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcExchangeExecOrderFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcExchangeExecOrderField data;
CThostFtdcExchangeExecOrderFieldWrapper(const CThostFtdcExchangeExecOrderField& _data = { 0 }) :data(_data) { }
CThostFtdcExchangeExecOrderFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcExchangeExecOrderField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
data.Volume = std::stoi(rowValue.at("Volume"));
data.RequestID = std::stoi(rowValue.at("RequestID"));
strncpy(data.BusinessUnit, rowValue.at("BusinessUnit").c_str(), sizeof(TThostFtdcBusinessUnitType));
data.OffsetFlag = rowValue.at("OffsetFlag").empty() ? '0' : rowValue.at("OffsetFlag")[0];
data.HedgeFlag = rowValue.at("HedgeFlag").empty() ? '0' : rowValue.at("HedgeFlag")[0];
data.ActionType = rowValue.at("ActionType").empty() ? '0' : rowValue.at("ActionType")[0];
data.PosiDirection = rowValue.at("PosiDirection").empty() ? '0' : rowValue.at("PosiDirection")[0];
data.ReservePositionFlag = rowValue.at("ReservePositionFlag").empty() ? '0' : rowValue.at("ReservePositionFlag")[0];
data.CloseFlag = rowValue.at("CloseFlag").empty() ? '0' : rowValue.at("CloseFlag")[0];
strncpy(data.ExecOrderLocalID, rowValue.at("ExecOrderLocalID").c_str(), sizeof(TThostFtdcOrderLocalIDType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.ParticipantID, rowValue.at("ParticipantID").c_str(), sizeof(TThostFtdcParticipantIDType));
strncpy(data.ClientID, rowValue.at("ClientID").c_str(), sizeof(TThostFtdcClientIDType));
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldExchangeInstIDType));
strncpy(data.TraderID, rowValue.at("TraderID").c_str(), sizeof(TThostFtdcTraderIDType));
data.InstallID = std::stoi(rowValue.at("InstallID"));
data.OrderSubmitStatus = rowValue.at("OrderSubmitStatus").empty() ? '0' : rowValue.at("OrderSubmitStatus")[0];
data.NotifySequence = std::stoi(rowValue.at("NotifySequence"));
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcDateType));
data.SettlementID = std::stoi(rowValue.at("SettlementID"));
strncpy(data.ExecOrderSysID, rowValue.at("ExecOrderSysID").c_str(), sizeof(TThostFtdcExecOrderSysIDType));
strncpy(data.InsertDate, rowValue.at("InsertDate").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.InsertTime, rowValue.at("InsertTime").c_str(), sizeof(TThostFtdcTimeType));
strncpy(data.CancelTime, rowValue.at("CancelTime").c_str(), sizeof(TThostFtdcTimeType));
data.ExecResult = rowValue.at("ExecResult").empty() ? '0' : rowValue.at("ExecResult")[0];
strncpy(data.ClearingPartID, rowValue.at("ClearingPartID").c_str(), sizeof(TThostFtdcParticipantIDType));
data.SequenceNo = std::stoi(rowValue.at("SequenceNo"));
strncpy(data.BranchID, rowValue.at("BranchID").c_str(), sizeof(TThostFtdcBranchIDType));
strncpy(data.reserve2, rowValue.at("reserve2").c_str(), sizeof(TThostFtdcOldIPAddressType));
strncpy(data.MacAddress, rowValue.at("MacAddress").c_str(), sizeof(TThostFtdcMacAddressType));
strncpy(data.ExchangeInstID, rowValue.at("ExchangeInstID").c_str(), sizeof(TThostFtdcExchangeInstIDType));
strncpy(data.IPAddress, rowValue.at("IPAddress").c_str(), sizeof(TThostFtdcIPAddressType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
std::to_string(data.Volume) + "','" + std::to_string(data.RequestID) + "','" + data.BusinessUnit + "','" + (data.OffsetFlag == 0 ? '0' : data.OffsetFlag) + "','" + (data.HedgeFlag == 0 ? '0' : data.HedgeFlag) + "','" + (data.ActionType == 0 ? '0' : data.ActionType) + "','" + (data.PosiDirection == 0 ? '0' : data.PosiDirection) + "','" + (data.ReservePositionFlag == 0 ? '0' : data.ReservePositionFlag) + "','" + (data.CloseFlag == 0 ? '0' : data.CloseFlag) + "','" + data.ExecOrderLocalID + "','" + data.ExchangeID + "','" + data.ParticipantID + "','" + data.ClientID + "','" + data.reserve1 + "','" + data.TraderID + "','" + std::to_string(data.InstallID) + "','" + (data.OrderSubmitStatus == 0 ? '0' : data.OrderSubmitStatus) + "','" + std::to_string(data.NotifySequence) + "','" + data.TradingDay + "','" + std::to_string(data.SettlementID) + "','" + data.ExecOrderSysID + "','" + data.InsertDate + "','" + data.InsertTime + "','" + data.CancelTime + "','" + (data.ExecResult == 0 ? '0' : data.ExecResult) + "','" + data.ClearingPartID + "','" + std::to_string(data.SequenceNo) + "','" + data.BranchID + "','" + data.reserve2 + "','" + data.MacAddress + "','" + data.ExchangeInstID + "','" + data.IPAddress
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcQryExchangeExecOrderFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryExchangeExecOrderField data;
CThostFtdcQryExchangeExecOrderFieldWrapper(const CThostFtdcQryExchangeExecOrderField& _data = { 0 }) :data(_data) { }
CThostFtdcQryExchangeExecOrderFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryExchangeExecOrderField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.ParticipantID, rowValue.at("ParticipantID").c_str(), sizeof(TThostFtdcParticipantIDType));
strncpy(data.ClientID, rowValue.at("ClientID").c_str(), sizeof(TThostFtdcClientIDType));
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldExchangeInstIDType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.TraderID, rowValue.at("TraderID").c_str(), sizeof(TThostFtdcTraderIDType));
strncpy(data.ExchangeInstID, rowValue.at("ExchangeInstID").c_str(), sizeof(TThostFtdcExchangeInstIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.ParticipantID + "','" + data.ClientID + "','" + data.reserve1 + "','" + data.ExchangeID + "','" + data.TraderID + "','" + data.ExchangeInstID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcQryExecOrderActionFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryExecOrderActionField data;
CThostFtdcQryExecOrderActionFieldWrapper(const CThostFtdcQryExecOrderActionField& _data = { 0 }) :data(_data) { }
CThostFtdcQryExecOrderActionFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryExecOrderActionField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorID + "','" + data.ExchangeID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcQryExecOrderActionField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcExchangeExecOrderActionFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcExchangeExecOrderActionField data;
CThostFtdcExchangeExecOrderActionFieldWrapper(const CThostFtdcExchangeExecOrderActionField& _data = { 0 }) :data(_data) { }
CThostFtdcExchangeExecOrderActionFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcExchangeExecOrderActionField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.ExecOrderSysID, rowValue.at("ExecOrderSysID").c_str(), sizeof(TThostFtdcExecOrderSysIDType));
data.ActionFlag = rowValue.at("ActionFlag").empty() ? '0' : rowValue.at("ActionFlag")[0];
strncpy(data.ActionDate, rowValue.at("ActionDate").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.ActionTime, rowValue.at("ActionTime").c_str(), sizeof(TThostFtdcTimeType));
strncpy(data.TraderID, rowValue.at("TraderID").c_str(), sizeof(TThostFtdcTraderIDType));
data.InstallID = std::stoi(rowValue.at("InstallID"));
strncpy(data.ExecOrderLocalID, rowValue.at("ExecOrderLocalID").c_str(), sizeof(TThostFtdcOrderLocalIDType));
strncpy(data.ActionLocalID, rowValue.at("ActionLocalID").c_str(), sizeof(TThostFtdcOrderLocalIDType));
strncpy(data.ParticipantID, rowValue.at("ParticipantID").c_str(), sizeof(TThostFtdcParticipantIDType));
strncpy(data.ClientID, rowValue.at("ClientID").c_str(), sizeof(TThostFtdcClientIDType));
strncpy(data.BusinessUnit, rowValue.at("BusinessUnit").c_str(), sizeof(TThostFtdcBusinessUnitType));
data.OrderActionStatus = rowValue.at("OrderActionStatus").empty() ? '0' : rowValue.at("OrderActionStatus")[0];
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
data.ActionType = rowValue.at("ActionType").empty() ? '0' : rowValue.at("ActionType")[0];
strncpy(data.BranchID, rowValue.at("BranchID").c_str(), sizeof(TThostFtdcBranchIDType));
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldIPAddressType));
strncpy(data.MacAddress, rowValue.at("MacAddress").c_str(), sizeof(TThostFtdcMacAddressType));
strncpy(data.reserve2, rowValue.at("reserve2").c_str(), sizeof(TThostFtdcOldExchangeInstIDType));
data.Volume = std::stoi(rowValue.at("Volume"));
strncpy(data.IPAddress, rowValue.at("IPAddress").c_str(), sizeof(TThostFtdcIPAddressType));
strncpy(data.ExchangeInstID, rowValue.at("ExchangeInstID").c_str(), sizeof(TThostFtdcExchangeInstIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.ExchangeID + "','" + data.ExecOrderSysID + "','" + (data.ActionFlag == 0 ? '0' : data.ActionFlag) + "','" + data.ActionDate + "','" + data.ActionTime + "','" + data.TraderID + "','" + std::to_string(data.InstallID) + "','" + data.ExecOrderLocalID + "','" + data.ActionLocalID + "','" + data.ParticipantID + "','" + data.ClientID + "','" + data.BusinessUnit + "','" + (data.OrderActionStatus == 0 ? '0' : data.OrderActionStatus) + "','" + data.UserID + "','" + (data.ActionType == 0 ? '0' : data.ActionType) + "','" + data.BranchID + "','" + data.reserve1 + "','" + data.MacAddress + "','" + data.reserve2 + "','" + std::to_string(data.Volume) + "','" + data.IPAddress + "','" + data.ExchangeInstID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcQryExchangeExecOrderActionFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryExchangeExecOrderActionField data;
CThostFtdcQryExchangeExecOrderActionFieldWrapper(const CThostFtdcQryExchangeExecOrderActionField& _data = { 0 }) :data(_data) { }
CThostFtdcQryExchangeExecOrderActionFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryExchangeExecOrderActionField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.ParticipantID, rowValue.at("ParticipantID").c_str(), sizeof(TThostFtdcParticipantIDType));
strncpy(data.ClientID, rowValue.at("ClientID").c_str(), sizeof(TThostFtdcClientIDType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.TraderID, rowValue.at("TraderID").c_str(), sizeof(TThostFtdcTraderIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.ParticipantID + "','" + data.ClientID + "','" + data.ExchangeID + "','" + data.TraderID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcErrExecOrderFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcErrExecOrderField data;
CThostFtdcErrExecOrderFieldWrapper(const CThostFtdcErrExecOrderField& _data = { 0 }) :data(_data) { }
CThostFtdcErrExecOrderFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcErrExecOrderField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
strncpy(data.ExecOrderRef, rowValue.at("ExecOrderRef").c_str(), sizeof(TThostFtdcOrderRefType));
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
data.Volume = std::stoi(rowValue.at("Volume"));
data.RequestID = std::stoi(rowValue.at("RequestID"));
strncpy(data.BusinessUnit, rowValue.at("BusinessUnit").c_str(), sizeof(TThostFtdcBusinessUnitType));
data.OffsetFlag = rowValue.at("OffsetFlag").empty() ? '0' : rowValue.at("OffsetFlag")[0];
data.HedgeFlag = rowValue.at("HedgeFlag").empty() ? '0' : rowValue.at("HedgeFlag")[0];
data.ActionType = rowValue.at("ActionType").empty() ? '0' : rowValue.at("ActionType")[0];
data.PosiDirection = rowValue.at("PosiDirection").empty() ? '0' : rowValue.at("PosiDirection")[0];
data.ReservePositionFlag = rowValue.at("ReservePositionFlag").empty() ? '0' : rowValue.at("ReservePositionFlag")[0];
data.CloseFlag = rowValue.at("CloseFlag").empty() ? '0' : rowValue.at("CloseFlag")[0];
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.InvestUnitID, rowValue.at("InvestUnitID").c_str(), sizeof(TThostFtdcInvestUnitIDType));
strncpy(data.AccountID, rowValue.at("AccountID").c_str(), sizeof(TThostFtdcAccountIDType));
strncpy(data.CurrencyID, rowValue.at("CurrencyID").c_str(), sizeof(TThostFtdcCurrencyIDType));
strncpy(data.ClientID, rowValue.at("ClientID").c_str(), sizeof(TThostFtdcClientIDType));
strncpy(data.reserve2, rowValue.at("reserve2").c_str(), sizeof(TThostFtdcOldIPAddressType));
strncpy(data.MacAddress, rowValue.at("MacAddress").c_str(), sizeof(TThostFtdcMacAddressType));
data.ErrorID = std::stoi(rowValue.at("ErrorID"));
strncpy(data.ErrorMsg, utf8_to_gbk(rowValue.at("ErrorMsg")).c_str(), sizeof(TThostFtdcErrorMsgType));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
strncpy(data.IPAddress, rowValue.at("IPAddress").c_str(), sizeof(TThostFtdcIPAddressType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorID + "','" + data.reserve1 + "','" + data.ExecOrderRef + "','" + data.UserID + "','" + std::to_string(data.Volume) + "','" + std::to_string(data.RequestID) + "','" + data.BusinessUnit + "','" + (data.OffsetFlag == 0 ? '0' : data.OffsetFlag) + "','" + (data.HedgeFlag == 0 ? '0' : data.HedgeFlag) + "','" + (data.ActionType == 0 ? '0' : data.ActionType) + "','" + (data.PosiDirection == 0 ? '0' : data.PosiDirection) + "','" + (data.ReservePositionFlag == 0 ? '0' : data.ReservePositionFlag) + "','" + (data.CloseFlag == 0 ? '0' : data.CloseFlag) + "','" + data.ExchangeID + "','" + data.InvestUnitID + "','" + data.AccountID + "','" + data.CurrencyID + "','" + data.ClientID + "','" + data.reserve2 + "','" + data.MacAddress + "','" + std::to_string(data.ErrorID) + "','" + gbk_to_utf8(data.ErrorMsg) + "','" + data.InstrumentID + "','" + data.IPAddress
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcErrExecOrderField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcQryErrExecOrderFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryErrExecOrderField data;
CThostFtdcQryErrExecOrderFieldWrapper(const CThostFtdcQryErrExecOrderField& _data = { 0 }) :data(_data) { }
CThostFtdcQryErrExecOrderFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryErrExecOrderField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcQryErrExecOrderField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcErrExecOrderActionFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcErrExecOrderActionField data;
CThostFtdcErrExecOrderActionFieldWrapper(const CThostFtdcErrExecOrderActionField& _data = { 0 }) :data(_data) { }
CThostFtdcErrExecOrderActionFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcErrExecOrderActionField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
data.ExecOrderActionRef = std::stoi(rowValue.at("ExecOrderActionRef"));
strncpy(data.ExecOrderRef, rowValue.at("ExecOrderRef").c_str(), sizeof(TThostFtdcOrderRefType));
data.RequestID = std::stoi(rowValue.at("RequestID"));
data.FrontID = std::stoi(rowValue.at("FrontID"));
data.SessionID = std::stoi(rowValue.at("SessionID"));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.ExecOrderSysID, rowValue.at("ExecOrderSysID").c_str(), sizeof(TThostFtdcExecOrderSysIDType));
data.ActionFlag = rowValue.at("ActionFlag").empty() ? '0' : rowValue.at("ActionFlag")[0];
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
strncpy(data.InvestUnitID, rowValue.at("InvestUnitID").c_str(), sizeof(TThostFtdcInvestUnitIDType));
strncpy(data.reserve2, rowValue.at("reserve2").c_str(), sizeof(TThostFtdcOldIPAddressType));
strncpy(data.MacAddress, rowValue.at("MacAddress").c_str(), sizeof(TThostFtdcMacAddressType));
data.ErrorID = std::stoi(rowValue.at("ErrorID"));
strncpy(data.ErrorMsg, utf8_to_gbk(rowValue.at("ErrorMsg")).c_str(), sizeof(TThostFtdcErrorMsgType));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
strncpy(data.IPAddress, rowValue.at("IPAddress").c_str(), sizeof(TThostFtdcIPAddressType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorID + "','" + std::to_string(data.ExecOrderActionRef) + "','" + data.ExecOrderRef + "','" + std::to_string(data.RequestID) + "','" + std::to_string(data.FrontID) + "','" + std::to_string(data.SessionID) + "','" + data.ExchangeID + "','" + data.ExecOrderSysID + "','" + (data.ActionFlag == 0 ? '0' : data.ActionFlag) + "','" + data.UserID + "','" + data.reserve1 + "','" + data.InvestUnitID + "','" + data.reserve2 + "','" + data.MacAddress + "','" + std::to_string(data.ErrorID) + "','" + gbk_to_utf8(data.ErrorMsg) + "','" + data.InstrumentID + "','" + data.IPAddress
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcErrExecOrderActionField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcQryErrExecOrderActionFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryErrExecOrderActionField data;
CThostFtdcQryErrExecOrderActionFieldWrapper(const CThostFtdcQryErrExecOrderActionField& _data = { 0 }) :data(_data) { }
CThostFtdcQryErrExecOrderActionFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryErrExecOrderActionField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcQryErrExecOrderActionField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcOptionInstrTradingRightFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcOptionInstrTradingRightField data;
CThostFtdcOptionInstrTradingRightFieldWrapper(const CThostFtdcOptionInstrTradingRightField& _data = { 0 }) :data(_data) { }
CThostFtdcOptionInstrTradingRightFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcOptionInstrTradingRightField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
data.InvestorRange = rowValue.at("InvestorRange").empty() ? '0' : rowValue.at("InvestorRange")[0];
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
data.Direction = rowValue.at("Direction").empty() ? '0' : rowValue.at("Direction")[0];
data.TradingRight = rowValue.at("TradingRight").empty() ? '0' : rowValue.at("TradingRight")[0];
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.reserve1 + "','" + (data.InvestorRange == 0 ? '0' : data.InvestorRange) + "','" + data.BrokerID + "','" + data.InvestorID + "','" + (data.Direction == 0 ? '0' : data.Direction) + "','" + (data.TradingRight == 0 ? '0' : data.TradingRight) + "','" + data.InstrumentID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcOptionInstrTradingRightField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcQryOptionInstrTradingRightFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryOptionInstrTradingRightField data;
CThostFtdcQryOptionInstrTradingRightFieldWrapper(const CThostFtdcQryOptionInstrTradingRightField& _data = { 0 }) :data(_data) { }
CThostFtdcQryOptionInstrTradingRightFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryOptionInstrTradingRightField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
data.Direction = rowValue.at("Direction").empty() ? '0' : rowValue.at("Direction")[0];
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorID + "','" + data.reserve1 + "','" + (data.Direction == 0 ? '0' : data.Direction) + "','" + data.InstrumentID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcQryOptionInstrTradingRightField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcInputForQuoteFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcInputForQuoteField data;
CThostFtdcInputForQuoteFieldWrapper(const CThostFtdcInputForQuoteField& _data = { 0 }) :data(_data) { }
CThostFtdcInputForQuoteFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcInputForQuoteField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
strncpy(data.ForQuoteRef, rowValue.at("ForQuoteRef").c_str(), sizeof(TThostFtdcOrderRefType));
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.InvestUnitID, rowValue.at("InvestUnitID").c_str(), sizeof(TThostFtdcInvestUnitIDType));
strncpy(data.reserve2, rowValue.at("reserve2").c_str(), sizeof(TThostFtdcOldIPAddressType));
strncpy(data.MacAddress, rowValue.at("MacAddress").c_str(), sizeof(TThostFtdcMacAddressType));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
strncpy(data.IPAddress, rowValue.at("IPAddress").c_str(), sizeof(TThostFtdcIPAddressType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorID + "','" + data.reserve1 + "','" + data.ForQuoteRef + "','" + data.UserID + "','" + data.ExchangeID + "','" + data.InvestUnitID + "','" + data.reserve2 + "','" + data.MacAddress + "','" + data.InstrumentID + "','" + data.IPAddress
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcInputForQuoteField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcForQuoteFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcForQuoteField data;
CThostFtdcForQuoteFieldWrapper(const CThostFtdcForQuoteField& _data = { 0 }) :data(_data) { }
CThostFtdcForQuoteFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcForQuoteField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
strncpy(data.ForQuoteRef, rowValue.at("ForQuoteRef").c_str(), sizeof(TThostFtdcOrderRefType));
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
strncpy(data.ForQuoteLocalID, rowValue.at("ForQuoteLocalID").c_str(), sizeof(TThostFtdcOrderLocalIDType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.ParticipantID, rowValue.at("ParticipantID").c_str(), sizeof(TThostFtdcParticipantIDType));
strncpy(data.ClientID, rowValue.at("ClientID").c_str(), sizeof(TThostFtdcClientIDType));
strncpy(data.reserve2, rowValue.at("reserve2").c_str(), sizeof(TThostFtdcOldExchangeInstIDType));
strncpy(data.TraderID, rowValue.at("TraderID").c_str(), sizeof(TThostFtdcTraderIDType));
data.InstallID = std::stoi(rowValue.at("InstallID"));
strncpy(data.InsertDate, rowValue.at("InsertDate").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.InsertTime, rowValue.at("InsertTime").c_str(), sizeof(TThostFtdcTimeType));
data.ForQuoteStatus = rowValue.at("ForQuoteStatus").empty() ? '0' : rowValue.at("ForQuoteStatus")[0];
data.FrontID = std::stoi(rowValue.at("FrontID"));
data.SessionID = std::stoi(rowValue.at("SessionID"));
strncpy(data.StatusMsg, utf8_to_gbk(rowValue.at("StatusMsg")).c_str(), sizeof(TThostFtdcErrorMsgType));
strncpy(data.ActiveUserID, rowValue.at("ActiveUserID").c_str(), sizeof(TThostFtdcUserIDType));
data.BrokerForQutoSeq = std::stoi(rowValue.at("BrokerForQutoSeq"));
strncpy(data.InvestUnitID, rowValue.at("InvestUnitID").c_str(), sizeof(TThostFtdcInvestUnitIDType));
strncpy(data.reserve3, rowValue.at("reserve3").c_str(), sizeof(TThostFtdcOldIPAddressType));
strncpy(data.MacAddress, rowValue.at("MacAddress").c_str(), sizeof(TThostFtdcMacAddressType));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
strncpy(data.ExchangeInstID, rowValue.at("ExchangeInstID").c_str(), sizeof(TThostFtdcExchangeInstIDType));
strncpy(data.IPAddress, rowValue.at("IPAddress").c_str(), sizeof(TThostFtdcIPAddressType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorID + "','" + data.reserve1 + "','" + data.ForQuoteRef + "','" + data.UserID + "','" + data.ForQuoteLocalID + "','" + data.ExchangeID + "','" + data.ParticipantID + "','" + data.ClientID + "','" + data.reserve2 + "','" + data.TraderID + "','" + std::to_string(data.InstallID) + "','" + data.InsertDate + "','" + data.InsertTime + "','" + (data.ForQuoteStatus == 0 ? '0' : data.ForQuoteStatus) + "','" + std::to_string(data.FrontID) + "','" + std::to_string(data.SessionID) + "','" + gbk_to_utf8(data.StatusMsg) + "','" + data.ActiveUserID + "','" + std::to_string(data.BrokerForQutoSeq) + "','" + data.InvestUnitID + "','" + data.reserve3 + "','" + data.MacAddress + "','" + data.InstrumentID + "','" + data.ExchangeInstID + "','" + data.IPAddress
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcForQuoteField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcQryForQuoteFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryForQuoteField data;
CThostFtdcQryForQuoteFieldWrapper(const CThostFtdcQryForQuoteField& _data = { 0 }) :data(_data) { }
CThostFtdcQryForQuoteFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryForQuoteField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.InsertTimeStart, rowValue.at("InsertTimeStart").c_str(), sizeof(TThostFtdcTimeType));
strncpy(data.InsertTimeEnd, rowValue.at("InsertTimeEnd").c_str(), sizeof(TThostFtdcTimeType));
strncpy(data.InvestUnitID, rowValue.at("InvestUnitID").c_str(), sizeof(TThostFtdcInvestUnitIDType));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorID + "','" + data.reserve1 + "','" + data.ExchangeID + "','" + data.InsertTimeStart + "','" + data.InsertTimeEnd + "','" + data.InvestUnitID + "','" + data.InstrumentID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcQryForQuoteField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcExchangeForQuoteFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcExchangeForQuoteField data;
CThostFtdcExchangeForQuoteFieldWrapper(const CThostFtdcExchangeForQuoteField& _data = { 0 }) :data(_data) { }
CThostFtdcExchangeForQuoteFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcExchangeForQuoteField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.ForQuoteLocalID, rowValue.at("ForQuoteLocalID").c_str(), sizeof(TThostFtdcOrderLocalIDType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.ParticipantID, rowValue.at("ParticipantID").c_str(), sizeof(TThostFtdcParticipantIDType));
strncpy(data.ClientID, rowValue.at("ClientID").c_str(), sizeof(TThostFtdcClientIDType));
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldExchangeInstIDType));
strncpy(data.TraderID, rowValue.at("TraderID").c_str(), sizeof(TThostFtdcTraderIDType));
data.InstallID = std::stoi(rowValue.at("InstallID"));
strncpy(data.InsertDate, rowValue.at("InsertDate").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.InsertTime, rowValue.at("InsertTime").c_str(), sizeof(TThostFtdcTimeType));
data.ForQuoteStatus = rowValue.at("ForQuoteStatus").empty() ? '0' : rowValue.at("ForQuoteStatus")[0];
strncpy(data.reserve2, rowValue.at("reserve2").c_str(), sizeof(TThostFtdcOldIPAddressType));
strncpy(data.MacAddress, rowValue.at("MacAddress").c_str(), sizeof(TThostFtdcMacAddressType));
strncpy(data.ExchangeInstID, rowValue.at("ExchangeInstID").c_str(), sizeof(TThostFtdcExchangeInstIDType));
strncpy(data.IPAddress, rowValue.at("IPAddress").c_str(), sizeof(TThostFtdcIPAddressType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.ForQuoteLocalID + "','" + data.ExchangeID + "','" + data.ParticipantID + "','" + data.ClientID + "','" + data.reserve1 + "','" + data.TraderID + "','" + std::to_string(data.InstallID) + "','" + data.InsertDate + "','" + data.InsertTime + "','" + (data.ForQuoteStatus == 0 ? '0' : data.ForQuoteStatus) + "','" + data.reserve2 + "','" + data.MacAddress + "','" + data.ExchangeInstID + "','" + data.IPAddress
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcQryExchangeForQuoteFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryExchangeForQuoteField data;
CThostFtdcQryExchangeForQuoteFieldWrapper(const CThostFtdcQryExchangeForQuoteField& _data = { 0 }) :data(_data) { }
CThostFtdcQryExchangeForQuoteFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryExchangeForQuoteField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.ParticipantID, rowValue.at("ParticipantID").c_str(), sizeof(TThostFtdcParticipantIDType));
strncpy(data.ClientID, rowValue.at("ClientID").c_str(), sizeof(TThostFtdcClientIDType));
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldExchangeInstIDType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.TraderID, rowValue.at("TraderID").c_str(), sizeof(TThostFtdcTraderIDType));
strncpy(data.ExchangeInstID, rowValue.at("ExchangeInstID").c_str(), sizeof(TThostFtdcExchangeInstIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.ParticipantID + "','" + data.ClientID + "','" + data.reserve1 + "','" + data.ExchangeID + "','" + data.TraderID + "','" + data.ExchangeInstID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcInputQuoteFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcInputQuoteField data;
CThostFtdcInputQuoteFieldWrapper(const CThostFtdcInputQuoteField& _data = { 0 }) :data(_data) { }
CThostFtdcInputQuoteFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcInputQuoteField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
strncpy(data.QuoteRef, rowValue.at("QuoteRef").c_str(), sizeof(TThostFtdcOrderRefType));
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
data.AskPrice = std::stod(rowValue.at("AskPrice"));
data.BidPrice = std::stod(rowValue.at("BidPrice"));
data.AskVolume = std::stoi(rowValue.at("AskVolume"));
data.BidVolume = std::stoi(rowValue.at("BidVolume"));
data.RequestID = std::stoi(rowValue.at("RequestID"));
strncpy(data.BusinessUnit, rowValue.at("BusinessUnit").c_str(), sizeof(TThostFtdcBusinessUnitType));
data.AskOffsetFlag = rowValue.at("AskOffsetFlag").empty() ? '0' : rowValue.at("AskOffsetFlag")[0];
data.BidOffsetFlag = rowValue.at("BidOffsetFlag").empty() ? '0' : rowValue.at("BidOffsetFlag")[0];
data.AskHedgeFlag = rowValue.at("AskHedgeFlag").empty() ? '0' : rowValue.at("AskHedgeFlag")[0];
data.BidHedgeFlag = rowValue.at("BidHedgeFlag").empty() ? '0' : rowValue.at("BidHedgeFlag")[0];
strncpy(data.AskOrderRef, rowValue.at("AskOrderRef").c_str(), sizeof(TThostFtdcOrderRefType));
strncpy(data.BidOrderRef, rowValue.at("BidOrderRef").c_str(), sizeof(TThostFtdcOrderRefType));
strncpy(data.ForQuoteSysID, rowValue.at("ForQuoteSysID").c_str(), sizeof(TThostFtdcOrderSysIDType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.InvestUnitID, rowValue.at("InvestUnitID").c_str(), sizeof(TThostFtdcInvestUnitIDType));
strncpy(data.ClientID, rowValue.at("ClientID").c_str(), sizeof(TThostFtdcClientIDType));
strncpy(data.reserve2, rowValue.at("reserve2").c_str(), sizeof(TThostFtdcOldIPAddressType));
strncpy(data.MacAddress, rowValue.at("MacAddress").c_str(), sizeof(TThostFtdcMacAddressType));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
strncpy(data.IPAddress, rowValue.at("IPAddress").c_str(), sizeof(TThostFtdcIPAddressType));
strncpy(data.ReplaceSysID, rowValue.at("ReplaceSysID").c_str(), sizeof(TThostFtdcOrderSysIDType));
data.TimeCondition = rowValue.at("TimeCondition").empty() ? '0' : rowValue.at("TimeCondition")[0];
strncpy(data.OrderMemo, rowValue.at("OrderMemo").c_str(), sizeof(TThostFtdcOrderMemoType));
data.SessionReqSeq = std::stoi(rowValue.at("SessionReqSeq"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorID + "','" + data.reserve1 + "','" + data.QuoteRef + "','" + data.UserID + "','" + std::to_string(data.AskPrice) + "','" + std::to_string(data.BidPrice) + "','" + std::to_string(data.AskVolume) + "','" + std::to_string(data.BidVolume) + "','" + std::to_string(data.RequestID) + "','" + data.BusinessUnit + "','" + (data.AskOffsetFlag == 0 ? '0' : data.AskOffsetFlag) + "','" + (data.BidOffsetFlag == 0 ? '0' : data.BidOffsetFlag) + "','" + (data.AskHedgeFlag == 0 ? '0' : data.AskHedgeFlag) + "','" + (data.BidHedgeFlag == 0 ? '0' : data.BidHedgeFlag) + "','" + data.AskOrderRef + "','" + data.BidOrderRef + "','" + data.ForQuoteSysID + "','" + data.ExchangeID + "','" + data.InvestUnitID + "','" + data.ClientID + "','" + data.reserve2 + "','" + data.MacAddress + "','" + data.InstrumentID + "','" + data.IPAddress + "','" + data.ReplaceSysID + "','" + (data.TimeCondition == 0 ? '0' : data.TimeCondition) + "','" + data.OrderMemo + "','" + std::to_string(data.SessionReqSeq)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcInputQuoteField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcInputQuoteActionFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcInputQuoteActionField data;
CThostFtdcInputQuoteActionFieldWrapper(const CThostFtdcInputQuoteActionField& _data = { 0 }) :data(_data) { }
CThostFtdcInputQuoteActionFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcInputQuoteActionField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
data.QuoteActionRef = std::stoi(rowValue.at("QuoteActionRef"));
strncpy(data.QuoteRef, rowValue.at("QuoteRef").c_str(), sizeof(TThostFtdcOrderRefType));
data.RequestID = std::stoi(rowValue.at("RequestID"));
data.FrontID = std::stoi(rowValue.at("FrontID"));
data.SessionID = std::stoi(rowValue.at("SessionID"));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.QuoteSysID, rowValue.at("QuoteSysID").c_str(), sizeof(TThostFtdcOrderSysIDType));
data.ActionFlag = rowValue.at("ActionFlag").empty() ? '0' : rowValue.at("ActionFlag")[0];
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
strncpy(data.InvestUnitID, rowValue.at("InvestUnitID").c_str(), sizeof(TThostFtdcInvestUnitIDType));
strncpy(data.ClientID, rowValue.at("ClientID").c_str(), sizeof(TThostFtdcClientIDType));
strncpy(data.reserve2, rowValue.at("reserve2").c_str(), sizeof(TThostFtdcOldIPAddressType));
strncpy(data.MacAddress, rowValue.at("MacAddress").c_str(), sizeof(TThostFtdcMacAddressType));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
strncpy(data.IPAddress, rowValue.at("IPAddress").c_str(), sizeof(TThostFtdcIPAddressType));
strncpy(data.OrderMemo, rowValue.at("OrderMemo").c_str(), sizeof(TThostFtdcOrderMemoType));
data.SessionReqSeq = std::stoi(rowValue.at("SessionReqSeq"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorID + "','" + std::to_string(data.QuoteActionRef) + "','" + data.QuoteRef + "','" + std::to_string(data.RequestID) + "','" + std::to_string(data.FrontID) + "','" + std::to_string(data.SessionID) + "','" + data.ExchangeID + "','" + data.QuoteSysID + "','" + (data.ActionFlag == 0 ? '0' : data.ActionFlag) + "','" + data.UserID + "','" + data.reserve1 + "','" + data.InvestUnitID + "','" + data.ClientID + "','" + data.reserve2 + "','" + data.MacAddress + "','" + data.InstrumentID + "','" + data.IPAddress + "','" + data.OrderMemo + "','" + std::to_string(data.SessionReqSeq)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcInputQuoteActionField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcQuoteFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQuoteField data;
CThostFtdcQuoteFieldWrapper(const CThostFtdcQuoteField& _data = { 0 }) :data(_data) { }
CThostFtdcQuoteFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQuoteField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
strncpy(data.QuoteRef, rowValue.at("QuoteRef").c_str(), sizeof(TThostFtdcOrderRefType));
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
data.AskPrice = std::stod(rowValue.at("AskPrice"));
data.BidPrice = std::stod(rowValue.at("BidPrice"));
data.AskVolume = std::stoi(rowValue.at("AskVolume"));
data.BidVolume = std::stoi(rowValue.at("BidVolume"));
data.RequestID = std::stoi(rowValue.at("RequestID"));
strncpy(data.BusinessUnit, rowValue.at("BusinessUnit").c_str(), sizeof(TThostFtdcBusinessUnitType));
data.AskOffsetFlag = rowValue.at("AskOffsetFlag").empty() ? '0' : rowValue.at("AskOffsetFlag")[0];
data.BidOffsetFlag = rowValue.at("BidOffsetFlag").empty() ? '0' : rowValue.at("BidOffsetFlag")[0];
data.AskHedgeFlag = rowValue.at("AskHedgeFlag").empty() ? '0' : rowValue.at("AskHedgeFlag")[0];
data.BidHedgeFlag = rowValue.at("BidHedgeFlag").empty() ? '0' : rowValue.at("BidHedgeFlag")[0];
strncpy(data.QuoteLocalID, rowValue.at("QuoteLocalID").c_str(), sizeof(TThostFtdcOrderLocalIDType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.ParticipantID, rowValue.at("ParticipantID").c_str(), sizeof(TThostFtdcParticipantIDType));
strncpy(data.ClientID, rowValue.at("ClientID").c_str(), sizeof(TThostFtdcClientIDType));
strncpy(data.reserve2, rowValue.at("reserve2").c_str(), sizeof(TThostFtdcOldExchangeInstIDType));
strncpy(data.TraderID, rowValue.at("TraderID").c_str(), sizeof(TThostFtdcTraderIDType));
data.InstallID = std::stoi(rowValue.at("InstallID"));
data.NotifySequence = std::stoi(rowValue.at("NotifySequence"));
data.OrderSubmitStatus = rowValue.at("OrderSubmitStatus").empty() ? '0' : rowValue.at("OrderSubmitStatus")[0];
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcDateType));
data.SettlementID = std::stoi(rowValue.at("SettlementID"));
strncpy(data.QuoteSysID, rowValue.at("QuoteSysID").c_str(), sizeof(TThostFtdcOrderSysIDType));
strncpy(data.InsertDate, rowValue.at("InsertDate").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.InsertTime, rowValue.at("InsertTime").c_str(), sizeof(TThostFtdcTimeType));
strncpy(data.CancelTime, rowValue.at("CancelTime").c_str(), sizeof(TThostFtdcTimeType));
data.QuoteStatus = rowValue.at("QuoteStatus").empty() ? '0' : rowValue.at("QuoteStatus")[0];
strncpy(data.ClearingPartID, rowValue.at("ClearingPartID").c_str(), sizeof(TThostFtdcParticipantIDType));
data.SequenceNo = std::stoi(rowValue.at("SequenceNo"));
strncpy(data.AskOrderSysID, rowValue.at("AskOrderSysID").c_str(), sizeof(TThostFtdcOrderSysIDType));
strncpy(data.BidOrderSysID, rowValue.at("BidOrderSysID").c_str(), sizeof(TThostFtdcOrderSysIDType));
data.FrontID = std::stoi(rowValue.at("FrontID"));
data.SessionID = std::stoi(rowValue.at("SessionID"));
strncpy(data.UserProductInfo, rowValue.at("UserProductInfo").c_str(), sizeof(TThostFtdcProductInfoType));
strncpy(data.StatusMsg, utf8_to_gbk(rowValue.at("StatusMsg")).c_str(), sizeof(TThostFtdcErrorMsgType));
strncpy(data.ActiveUserID, rowValue.at("ActiveUserID").c_str(), sizeof(TThostFtdcUserIDType));
data.BrokerQuoteSeq = std::stoi(rowValue.at("BrokerQuoteSeq"));
strncpy(data.AskOrderRef, rowValue.at("AskOrderRef").c_str(), sizeof(TThostFtdcOrderRefType));
strncpy(data.BidOrderRef, rowValue.at("BidOrderRef").c_str(), sizeof(TThostFtdcOrderRefType));
strncpy(data.ForQuoteSysID, rowValue.at("ForQuoteSysID").c_str(), sizeof(TThostFtdcOrderSysIDType));
strncpy(data.BranchID, rowValue.at("BranchID").c_str(), sizeof(TThostFtdcBranchIDType));
strncpy(data.InvestUnitID, rowValue.at("InvestUnitID").c_str(), sizeof(TThostFtdcInvestUnitIDType));
strncpy(data.AccountID, rowValue.at("AccountID").c_str(), sizeof(TThostFtdcAccountIDType));
strncpy(data.CurrencyID, rowValue.at("CurrencyID").c_str(), sizeof(TThostFtdcCurrencyIDType));
strncpy(data.reserve3, rowValue.at("reserve3").c_str(), sizeof(TThostFtdcOldIPAddressType));
strncpy(data.MacAddress, rowValue.at("MacAddress").c_str(), sizeof(TThostFtdcMacAddressType));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
strncpy(data.ExchangeInstID, rowValue.at("ExchangeInstID").c_str(), sizeof(TThostFtdcExchangeInstIDType));
strncpy(data.IPAddress, rowValue.at("IPAddress").c_str(), sizeof(TThostFtdcIPAddressType));
strncpy(data.ReplaceSysID, rowValue.at("ReplaceSysID").c_str(), sizeof(TThostFtdcOrderSysIDType));
data.TimeCondition = rowValue.at("TimeCondition").empty() ? '0' : rowValue.at("TimeCondition")[0];
strncpy(data.OrderMemo, rowValue.at("OrderMemo").c_str(), sizeof(TThostFtdcOrderMemoType));
data.SessionReqSeq = std::stoi(rowValue.at("SessionReqSeq"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorID + "','" + data.reserve1 + "','" + data.QuoteRef + "','" + data.UserID + "','" + std::to_string(data.AskPrice) + "','" + std::to_string(data.BidPrice) + "','" + std::to_string(data.AskVolume) + "','" + std::to_string(data.BidVolume) + "','" + std::to_string(data.RequestID) + "','" + data.BusinessUnit + "','" + (data.AskOffsetFlag == 0 ? '0' : data.AskOffsetFlag) + "','" + (data.BidOffsetFlag == 0 ? '0' : data.BidOffsetFlag) + "','" + (data.AskHedgeFlag == 0 ? '0' : data.AskHedgeFlag) + "','" + (data.BidHedgeFlag == 0 ? '0' : data.BidHedgeFlag) + "','" + data.QuoteLocalID + "','" + data.ExchangeID + "','" + data.ParticipantID + "','" + data.ClientID + "','" + data.reserve2 + "','" + data.TraderID + "','" + std::to_string(data.InstallID) + "','" + std::to_string(data.NotifySequence) + "','" + (data.OrderSubmitStatus == 0 ? '0' : data.OrderSubmitStatus) + "','" + data.TradingDay + "','" + std::to_string(data.SettlementID) + "','" + data.QuoteSysID + "','" + data.InsertDate + "','" + data.InsertTime + "','" + data.CancelTime + "','" + (data.QuoteStatus == 0 ? '0' : data.QuoteStatus) + "','" + data.ClearingPartID + "','" + std::to_string(data.SequenceNo) + "','" + data.AskOrderSysID + "','" + data.BidOrderSysID + "','" + std::to_string(data.FrontID) + "','" + std::to_string(data.SessionID) + "','" + data.UserProductInfo + "','" + gbk_to_utf8(data.StatusMsg) + "','" + data.ActiveUserID + "','" + std::to_string(data.BrokerQuoteSeq) + "','" + data.AskOrderRef + "','" + data.BidOrderRef + "','" + data.ForQuoteSysID + "','" + data.BranchID + "','" + data.InvestUnitID + "','" + data.AccountID + "','" + data.CurrencyID + "','" + data.reserve3 + "','" + data.MacAddress + "','" + data.InstrumentID + "','" + data.ExchangeInstID + "','" + data.IPAddress + "','" + data.ReplaceSysID + "','" + (data.TimeCondition == 0 ? '0' : data.TimeCondition) + "','" + data.OrderMemo + "','" + std::to_string(data.SessionReqSeq)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcQuoteField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcQuoteActionFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQuoteActionField data;
CThostFtdcQuoteActionFieldWrapper(const CThostFtdcQuoteActionField& _data = { 0 }) :data(_data) { }
CThostFtdcQuoteActionFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQuoteActionField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
data.QuoteActionRef = std::stoi(rowValue.at("QuoteActionRef"));
strncpy(data.QuoteRef, rowValue.at("QuoteRef").c_str(), sizeof(TThostFtdcOrderRefType));
data.RequestID = std::stoi(rowValue.at("RequestID"));
data.FrontID = std::stoi(rowValue.at("FrontID"));
data.SessionID = std::stoi(rowValue.at("SessionID"));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.QuoteSysID, rowValue.at("QuoteSysID").c_str(), sizeof(TThostFtdcOrderSysIDType));
data.ActionFlag = rowValue.at("ActionFlag").empty() ? '0' : rowValue.at("ActionFlag")[0];
strncpy(data.ActionDate, rowValue.at("ActionDate").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.ActionTime, rowValue.at("ActionTime").c_str(), sizeof(TThostFtdcTimeType));
strncpy(data.TraderID, rowValue.at("TraderID").c_str(), sizeof(TThostFtdcTraderIDType));
data.InstallID = std::stoi(rowValue.at("InstallID"));
strncpy(data.QuoteLocalID, rowValue.at("QuoteLocalID").c_str(), sizeof(TThostFtdcOrderLocalIDType));
strncpy(data.ActionLocalID, rowValue.at("ActionLocalID").c_str(), sizeof(TThostFtdcOrderLocalIDType));
strncpy(data.ParticipantID, rowValue.at("ParticipantID").c_str(), sizeof(TThostFtdcParticipantIDType));
strncpy(data.ClientID, rowValue.at("ClientID").c_str(), sizeof(TThostFtdcClientIDType));
strncpy(data.BusinessUnit, rowValue.at("BusinessUnit").c_str(), sizeof(TThostFtdcBusinessUnitType));
data.OrderActionStatus = rowValue.at("OrderActionStatus").empty() ? '0' : rowValue.at("OrderActionStatus")[0];
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
strncpy(data.StatusMsg, utf8_to_gbk(rowValue.at("StatusMsg")).c_str(), sizeof(TThostFtdcErrorMsgType));
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
strncpy(data.BranchID, rowValue.at("BranchID").c_str(), sizeof(TThostFtdcBranchIDType));
strncpy(data.InvestUnitID, rowValue.at("InvestUnitID").c_str(), sizeof(TThostFtdcInvestUnitIDType));
strncpy(data.reserve2, rowValue.at("reserve2").c_str(), sizeof(TThostFtdcOldIPAddressType));
strncpy(data.MacAddress, rowValue.at("MacAddress").c_str(), sizeof(TThostFtdcMacAddressType));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
strncpy(data.IPAddress, rowValue.at("IPAddress").c_str(), sizeof(TThostFtdcIPAddressType));
strncpy(data.OrderMemo, rowValue.at("OrderMemo").c_str(), sizeof(TThostFtdcOrderMemoType));
data.SessionReqSeq = std::stoi(rowValue.at("SessionReqSeq"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorID + "','" + std::to_string(data.QuoteActionRef) + "','" + data.QuoteRef + "','" + std::to_string(data.RequestID) + "','" + std::to_string(data.FrontID) + "','" + std::to_string(data.SessionID) + "','" + data.ExchangeID + "','" + data.QuoteSysID + "','" + (data.ActionFlag == 0 ? '0' : data.ActionFlag) + "','" + data.ActionDate + "','" + data.ActionTime + "','" + data.TraderID + "','" + std::to_string(data.InstallID) + "','" + data.QuoteLocalID + "','" + data.ActionLocalID + "','" + data.ParticipantID + "','" + data.ClientID + "','" + data.BusinessUnit + "','" + (data.OrderActionStatus == 0 ? '0' : data.OrderActionStatus) + "','" + data.UserID + "','" + gbk_to_utf8(data.StatusMsg) + "','" + data.reserve1 + "','" + data.BranchID + "','" + data.InvestUnitID + "','" + data.reserve2 + "','" + data.MacAddress + "','" + data.InstrumentID + "','" + data.IPAddress + "','" + data.OrderMemo + "','" + std::to_string(data.SessionReqSeq)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcQuoteActionField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcQryQuoteFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryQuoteField data;
CThostFtdcQryQuoteFieldWrapper(const CThostFtdcQryQuoteField& _data = { 0 }) :data(_data) { }
CThostFtdcQryQuoteFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryQuoteField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.QuoteSysID, rowValue.at("QuoteSysID").c_str(), sizeof(TThostFtdcOrderSysIDType));
strncpy(data.InsertTimeStart, rowValue.at("InsertTimeStart").c_str(), sizeof(TThostFtdcTimeType));
strncpy(data.InsertTimeEnd, rowValue.at("InsertTimeEnd").c_str(), sizeof(TThostFtdcTimeType));
strncpy(data.InvestUnitID, rowValue.at("InvestUnitID").c_str(), sizeof(TThostFtdcInvestUnitIDType));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorID + "','" + data.reserve1 + "','" + data.ExchangeID + "','" + data.QuoteSysID + "','" + data.InsertTimeStart + "','" + data.InsertTimeEnd + "','" + data.InvestUnitID + "','" + data.InstrumentID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcQryQuoteField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcExchangeQuoteFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcExchangeQuoteField data;
CThostFtdcExchangeQuoteFieldWrapper(const CThostFtdcExchangeQuoteField& _data = { 0 }) :data(_data) { }
CThostFtdcExchangeQuoteFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcExchangeQuoteField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
data.AskPrice = std::stod(rowValue.at("AskPrice"));
data.BidPrice = std::stod(rowValue.at("BidPrice"));
data.AskVolume = std::stoi(rowValue.at("AskVolume"));
data.BidVolume = std::stoi(rowValue.at("BidVolume"));
data.RequestID = std::stoi(rowValue.at("RequestID"));
strncpy(data.BusinessUnit, rowValue.at("BusinessUnit").c_str(), sizeof(TThostFtdcBusinessUnitType));
data.AskOffsetFlag = rowValue.at("AskOffsetFlag").empty() ? '0' : rowValue.at("AskOffsetFlag")[0];
data.BidOffsetFlag = rowValue.at("BidOffsetFlag").empty() ? '0' : rowValue.at("BidOffsetFlag")[0];
data.AskHedgeFlag = rowValue.at("AskHedgeFlag").empty() ? '0' : rowValue.at("AskHedgeFlag")[0];
data.BidHedgeFlag = rowValue.at("BidHedgeFlag").empty() ? '0' : rowValue.at("BidHedgeFlag")[0];
strncpy(data.QuoteLocalID, rowValue.at("QuoteLocalID").c_str(), sizeof(TThostFtdcOrderLocalIDType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.ParticipantID, rowValue.at("ParticipantID").c_str(), sizeof(TThostFtdcParticipantIDType));
strncpy(data.ClientID, rowValue.at("ClientID").c_str(), sizeof(TThostFtdcClientIDType));
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldExchangeInstIDType));
strncpy(data.TraderID, rowValue.at("TraderID").c_str(), sizeof(TThostFtdcTraderIDType));
data.InstallID = std::stoi(rowValue.at("InstallID"));
data.NotifySequence = std::stoi(rowValue.at("NotifySequence"));
data.OrderSubmitStatus = rowValue.at("OrderSubmitStatus").empty() ? '0' : rowValue.at("OrderSubmitStatus")[0];
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcDateType));
data.SettlementID = std::stoi(rowValue.at("SettlementID"));
strncpy(data.QuoteSysID, rowValue.at("QuoteSysID").c_str(), sizeof(TThostFtdcOrderSysIDType));
strncpy(data.InsertDate, rowValue.at("InsertDate").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.InsertTime, rowValue.at("InsertTime").c_str(), sizeof(TThostFtdcTimeType));
strncpy(data.CancelTime, rowValue.at("CancelTime").c_str(), sizeof(TThostFtdcTimeType));
data.QuoteStatus = rowValue.at("QuoteStatus").empty() ? '0' : rowValue.at("QuoteStatus")[0];
strncpy(data.ClearingPartID, rowValue.at("ClearingPartID").c_str(), sizeof(TThostFtdcParticipantIDType));
data.SequenceNo = std::stoi(rowValue.at("SequenceNo"));
strncpy(data.AskOrderSysID, rowValue.at("AskOrderSysID").c_str(), sizeof(TThostFtdcOrderSysIDType));
strncpy(data.BidOrderSysID, rowValue.at("BidOrderSysID").c_str(), sizeof(TThostFtdcOrderSysIDType));
strncpy(data.ForQuoteSysID, rowValue.at("ForQuoteSysID").c_str(), sizeof(TThostFtdcOrderSysIDType));
strncpy(data.BranchID, rowValue.at("BranchID").c_str(), sizeof(TThostFtdcBranchIDType));
strncpy(data.reserve2, rowValue.at("reserve2").c_str(), sizeof(TThostFtdcOldIPAddressType));
strncpy(data.MacAddress, rowValue.at("MacAddress").c_str(), sizeof(TThostFtdcMacAddressType));
strncpy(data.ExchangeInstID, rowValue.at("ExchangeInstID").c_str(), sizeof(TThostFtdcExchangeInstIDType));
strncpy(data.IPAddress, rowValue.at("IPAddress").c_str(), sizeof(TThostFtdcIPAddressType));
data.TimeCondition = rowValue.at("TimeCondition").empty() ? '0' : rowValue.at("TimeCondition")[0];
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
std::to_string(data.AskPrice) + "','" + std::to_string(data.BidPrice) + "','" + std::to_string(data.AskVolume) + "','" + std::to_string(data.BidVolume) + "','" + std::to_string(data.RequestID) + "','" + data.BusinessUnit + "','" + (data.AskOffsetFlag == 0 ? '0' : data.AskOffsetFlag) + "','" + (data.BidOffsetFlag == 0 ? '0' : data.BidOffsetFlag) + "','" + (data.AskHedgeFlag == 0 ? '0' : data.AskHedgeFlag) + "','" + (data.BidHedgeFlag == 0 ? '0' : data.BidHedgeFlag) + "','" + data.QuoteLocalID + "','" + data.ExchangeID + "','" + data.ParticipantID + "','" + data.ClientID + "','" + data.reserve1 + "','" + data.TraderID + "','" + std::to_string(data.InstallID) + "','" + std::to_string(data.NotifySequence) + "','" + (data.OrderSubmitStatus == 0 ? '0' : data.OrderSubmitStatus) + "','" + data.TradingDay + "','" + std::to_string(data.SettlementID) + "','" + data.QuoteSysID + "','" + data.InsertDate + "','" + data.InsertTime + "','" + data.CancelTime + "','" + (data.QuoteStatus == 0 ? '0' : data.QuoteStatus) + "','" + data.ClearingPartID + "','" + std::to_string(data.SequenceNo) + "','" + data.AskOrderSysID + "','" + data.BidOrderSysID + "','" + data.ForQuoteSysID + "','" + data.BranchID + "','" + data.reserve2 + "','" + data.MacAddress + "','" + data.ExchangeInstID + "','" + data.IPAddress + "','" + (data.TimeCondition == 0 ? '0' : data.TimeCondition)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcQryExchangeQuoteFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryExchangeQuoteField data;
CThostFtdcQryExchangeQuoteFieldWrapper(const CThostFtdcQryExchangeQuoteField& _data = { 0 }) :data(_data) { }
CThostFtdcQryExchangeQuoteFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryExchangeQuoteField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.ParticipantID, rowValue.at("ParticipantID").c_str(), sizeof(TThostFtdcParticipantIDType));
strncpy(data.ClientID, rowValue.at("ClientID").c_str(), sizeof(TThostFtdcClientIDType));
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldExchangeInstIDType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.TraderID, rowValue.at("TraderID").c_str(), sizeof(TThostFtdcTraderIDType));
strncpy(data.ExchangeInstID, rowValue.at("ExchangeInstID").c_str(), sizeof(TThostFtdcExchangeInstIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.ParticipantID + "','" + data.ClientID + "','" + data.reserve1 + "','" + data.ExchangeID + "','" + data.TraderID + "','" + data.ExchangeInstID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcQryQuoteActionFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryQuoteActionField data;
CThostFtdcQryQuoteActionFieldWrapper(const CThostFtdcQryQuoteActionField& _data = { 0 }) :data(_data) { }
CThostFtdcQryQuoteActionFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryQuoteActionField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorID + "','" + data.ExchangeID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcQryQuoteActionField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcExchangeQuoteActionFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcExchangeQuoteActionField data;
CThostFtdcExchangeQuoteActionFieldWrapper(const CThostFtdcExchangeQuoteActionField& _data = { 0 }) :data(_data) { }
CThostFtdcExchangeQuoteActionFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcExchangeQuoteActionField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.QuoteSysID, rowValue.at("QuoteSysID").c_str(), sizeof(TThostFtdcOrderSysIDType));
data.ActionFlag = rowValue.at("ActionFlag").empty() ? '0' : rowValue.at("ActionFlag")[0];
strncpy(data.ActionDate, rowValue.at("ActionDate").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.ActionTime, rowValue.at("ActionTime").c_str(), sizeof(TThostFtdcTimeType));
strncpy(data.TraderID, rowValue.at("TraderID").c_str(), sizeof(TThostFtdcTraderIDType));
data.InstallID = std::stoi(rowValue.at("InstallID"));
strncpy(data.QuoteLocalID, rowValue.at("QuoteLocalID").c_str(), sizeof(TThostFtdcOrderLocalIDType));
strncpy(data.ActionLocalID, rowValue.at("ActionLocalID").c_str(), sizeof(TThostFtdcOrderLocalIDType));
strncpy(data.ParticipantID, rowValue.at("ParticipantID").c_str(), sizeof(TThostFtdcParticipantIDType));
strncpy(data.ClientID, rowValue.at("ClientID").c_str(), sizeof(TThostFtdcClientIDType));
strncpy(data.BusinessUnit, rowValue.at("BusinessUnit").c_str(), sizeof(TThostFtdcBusinessUnitType));
data.OrderActionStatus = rowValue.at("OrderActionStatus").empty() ? '0' : rowValue.at("OrderActionStatus")[0];
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldIPAddressType));
strncpy(data.MacAddress, rowValue.at("MacAddress").c_str(), sizeof(TThostFtdcMacAddressType));
strncpy(data.IPAddress, rowValue.at("IPAddress").c_str(), sizeof(TThostFtdcIPAddressType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.ExchangeID + "','" + data.QuoteSysID + "','" + (data.ActionFlag == 0 ? '0' : data.ActionFlag) + "','" + data.ActionDate + "','" + data.ActionTime + "','" + data.TraderID + "','" + std::to_string(data.InstallID) + "','" + data.QuoteLocalID + "','" + data.ActionLocalID + "','" + data.ParticipantID + "','" + data.ClientID + "','" + data.BusinessUnit + "','" + (data.OrderActionStatus == 0 ? '0' : data.OrderActionStatus) + "','" + data.UserID + "','" + data.reserve1 + "','" + data.MacAddress + "','" + data.IPAddress
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcQryExchangeQuoteActionFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryExchangeQuoteActionField data;
CThostFtdcQryExchangeQuoteActionFieldWrapper(const CThostFtdcQryExchangeQuoteActionField& _data = { 0 }) :data(_data) { }
CThostFtdcQryExchangeQuoteActionFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryExchangeQuoteActionField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.ParticipantID, rowValue.at("ParticipantID").c_str(), sizeof(TThostFtdcParticipantIDType));
strncpy(data.ClientID, rowValue.at("ClientID").c_str(), sizeof(TThostFtdcClientIDType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.TraderID, rowValue.at("TraderID").c_str(), sizeof(TThostFtdcTraderIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.ParticipantID + "','" + data.ClientID + "','" + data.ExchangeID + "','" + data.TraderID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcOptionInstrDeltaFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcOptionInstrDeltaField data;
CThostFtdcOptionInstrDeltaFieldWrapper(const CThostFtdcOptionInstrDeltaField& _data = { 0 }) :data(_data) { }
CThostFtdcOptionInstrDeltaFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcOptionInstrDeltaField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
data.InvestorRange = rowValue.at("InvestorRange").empty() ? '0' : rowValue.at("InvestorRange")[0];
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
data.Delta = std::stod(rowValue.at("Delta"));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.reserve1 + "','" + (data.InvestorRange == 0 ? '0' : data.InvestorRange) + "','" + data.BrokerID + "','" + data.InvestorID + "','" + std::to_string(data.Delta) + "','" + data.InstrumentID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcOptionInstrDeltaField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcForQuoteRspFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcForQuoteRspField data;
CThostFtdcForQuoteRspFieldWrapper(const CThostFtdcForQuoteRspField& _data = { 0 }) :data(_data) { }
CThostFtdcForQuoteRspFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcForQuoteRspField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
strncpy(data.ForQuoteSysID, rowValue.at("ForQuoteSysID").c_str(), sizeof(TThostFtdcOrderSysIDType));
strncpy(data.ForQuoteTime, rowValue.at("ForQuoteTime").c_str(), sizeof(TThostFtdcTimeType));
strncpy(data.ActionDay, rowValue.at("ActionDay").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.TradingDay + "','" + data.reserve1 + "','" + data.ForQuoteSysID + "','" + data.ForQuoteTime + "','" + data.ActionDay + "','" + data.ExchangeID + "','" + data.InstrumentID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcStrikeOffsetFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcStrikeOffsetField data;
CThostFtdcStrikeOffsetFieldWrapper(const CThostFtdcStrikeOffsetField& _data = { 0 }) :data(_data) { }
CThostFtdcStrikeOffsetFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcStrikeOffsetField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
data.InvestorRange = rowValue.at("InvestorRange").empty() ? '0' : rowValue.at("InvestorRange")[0];
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
data.Offset = std::stod(rowValue.at("Offset"));
data.OffsetType = rowValue.at("OffsetType").empty() ? '0' : rowValue.at("OffsetType")[0];
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.reserve1 + "','" + (data.InvestorRange == 0 ? '0' : data.InvestorRange) + "','" + data.BrokerID + "','" + data.InvestorID + "','" + std::to_string(data.Offset) + "','" + (data.OffsetType == 0 ? '0' : data.OffsetType) + "','" + data.InstrumentID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcStrikeOffsetField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcQryStrikeOffsetFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryStrikeOffsetField data;
CThostFtdcQryStrikeOffsetFieldWrapper(const CThostFtdcQryStrikeOffsetField& _data = { 0 }) :data(_data) { }
CThostFtdcQryStrikeOffsetFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryStrikeOffsetField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorID + "','" + data.reserve1 + "','" + data.InstrumentID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcQryStrikeOffsetField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcInputBatchOrderActionFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcInputBatchOrderActionField data;
CThostFtdcInputBatchOrderActionFieldWrapper(const CThostFtdcInputBatchOrderActionField& _data = { 0 }) :data(_data) { }
CThostFtdcInputBatchOrderActionFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcInputBatchOrderActionField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
data.OrderActionRef = std::stoi(rowValue.at("OrderActionRef"));
data.RequestID = std::stoi(rowValue.at("RequestID"));
data.FrontID = std::stoi(rowValue.at("FrontID"));
data.SessionID = std::stoi(rowValue.at("SessionID"));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
strncpy(data.InvestUnitID, rowValue.at("InvestUnitID").c_str(), sizeof(TThostFtdcInvestUnitIDType));
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldIPAddressType));
strncpy(data.MacAddress, rowValue.at("MacAddress").c_str(), sizeof(TThostFtdcMacAddressType));
strncpy(data.IPAddress, rowValue.at("IPAddress").c_str(), sizeof(TThostFtdcIPAddressType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorID + "','" + std::to_string(data.OrderActionRef) + "','" + std::to_string(data.RequestID) + "','" + std::to_string(data.FrontID) + "','" + std::to_string(data.SessionID) + "','" + data.ExchangeID + "','" + data.UserID + "','" + data.InvestUnitID + "','" + data.reserve1 + "','" + data.MacAddress + "','" + data.IPAddress
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcInputBatchOrderActionField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcBatchOrderActionFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcBatchOrderActionField data;
CThostFtdcBatchOrderActionFieldWrapper(const CThostFtdcBatchOrderActionField& _data = { 0 }) :data(_data) { }
CThostFtdcBatchOrderActionFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcBatchOrderActionField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
data.OrderActionRef = std::stoi(rowValue.at("OrderActionRef"));
data.RequestID = std::stoi(rowValue.at("RequestID"));
data.FrontID = std::stoi(rowValue.at("FrontID"));
data.SessionID = std::stoi(rowValue.at("SessionID"));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.ActionDate, rowValue.at("ActionDate").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.ActionTime, rowValue.at("ActionTime").c_str(), sizeof(TThostFtdcTimeType));
strncpy(data.TraderID, rowValue.at("TraderID").c_str(), sizeof(TThostFtdcTraderIDType));
data.InstallID = std::stoi(rowValue.at("InstallID"));
strncpy(data.ActionLocalID, rowValue.at("ActionLocalID").c_str(), sizeof(TThostFtdcOrderLocalIDType));
strncpy(data.ParticipantID, rowValue.at("ParticipantID").c_str(), sizeof(TThostFtdcParticipantIDType));
strncpy(data.ClientID, rowValue.at("ClientID").c_str(), sizeof(TThostFtdcClientIDType));
strncpy(data.BusinessUnit, rowValue.at("BusinessUnit").c_str(), sizeof(TThostFtdcBusinessUnitType));
data.OrderActionStatus = rowValue.at("OrderActionStatus").empty() ? '0' : rowValue.at("OrderActionStatus")[0];
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
strncpy(data.StatusMsg, utf8_to_gbk(rowValue.at("StatusMsg")).c_str(), sizeof(TThostFtdcErrorMsgType));
strncpy(data.InvestUnitID, rowValue.at("InvestUnitID").c_str(), sizeof(TThostFtdcInvestUnitIDType));
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldIPAddressType));
strncpy(data.MacAddress, rowValue.at("MacAddress").c_str(), sizeof(TThostFtdcMacAddressType));
strncpy(data.IPAddress, rowValue.at("IPAddress").c_str(), sizeof(TThostFtdcIPAddressType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorID + "','" + std::to_string(data.OrderActionRef) + "','" + std::to_string(data.RequestID) + "','" + std::to_string(data.FrontID) + "','" + std::to_string(data.SessionID) + "','" + data.ExchangeID + "','" + data.ActionDate + "','" + data.ActionTime + "','" + data.TraderID + "','" + std::to_string(data.InstallID) + "','" + data.ActionLocalID + "','" + data.ParticipantID + "','" + data.ClientID + "','" + data.BusinessUnit + "','" + (data.OrderActionStatus == 0 ? '0' : data.OrderActionStatus) + "','" + data.UserID + "','" + gbk_to_utf8(data.StatusMsg) + "','" + data.InvestUnitID + "','" + data.reserve1 + "','" + data.MacAddress + "','" + data.IPAddress
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcBatchOrderActionField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcExchangeBatchOrderActionFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcExchangeBatchOrderActionField data;
CThostFtdcExchangeBatchOrderActionFieldWrapper(const CThostFtdcExchangeBatchOrderActionField& _data = { 0 }) :data(_data) { }
CThostFtdcExchangeBatchOrderActionFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcExchangeBatchOrderActionField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.ActionDate, rowValue.at("ActionDate").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.ActionTime, rowValue.at("ActionTime").c_str(), sizeof(TThostFtdcTimeType));
strncpy(data.TraderID, rowValue.at("TraderID").c_str(), sizeof(TThostFtdcTraderIDType));
data.InstallID = std::stoi(rowValue.at("InstallID"));
strncpy(data.ActionLocalID, rowValue.at("ActionLocalID").c_str(), sizeof(TThostFtdcOrderLocalIDType));
strncpy(data.ParticipantID, rowValue.at("ParticipantID").c_str(), sizeof(TThostFtdcParticipantIDType));
strncpy(data.ClientID, rowValue.at("ClientID").c_str(), sizeof(TThostFtdcClientIDType));
strncpy(data.BusinessUnit, rowValue.at("BusinessUnit").c_str(), sizeof(TThostFtdcBusinessUnitType));
data.OrderActionStatus = rowValue.at("OrderActionStatus").empty() ? '0' : rowValue.at("OrderActionStatus")[0];
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldIPAddressType));
strncpy(data.MacAddress, rowValue.at("MacAddress").c_str(), sizeof(TThostFtdcMacAddressType));
strncpy(data.IPAddress, rowValue.at("IPAddress").c_str(), sizeof(TThostFtdcIPAddressType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.ExchangeID + "','" + data.ActionDate + "','" + data.ActionTime + "','" + data.TraderID + "','" + std::to_string(data.InstallID) + "','" + data.ActionLocalID + "','" + data.ParticipantID + "','" + data.ClientID + "','" + data.BusinessUnit + "','" + (data.OrderActionStatus == 0 ? '0' : data.OrderActionStatus) + "','" + data.UserID + "','" + data.reserve1 + "','" + data.MacAddress + "','" + data.IPAddress
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcQryBatchOrderActionFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryBatchOrderActionField data;
CThostFtdcQryBatchOrderActionFieldWrapper(const CThostFtdcQryBatchOrderActionField& _data = { 0 }) :data(_data) { }
CThostFtdcQryBatchOrderActionFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryBatchOrderActionField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorID + "','" + data.ExchangeID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcQryBatchOrderActionField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcCombInstrumentGuardFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcCombInstrumentGuardField data;
CThostFtdcCombInstrumentGuardFieldWrapper(const CThostFtdcCombInstrumentGuardField& _data = { 0 }) :data(_data) { }
CThostFtdcCombInstrumentGuardFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcCombInstrumentGuardField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
data.GuarantRatio = std::stod(rowValue.at("GuarantRatio"));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.reserve1 + "','" + std::to_string(data.GuarantRatio) + "','" + data.ExchangeID + "','" + data.InstrumentID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcQryCombInstrumentGuardFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryCombInstrumentGuardField data;
CThostFtdcQryCombInstrumentGuardFieldWrapper(const CThostFtdcQryCombInstrumentGuardField& _data = { 0 }) :data(_data) { }
CThostFtdcQryCombInstrumentGuardFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryCombInstrumentGuardField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.reserve1 + "','" + data.ExchangeID + "','" + data.InstrumentID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcInputCombActionFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcInputCombActionField data;
CThostFtdcInputCombActionFieldWrapper(const CThostFtdcInputCombActionField& _data = { 0 }) :data(_data) { }
CThostFtdcInputCombActionFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcInputCombActionField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
strncpy(data.CombActionRef, rowValue.at("CombActionRef").c_str(), sizeof(TThostFtdcOrderRefType));
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
data.Direction = rowValue.at("Direction").empty() ? '0' : rowValue.at("Direction")[0];
data.Volume = std::stoi(rowValue.at("Volume"));
data.CombDirection = rowValue.at("CombDirection").empty() ? '0' : rowValue.at("CombDirection")[0];
data.HedgeFlag = rowValue.at("HedgeFlag").empty() ? '0' : rowValue.at("HedgeFlag")[0];
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.reserve2, rowValue.at("reserve2").c_str(), sizeof(TThostFtdcOldIPAddressType));
strncpy(data.MacAddress, rowValue.at("MacAddress").c_str(), sizeof(TThostFtdcMacAddressType));
strncpy(data.InvestUnitID, rowValue.at("InvestUnitID").c_str(), sizeof(TThostFtdcInvestUnitIDType));
data.FrontID = std::stoi(rowValue.at("FrontID"));
data.SessionID = std::stoi(rowValue.at("SessionID"));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
strncpy(data.IPAddress, rowValue.at("IPAddress").c_str(), sizeof(TThostFtdcIPAddressType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorID + "','" + data.reserve1 + "','" + data.CombActionRef + "','" + data.UserID + "','" + (data.Direction == 0 ? '0' : data.Direction) + "','" + std::to_string(data.Volume) + "','" + (data.CombDirection == 0 ? '0' : data.CombDirection) + "','" + (data.HedgeFlag == 0 ? '0' : data.HedgeFlag) + "','" + data.ExchangeID + "','" + data.reserve2 + "','" + data.MacAddress + "','" + data.InvestUnitID + "','" + std::to_string(data.FrontID) + "','" + std::to_string(data.SessionID) + "','" + data.InstrumentID + "','" + data.IPAddress
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcInputCombActionField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcCombActionFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcCombActionField data;
CThostFtdcCombActionFieldWrapper(const CThostFtdcCombActionField& _data = { 0 }) :data(_data) { }
CThostFtdcCombActionFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcCombActionField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
strncpy(data.CombActionRef, rowValue.at("CombActionRef").c_str(), sizeof(TThostFtdcOrderRefType));
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
data.Direction = rowValue.at("Direction").empty() ? '0' : rowValue.at("Direction")[0];
data.Volume = std::stoi(rowValue.at("Volume"));
data.CombDirection = rowValue.at("CombDirection").empty() ? '0' : rowValue.at("CombDirection")[0];
data.HedgeFlag = rowValue.at("HedgeFlag").empty() ? '0' : rowValue.at("HedgeFlag")[0];
strncpy(data.ActionLocalID, rowValue.at("ActionLocalID").c_str(), sizeof(TThostFtdcOrderLocalIDType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.ParticipantID, rowValue.at("ParticipantID").c_str(), sizeof(TThostFtdcParticipantIDType));
strncpy(data.ClientID, rowValue.at("ClientID").c_str(), sizeof(TThostFtdcClientIDType));
strncpy(data.reserve2, rowValue.at("reserve2").c_str(), sizeof(TThostFtdcOldExchangeInstIDType));
strncpy(data.TraderID, rowValue.at("TraderID").c_str(), sizeof(TThostFtdcTraderIDType));
data.InstallID = std::stoi(rowValue.at("InstallID"));
data.ActionStatus = rowValue.at("ActionStatus").empty() ? '0' : rowValue.at("ActionStatus")[0];
data.NotifySequence = std::stoi(rowValue.at("NotifySequence"));
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcDateType));
data.SettlementID = std::stoi(rowValue.at("SettlementID"));
data.SequenceNo = std::stoi(rowValue.at("SequenceNo"));
data.FrontID = std::stoi(rowValue.at("FrontID"));
data.SessionID = std::stoi(rowValue.at("SessionID"));
strncpy(data.UserProductInfo, rowValue.at("UserProductInfo").c_str(), sizeof(TThostFtdcProductInfoType));
strncpy(data.StatusMsg, utf8_to_gbk(rowValue.at("StatusMsg")).c_str(), sizeof(TThostFtdcErrorMsgType));
strncpy(data.reserve3, rowValue.at("reserve3").c_str(), sizeof(TThostFtdcOldIPAddressType));
strncpy(data.MacAddress, rowValue.at("MacAddress").c_str(), sizeof(TThostFtdcMacAddressType));
strncpy(data.ComTradeID, rowValue.at("ComTradeID").c_str(), sizeof(TThostFtdcTradeIDType));
strncpy(data.BranchID, rowValue.at("BranchID").c_str(), sizeof(TThostFtdcBranchIDType));
strncpy(data.InvestUnitID, rowValue.at("InvestUnitID").c_str(), sizeof(TThostFtdcInvestUnitIDType));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
strncpy(data.ExchangeInstID, rowValue.at("ExchangeInstID").c_str(), sizeof(TThostFtdcExchangeInstIDType));
strncpy(data.IPAddress, rowValue.at("IPAddress").c_str(), sizeof(TThostFtdcIPAddressType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorID + "','" + data.reserve1 + "','" + data.CombActionRef + "','" + data.UserID + "','" + (data.Direction == 0 ? '0' : data.Direction) + "','" + std::to_string(data.Volume) + "','" + (data.CombDirection == 0 ? '0' : data.CombDirection) + "','" + (data.HedgeFlag == 0 ? '0' : data.HedgeFlag) + "','" + data.ActionLocalID + "','" + data.ExchangeID + "','" + data.ParticipantID + "','" + data.ClientID + "','" + data.reserve2 + "','" + data.TraderID + "','" + std::to_string(data.InstallID) + "','" + (data.ActionStatus == 0 ? '0' : data.ActionStatus) + "','" + std::to_string(data.NotifySequence) + "','" + data.TradingDay + "','" + std::to_string(data.SettlementID) + "','" + std::to_string(data.SequenceNo) + "','" + std::to_string(data.FrontID) + "','" + std::to_string(data.SessionID) + "','" + data.UserProductInfo + "','" + gbk_to_utf8(data.StatusMsg) + "','" + data.reserve3 + "','" + data.MacAddress + "','" + data.ComTradeID + "','" + data.BranchID + "','" + data.InvestUnitID + "','" + data.InstrumentID + "','" + data.ExchangeInstID + "','" + data.IPAddress
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcCombActionField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcQryCombActionFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryCombActionField data;
CThostFtdcQryCombActionFieldWrapper(const CThostFtdcQryCombActionField& _data = { 0 }) :data(_data) { }
CThostFtdcQryCombActionFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryCombActionField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.InvestUnitID, rowValue.at("InvestUnitID").c_str(), sizeof(TThostFtdcInvestUnitIDType));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorID + "','" + data.reserve1 + "','" + data.ExchangeID + "','" + data.InvestUnitID + "','" + data.InstrumentID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcQryCombActionField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcExchangeCombActionFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcExchangeCombActionField data;
CThostFtdcExchangeCombActionFieldWrapper(const CThostFtdcExchangeCombActionField& _data = { 0 }) :data(_data) { }
CThostFtdcExchangeCombActionFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcExchangeCombActionField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
data.Direction = rowValue.at("Direction").empty() ? '0' : rowValue.at("Direction")[0];
data.Volume = std::stoi(rowValue.at("Volume"));
data.CombDirection = rowValue.at("CombDirection").empty() ? '0' : rowValue.at("CombDirection")[0];
data.HedgeFlag = rowValue.at("HedgeFlag").empty() ? '0' : rowValue.at("HedgeFlag")[0];
strncpy(data.ActionLocalID, rowValue.at("ActionLocalID").c_str(), sizeof(TThostFtdcOrderLocalIDType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.ParticipantID, rowValue.at("ParticipantID").c_str(), sizeof(TThostFtdcParticipantIDType));
strncpy(data.ClientID, rowValue.at("ClientID").c_str(), sizeof(TThostFtdcClientIDType));
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldExchangeInstIDType));
strncpy(data.TraderID, rowValue.at("TraderID").c_str(), sizeof(TThostFtdcTraderIDType));
data.InstallID = std::stoi(rowValue.at("InstallID"));
data.ActionStatus = rowValue.at("ActionStatus").empty() ? '0' : rowValue.at("ActionStatus")[0];
data.NotifySequence = std::stoi(rowValue.at("NotifySequence"));
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcDateType));
data.SettlementID = std::stoi(rowValue.at("SettlementID"));
data.SequenceNo = std::stoi(rowValue.at("SequenceNo"));
strncpy(data.reserve2, rowValue.at("reserve2").c_str(), sizeof(TThostFtdcOldIPAddressType));
strncpy(data.MacAddress, rowValue.at("MacAddress").c_str(), sizeof(TThostFtdcMacAddressType));
strncpy(data.ComTradeID, rowValue.at("ComTradeID").c_str(), sizeof(TThostFtdcTradeIDType));
strncpy(data.BranchID, rowValue.at("BranchID").c_str(), sizeof(TThostFtdcBranchIDType));
strncpy(data.ExchangeInstID, rowValue.at("ExchangeInstID").c_str(), sizeof(TThostFtdcExchangeInstIDType));
strncpy(data.IPAddress, rowValue.at("IPAddress").c_str(), sizeof(TThostFtdcIPAddressType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
(data.Direction == 0 ? '0' : data.Direction) + "','" + std::to_string(data.Volume) + "','" + (data.CombDirection == 0 ? '0' : data.CombDirection) + "','" + (data.HedgeFlag == 0 ? '0' : data.HedgeFlag) + "','" + data.ActionLocalID + "','" + data.ExchangeID + "','" + data.ParticipantID + "','" + data.ClientID + "','" + data.reserve1 + "','" + data.TraderID + "','" + std::to_string(data.InstallID) + "','" + (data.ActionStatus == 0 ? '0' : data.ActionStatus) + "','" + std::to_string(data.NotifySequence) + "','" + data.TradingDay + "','" + std::to_string(data.SettlementID) + "','" + std::to_string(data.SequenceNo) + "','" + data.reserve2 + "','" + data.MacAddress + "','" + data.ComTradeID + "','" + data.BranchID + "','" + data.ExchangeInstID + "','" + data.IPAddress
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcQryExchangeCombActionFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryExchangeCombActionField data;
CThostFtdcQryExchangeCombActionFieldWrapper(const CThostFtdcQryExchangeCombActionField& _data = { 0 }) :data(_data) { }
CThostFtdcQryExchangeCombActionFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryExchangeCombActionField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.ParticipantID, rowValue.at("ParticipantID").c_str(), sizeof(TThostFtdcParticipantIDType));
strncpy(data.ClientID, rowValue.at("ClientID").c_str(), sizeof(TThostFtdcClientIDType));
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldExchangeInstIDType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.TraderID, rowValue.at("TraderID").c_str(), sizeof(TThostFtdcTraderIDType));
strncpy(data.ExchangeInstID, rowValue.at("ExchangeInstID").c_str(), sizeof(TThostFtdcExchangeInstIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.ParticipantID + "','" + data.ClientID + "','" + data.reserve1 + "','" + data.ExchangeID + "','" + data.TraderID + "','" + data.ExchangeInstID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcProductExchRateFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcProductExchRateField data;
CThostFtdcProductExchRateFieldWrapper(const CThostFtdcProductExchRateField& _data = { 0 }) :data(_data) { }
CThostFtdcProductExchRateFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcProductExchRateField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
strncpy(data.QuoteCurrencyID, rowValue.at("QuoteCurrencyID").c_str(), sizeof(TThostFtdcCurrencyIDType));
data.ExchangeRate = std::stod(rowValue.at("ExchangeRate"));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.ProductID, rowValue.at("ProductID").c_str(), sizeof(TThostFtdcInstrumentIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.reserve1 + "','" + data.QuoteCurrencyID + "','" + std::to_string(data.ExchangeRate) + "','" + data.ExchangeID + "','" + data.ProductID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcQryProductExchRateFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryProductExchRateField data;
CThostFtdcQryProductExchRateFieldWrapper(const CThostFtdcQryProductExchRateField& _data = { 0 }) :data(_data) { }
CThostFtdcQryProductExchRateFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryProductExchRateField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.ProductID, rowValue.at("ProductID").c_str(), sizeof(TThostFtdcInstrumentIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.reserve1 + "','" + data.ExchangeID + "','" + data.ProductID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcQryForQuoteParamFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryForQuoteParamField data;
CThostFtdcQryForQuoteParamFieldWrapper(const CThostFtdcQryForQuoteParamField& _data = { 0 }) :data(_data) { }
CThostFtdcQryForQuoteParamFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryForQuoteParamField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.reserve1 + "','" + data.ExchangeID + "','" + data.InstrumentID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcForQuoteParamFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcForQuoteParamField data;
CThostFtdcForQuoteParamFieldWrapper(const CThostFtdcForQuoteParamField& _data = { 0 }) :data(_data) { }
CThostFtdcForQuoteParamFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcForQuoteParamField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
data.LastPrice = std::stod(rowValue.at("LastPrice"));
data.PriceInterval = std::stod(rowValue.at("PriceInterval"));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.reserve1 + "','" + data.ExchangeID + "','" + std::to_string(data.LastPrice) + "','" + std::to_string(data.PriceInterval) + "','" + data.InstrumentID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcMMOptionInstrCommRateFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcMMOptionInstrCommRateField data;
CThostFtdcMMOptionInstrCommRateFieldWrapper(const CThostFtdcMMOptionInstrCommRateField& _data = { 0 }) :data(_data) { }
CThostFtdcMMOptionInstrCommRateFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcMMOptionInstrCommRateField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
data.InvestorRange = rowValue.at("InvestorRange").empty() ? '0' : rowValue.at("InvestorRange")[0];
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
data.OpenRatioByMoney = std::stod(rowValue.at("OpenRatioByMoney"));
data.OpenRatioByVolume = std::stod(rowValue.at("OpenRatioByVolume"));
data.CloseRatioByMoney = std::stod(rowValue.at("CloseRatioByMoney"));
data.CloseRatioByVolume = std::stod(rowValue.at("CloseRatioByVolume"));
data.CloseTodayRatioByMoney = std::stod(rowValue.at("CloseTodayRatioByMoney"));
data.CloseTodayRatioByVolume = std::stod(rowValue.at("CloseTodayRatioByVolume"));
data.StrikeRatioByMoney = std::stod(rowValue.at("StrikeRatioByMoney"));
data.StrikeRatioByVolume = std::stod(rowValue.at("StrikeRatioByVolume"));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.reserve1 + "','" + (data.InvestorRange == 0 ? '0' : data.InvestorRange) + "','" + data.BrokerID + "','" + data.InvestorID + "','" + std::to_string(data.OpenRatioByMoney) + "','" + std::to_string(data.OpenRatioByVolume) + "','" + std::to_string(data.CloseRatioByMoney) + "','" + std::to_string(data.CloseRatioByVolume) + "','" + std::to_string(data.CloseTodayRatioByMoney) + "','" + std::to_string(data.CloseTodayRatioByVolume) + "','" + std::to_string(data.StrikeRatioByMoney) + "','" + std::to_string(data.StrikeRatioByVolume) + "','" + data.InstrumentID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcMMOptionInstrCommRateField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcQryMMOptionInstrCommRateFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryMMOptionInstrCommRateField data;
CThostFtdcQryMMOptionInstrCommRateFieldWrapper(const CThostFtdcQryMMOptionInstrCommRateField& _data = { 0 }) :data(_data) { }
CThostFtdcQryMMOptionInstrCommRateFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryMMOptionInstrCommRateField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorID + "','" + data.reserve1 + "','" + data.InstrumentID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcQryMMOptionInstrCommRateField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcMMInstrumentCommissionRateFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcMMInstrumentCommissionRateField data;
CThostFtdcMMInstrumentCommissionRateFieldWrapper(const CThostFtdcMMInstrumentCommissionRateField& _data = { 0 }) :data(_data) { }
CThostFtdcMMInstrumentCommissionRateFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcMMInstrumentCommissionRateField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
data.InvestorRange = rowValue.at("InvestorRange").empty() ? '0' : rowValue.at("InvestorRange")[0];
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
data.OpenRatioByMoney = std::stod(rowValue.at("OpenRatioByMoney"));
data.OpenRatioByVolume = std::stod(rowValue.at("OpenRatioByVolume"));
data.CloseRatioByMoney = std::stod(rowValue.at("CloseRatioByMoney"));
data.CloseRatioByVolume = std::stod(rowValue.at("CloseRatioByVolume"));
data.CloseTodayRatioByMoney = std::stod(rowValue.at("CloseTodayRatioByMoney"));
data.CloseTodayRatioByVolume = std::stod(rowValue.at("CloseTodayRatioByVolume"));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.reserve1 + "','" + (data.InvestorRange == 0 ? '0' : data.InvestorRange) + "','" + data.BrokerID + "','" + data.InvestorID + "','" + std::to_string(data.OpenRatioByMoney) + "','" + std::to_string(data.OpenRatioByVolume) + "','" + std::to_string(data.CloseRatioByMoney) + "','" + std::to_string(data.CloseRatioByVolume) + "','" + std::to_string(data.CloseTodayRatioByMoney) + "','" + std::to_string(data.CloseTodayRatioByVolume) + "','" + data.InstrumentID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcMMInstrumentCommissionRateField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcQryMMInstrumentCommissionRateFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryMMInstrumentCommissionRateField data;
CThostFtdcQryMMInstrumentCommissionRateFieldWrapper(const CThostFtdcQryMMInstrumentCommissionRateField& _data = { 0 }) :data(_data) { }
CThostFtdcQryMMInstrumentCommissionRateFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryMMInstrumentCommissionRateField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorID + "','" + data.reserve1 + "','" + data.InstrumentID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcQryMMInstrumentCommissionRateField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcInstrumentOrderCommRateFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcInstrumentOrderCommRateField data;
CThostFtdcInstrumentOrderCommRateFieldWrapper(const CThostFtdcInstrumentOrderCommRateField& _data = { 0 }) :data(_data) { }
CThostFtdcInstrumentOrderCommRateFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcInstrumentOrderCommRateField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
data.InvestorRange = rowValue.at("InvestorRange").empty() ? '0' : rowValue.at("InvestorRange")[0];
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
data.HedgeFlag = rowValue.at("HedgeFlag").empty() ? '0' : rowValue.at("HedgeFlag")[0];
data.OrderCommByVolume = std::stod(rowValue.at("OrderCommByVolume"));
data.OrderActionCommByVolume = std::stod(rowValue.at("OrderActionCommByVolume"));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.InvestUnitID, rowValue.at("InvestUnitID").c_str(), sizeof(TThostFtdcInvestUnitIDType));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
data.OrderCommByTrade = std::stod(rowValue.at("OrderCommByTrade"));
data.OrderActionCommByTrade = std::stod(rowValue.at("OrderActionCommByTrade"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.reserve1 + "','" + (data.InvestorRange == 0 ? '0' : data.InvestorRange) + "','" + data.BrokerID + "','" + data.InvestorID + "','" + (data.HedgeFlag == 0 ? '0' : data.HedgeFlag) + "','" + std::to_string(data.OrderCommByVolume) + "','" + std::to_string(data.OrderActionCommByVolume) + "','" + data.ExchangeID + "','" + data.InvestUnitID + "','" + data.InstrumentID + "','" + std::to_string(data.OrderCommByTrade) + "','" + std::to_string(data.OrderActionCommByTrade)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcInstrumentOrderCommRateField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcQryInstrumentOrderCommRateFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryInstrumentOrderCommRateField data;
CThostFtdcQryInstrumentOrderCommRateFieldWrapper(const CThostFtdcQryInstrumentOrderCommRateField& _data = { 0 }) :data(_data) { }
CThostFtdcQryInstrumentOrderCommRateFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryInstrumentOrderCommRateField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorID + "','" + data.reserve1 + "','" + data.InstrumentID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcQryInstrumentOrderCommRateField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcTradeParamFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcTradeParamField data;
CThostFtdcTradeParamFieldWrapper(const CThostFtdcTradeParamField& _data = { 0 }) :data(_data) { }
CThostFtdcTradeParamFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcTradeParamField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
data.TradeParamID = rowValue.at("TradeParamID").empty() ? '0' : rowValue.at("TradeParamID")[0];
strncpy(data.TradeParamValue, rowValue.at("TradeParamValue").c_str(), sizeof(TThostFtdcSettlementParamValueType));
strncpy(data.Memo, rowValue.at("Memo").c_str(), sizeof(TThostFtdcMemoType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + (data.TradeParamID == 0 ? '0' : data.TradeParamID) + "','" + data.TradeParamValue + "','" + data.Memo
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcInstrumentMarginRateULFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcInstrumentMarginRateULField data;
CThostFtdcInstrumentMarginRateULFieldWrapper(const CThostFtdcInstrumentMarginRateULField& _data = { 0 }) :data(_data) { }
CThostFtdcInstrumentMarginRateULFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcInstrumentMarginRateULField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
data.InvestorRange = rowValue.at("InvestorRange").empty() ? '0' : rowValue.at("InvestorRange")[0];
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
data.HedgeFlag = rowValue.at("HedgeFlag").empty() ? '0' : rowValue.at("HedgeFlag")[0];
data.LongMarginRatioByMoney = std::stod(rowValue.at("LongMarginRatioByMoney"));
data.LongMarginRatioByVolume = std::stod(rowValue.at("LongMarginRatioByVolume"));
data.ShortMarginRatioByMoney = std::stod(rowValue.at("ShortMarginRatioByMoney"));
data.ShortMarginRatioByVolume = std::stod(rowValue.at("ShortMarginRatioByVolume"));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.reserve1 + "','" + (data.InvestorRange == 0 ? '0' : data.InvestorRange) + "','" + data.BrokerID + "','" + data.InvestorID + "','" + (data.HedgeFlag == 0 ? '0' : data.HedgeFlag) + "','" + std::to_string(data.LongMarginRatioByMoney) + "','" + std::to_string(data.LongMarginRatioByVolume) + "','" + std::to_string(data.ShortMarginRatioByMoney) + "','" + std::to_string(data.ShortMarginRatioByVolume) + "','" + data.InstrumentID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcInstrumentMarginRateULField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcFutureLimitPosiParamFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcFutureLimitPosiParamField data;
CThostFtdcFutureLimitPosiParamFieldWrapper(const CThostFtdcFutureLimitPosiParamField& _data = { 0 }) :data(_data) { }
CThostFtdcFutureLimitPosiParamFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcFutureLimitPosiParamField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
data.InvestorRange = rowValue.at("InvestorRange").empty() ? '0' : rowValue.at("InvestorRange")[0];
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
data.SpecOpenVolume = std::stoi(rowValue.at("SpecOpenVolume"));
data.ArbiOpenVolume = std::stoi(rowValue.at("ArbiOpenVolume"));
data.OpenVolume = std::stoi(rowValue.at("OpenVolume"));
strncpy(data.ProductID, rowValue.at("ProductID").c_str(), sizeof(TThostFtdcInstrumentIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
(data.InvestorRange == 0 ? '0' : data.InvestorRange) + "','" + data.BrokerID + "','" + data.InvestorID + "','" + data.reserve1 + "','" + std::to_string(data.SpecOpenVolume) + "','" + std::to_string(data.ArbiOpenVolume) + "','" + std::to_string(data.OpenVolume) + "','" + data.ProductID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcFutureLimitPosiParamField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcLoginForbiddenIPFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcLoginForbiddenIPField data;
CThostFtdcLoginForbiddenIPFieldWrapper(const CThostFtdcLoginForbiddenIPField& _data = { 0 }) :data(_data) { }
CThostFtdcLoginForbiddenIPFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcLoginForbiddenIPField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldIPAddressType));
strncpy(data.IPAddress, rowValue.at("IPAddress").c_str(), sizeof(TThostFtdcIPAddressType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.reserve1 + "','" + data.IPAddress
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcIPListFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcIPListField data;
CThostFtdcIPListFieldWrapper(const CThostFtdcIPListField& _data = { 0 }) :data(_data) { }
CThostFtdcIPListFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcIPListField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldIPAddressType));
data.IsWhite = std::stoi(rowValue.at("IsWhite"));
strncpy(data.IPAddress, rowValue.at("IPAddress").c_str(), sizeof(TThostFtdcIPAddressType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.reserve1 + "','" + std::to_string(data.IsWhite) + "','" + data.IPAddress
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcInputOptionSelfCloseFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcInputOptionSelfCloseField data;
CThostFtdcInputOptionSelfCloseFieldWrapper(const CThostFtdcInputOptionSelfCloseField& _data = { 0 }) :data(_data) { }
CThostFtdcInputOptionSelfCloseFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcInputOptionSelfCloseField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
strncpy(data.OptionSelfCloseRef, rowValue.at("OptionSelfCloseRef").c_str(), sizeof(TThostFtdcOrderRefType));
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
data.Volume = std::stoi(rowValue.at("Volume"));
data.RequestID = std::stoi(rowValue.at("RequestID"));
strncpy(data.BusinessUnit, rowValue.at("BusinessUnit").c_str(), sizeof(TThostFtdcBusinessUnitType));
data.HedgeFlag = rowValue.at("HedgeFlag").empty() ? '0' : rowValue.at("HedgeFlag")[0];
data.OptSelfCloseFlag = rowValue.at("OptSelfCloseFlag").empty() ? '0' : rowValue.at("OptSelfCloseFlag")[0];
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.InvestUnitID, rowValue.at("InvestUnitID").c_str(), sizeof(TThostFtdcInvestUnitIDType));
strncpy(data.AccountID, rowValue.at("AccountID").c_str(), sizeof(TThostFtdcAccountIDType));
strncpy(data.CurrencyID, rowValue.at("CurrencyID").c_str(), sizeof(TThostFtdcCurrencyIDType));
strncpy(data.ClientID, rowValue.at("ClientID").c_str(), sizeof(TThostFtdcClientIDType));
strncpy(data.reserve2, rowValue.at("reserve2").c_str(), sizeof(TThostFtdcOldIPAddressType));
strncpy(data.MacAddress, rowValue.at("MacAddress").c_str(), sizeof(TThostFtdcMacAddressType));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
strncpy(data.IPAddress, rowValue.at("IPAddress").c_str(), sizeof(TThostFtdcIPAddressType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorID + "','" + data.reserve1 + "','" + data.OptionSelfCloseRef + "','" + data.UserID + "','" + std::to_string(data.Volume) + "','" + std::to_string(data.RequestID) + "','" + data.BusinessUnit + "','" + (data.HedgeFlag == 0 ? '0' : data.HedgeFlag) + "','" + (data.OptSelfCloseFlag == 0 ? '0' : data.OptSelfCloseFlag) + "','" + data.ExchangeID + "','" + data.InvestUnitID + "','" + data.AccountID + "','" + data.CurrencyID + "','" + data.ClientID + "','" + data.reserve2 + "','" + data.MacAddress + "','" + data.InstrumentID + "','" + data.IPAddress
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcInputOptionSelfCloseField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcInputOptionSelfCloseActionFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcInputOptionSelfCloseActionField data;
CThostFtdcInputOptionSelfCloseActionFieldWrapper(const CThostFtdcInputOptionSelfCloseActionField& _data = { 0 }) :data(_data) { }
CThostFtdcInputOptionSelfCloseActionFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcInputOptionSelfCloseActionField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
data.OptionSelfCloseActionRef = std::stoi(rowValue.at("OptionSelfCloseActionRef"));
strncpy(data.OptionSelfCloseRef, rowValue.at("OptionSelfCloseRef").c_str(), sizeof(TThostFtdcOrderRefType));
data.RequestID = std::stoi(rowValue.at("RequestID"));
data.FrontID = std::stoi(rowValue.at("FrontID"));
data.SessionID = std::stoi(rowValue.at("SessionID"));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.OptionSelfCloseSysID, rowValue.at("OptionSelfCloseSysID").c_str(), sizeof(TThostFtdcOrderSysIDType));
data.ActionFlag = rowValue.at("ActionFlag").empty() ? '0' : rowValue.at("ActionFlag")[0];
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
strncpy(data.InvestUnitID, rowValue.at("InvestUnitID").c_str(), sizeof(TThostFtdcInvestUnitIDType));
strncpy(data.reserve2, rowValue.at("reserve2").c_str(), sizeof(TThostFtdcOldIPAddressType));
strncpy(data.MacAddress, rowValue.at("MacAddress").c_str(), sizeof(TThostFtdcMacAddressType));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
strncpy(data.IPAddress, rowValue.at("IPAddress").c_str(), sizeof(TThostFtdcIPAddressType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorID + "','" + std::to_string(data.OptionSelfCloseActionRef) + "','" + data.OptionSelfCloseRef + "','" + std::to_string(data.RequestID) + "','" + std::to_string(data.FrontID) + "','" + std::to_string(data.SessionID) + "','" + data.ExchangeID + "','" + data.OptionSelfCloseSysID + "','" + (data.ActionFlag == 0 ? '0' : data.ActionFlag) + "','" + data.UserID + "','" + data.reserve1 + "','" + data.InvestUnitID + "','" + data.reserve2 + "','" + data.MacAddress + "','" + data.InstrumentID + "','" + data.IPAddress
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcInputOptionSelfCloseActionField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcOptionSelfCloseFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcOptionSelfCloseField data;
CThostFtdcOptionSelfCloseFieldWrapper(const CThostFtdcOptionSelfCloseField& _data = { 0 }) :data(_data) { }
CThostFtdcOptionSelfCloseFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcOptionSelfCloseField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
strncpy(data.OptionSelfCloseRef, rowValue.at("OptionSelfCloseRef").c_str(), sizeof(TThostFtdcOrderRefType));
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
data.Volume = std::stoi(rowValue.at("Volume"));
data.RequestID = std::stoi(rowValue.at("RequestID"));
strncpy(data.BusinessUnit, rowValue.at("BusinessUnit").c_str(), sizeof(TThostFtdcBusinessUnitType));
data.HedgeFlag = rowValue.at("HedgeFlag").empty() ? '0' : rowValue.at("HedgeFlag")[0];
data.OptSelfCloseFlag = rowValue.at("OptSelfCloseFlag").empty() ? '0' : rowValue.at("OptSelfCloseFlag")[0];
strncpy(data.OptionSelfCloseLocalID, rowValue.at("OptionSelfCloseLocalID").c_str(), sizeof(TThostFtdcOrderLocalIDType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.ParticipantID, rowValue.at("ParticipantID").c_str(), sizeof(TThostFtdcParticipantIDType));
strncpy(data.ClientID, rowValue.at("ClientID").c_str(), sizeof(TThostFtdcClientIDType));
strncpy(data.reserve2, rowValue.at("reserve2").c_str(), sizeof(TThostFtdcOldExchangeInstIDType));
strncpy(data.TraderID, rowValue.at("TraderID").c_str(), sizeof(TThostFtdcTraderIDType));
data.InstallID = std::stoi(rowValue.at("InstallID"));
data.OrderSubmitStatus = rowValue.at("OrderSubmitStatus").empty() ? '0' : rowValue.at("OrderSubmitStatus")[0];
data.NotifySequence = std::stoi(rowValue.at("NotifySequence"));
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcDateType));
data.SettlementID = std::stoi(rowValue.at("SettlementID"));
strncpy(data.OptionSelfCloseSysID, rowValue.at("OptionSelfCloseSysID").c_str(), sizeof(TThostFtdcOrderSysIDType));
strncpy(data.InsertDate, rowValue.at("InsertDate").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.InsertTime, rowValue.at("InsertTime").c_str(), sizeof(TThostFtdcTimeType));
strncpy(data.CancelTime, rowValue.at("CancelTime").c_str(), sizeof(TThostFtdcTimeType));
data.ExecResult = rowValue.at("ExecResult").empty() ? '0' : rowValue.at("ExecResult")[0];
strncpy(data.ClearingPartID, rowValue.at("ClearingPartID").c_str(), sizeof(TThostFtdcParticipantIDType));
data.SequenceNo = std::stoi(rowValue.at("SequenceNo"));
data.FrontID = std::stoi(rowValue.at("FrontID"));
data.SessionID = std::stoi(rowValue.at("SessionID"));
strncpy(data.UserProductInfo, rowValue.at("UserProductInfo").c_str(), sizeof(TThostFtdcProductInfoType));
strncpy(data.StatusMsg, utf8_to_gbk(rowValue.at("StatusMsg")).c_str(), sizeof(TThostFtdcErrorMsgType));
strncpy(data.ActiveUserID, rowValue.at("ActiveUserID").c_str(), sizeof(TThostFtdcUserIDType));
data.BrokerOptionSelfCloseSeq = std::stoi(rowValue.at("BrokerOptionSelfCloseSeq"));
strncpy(data.BranchID, rowValue.at("BranchID").c_str(), sizeof(TThostFtdcBranchIDType));
strncpy(data.InvestUnitID, rowValue.at("InvestUnitID").c_str(), sizeof(TThostFtdcInvestUnitIDType));
strncpy(data.AccountID, rowValue.at("AccountID").c_str(), sizeof(TThostFtdcAccountIDType));
strncpy(data.CurrencyID, rowValue.at("CurrencyID").c_str(), sizeof(TThostFtdcCurrencyIDType));
strncpy(data.reserve3, rowValue.at("reserve3").c_str(), sizeof(TThostFtdcOldIPAddressType));
strncpy(data.MacAddress, rowValue.at("MacAddress").c_str(), sizeof(TThostFtdcMacAddressType));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
strncpy(data.ExchangeInstID, rowValue.at("ExchangeInstID").c_str(), sizeof(TThostFtdcExchangeInstIDType));
strncpy(data.IPAddress, rowValue.at("IPAddress").c_str(), sizeof(TThostFtdcIPAddressType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorID + "','" + data.reserve1 + "','" + data.OptionSelfCloseRef + "','" + data.UserID + "','" + std::to_string(data.Volume) + "','" + std::to_string(data.RequestID) + "','" + data.BusinessUnit + "','" + (data.HedgeFlag == 0 ? '0' : data.HedgeFlag) + "','" + (data.OptSelfCloseFlag == 0 ? '0' : data.OptSelfCloseFlag) + "','" + data.OptionSelfCloseLocalID + "','" + data.ExchangeID + "','" + data.ParticipantID + "','" + data.ClientID + "','" + data.reserve2 + "','" + data.TraderID + "','" + std::to_string(data.InstallID) + "','" + (data.OrderSubmitStatus == 0 ? '0' : data.OrderSubmitStatus) + "','" + std::to_string(data.NotifySequence) + "','" + data.TradingDay + "','" + std::to_string(data.SettlementID) + "','" + data.OptionSelfCloseSysID + "','" + data.InsertDate + "','" + data.InsertTime + "','" + data.CancelTime + "','" + (data.ExecResult == 0 ? '0' : data.ExecResult) + "','" + data.ClearingPartID + "','" + std::to_string(data.SequenceNo) + "','" + std::to_string(data.FrontID) + "','" + std::to_string(data.SessionID) + "','" + data.UserProductInfo + "','" + gbk_to_utf8(data.StatusMsg) + "','" + data.ActiveUserID + "','" + std::to_string(data.BrokerOptionSelfCloseSeq) + "','" + data.BranchID + "','" + data.InvestUnitID + "','" + data.AccountID + "','" + data.CurrencyID + "','" + data.reserve3 + "','" + data.MacAddress + "','" + data.InstrumentID + "','" + data.ExchangeInstID + "','" + data.IPAddress
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcOptionSelfCloseField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcOptionSelfCloseActionFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcOptionSelfCloseActionField data;
CThostFtdcOptionSelfCloseActionFieldWrapper(const CThostFtdcOptionSelfCloseActionField& _data = { 0 }) :data(_data) { }
CThostFtdcOptionSelfCloseActionFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcOptionSelfCloseActionField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
data.OptionSelfCloseActionRef = std::stoi(rowValue.at("OptionSelfCloseActionRef"));
strncpy(data.OptionSelfCloseRef, rowValue.at("OptionSelfCloseRef").c_str(), sizeof(TThostFtdcOrderRefType));
data.RequestID = std::stoi(rowValue.at("RequestID"));
data.FrontID = std::stoi(rowValue.at("FrontID"));
data.SessionID = std::stoi(rowValue.at("SessionID"));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.OptionSelfCloseSysID, rowValue.at("OptionSelfCloseSysID").c_str(), sizeof(TThostFtdcOrderSysIDType));
data.ActionFlag = rowValue.at("ActionFlag").empty() ? '0' : rowValue.at("ActionFlag")[0];
strncpy(data.ActionDate, rowValue.at("ActionDate").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.ActionTime, rowValue.at("ActionTime").c_str(), sizeof(TThostFtdcTimeType));
strncpy(data.TraderID, rowValue.at("TraderID").c_str(), sizeof(TThostFtdcTraderIDType));
data.InstallID = std::stoi(rowValue.at("InstallID"));
strncpy(data.OptionSelfCloseLocalID, rowValue.at("OptionSelfCloseLocalID").c_str(), sizeof(TThostFtdcOrderLocalIDType));
strncpy(data.ActionLocalID, rowValue.at("ActionLocalID").c_str(), sizeof(TThostFtdcOrderLocalIDType));
strncpy(data.ParticipantID, rowValue.at("ParticipantID").c_str(), sizeof(TThostFtdcParticipantIDType));
strncpy(data.ClientID, rowValue.at("ClientID").c_str(), sizeof(TThostFtdcClientIDType));
strncpy(data.BusinessUnit, rowValue.at("BusinessUnit").c_str(), sizeof(TThostFtdcBusinessUnitType));
data.OrderActionStatus = rowValue.at("OrderActionStatus").empty() ? '0' : rowValue.at("OrderActionStatus")[0];
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
strncpy(data.StatusMsg, utf8_to_gbk(rowValue.at("StatusMsg")).c_str(), sizeof(TThostFtdcErrorMsgType));
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
strncpy(data.BranchID, rowValue.at("BranchID").c_str(), sizeof(TThostFtdcBranchIDType));
strncpy(data.InvestUnitID, rowValue.at("InvestUnitID").c_str(), sizeof(TThostFtdcInvestUnitIDType));
strncpy(data.reserve2, rowValue.at("reserve2").c_str(), sizeof(TThostFtdcOldIPAddressType));
strncpy(data.MacAddress, rowValue.at("MacAddress").c_str(), sizeof(TThostFtdcMacAddressType));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
strncpy(data.IPAddress, rowValue.at("IPAddress").c_str(), sizeof(TThostFtdcIPAddressType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorID + "','" + std::to_string(data.OptionSelfCloseActionRef) + "','" + data.OptionSelfCloseRef + "','" + std::to_string(data.RequestID) + "','" + std::to_string(data.FrontID) + "','" + std::to_string(data.SessionID) + "','" + data.ExchangeID + "','" + data.OptionSelfCloseSysID + "','" + (data.ActionFlag == 0 ? '0' : data.ActionFlag) + "','" + data.ActionDate + "','" + data.ActionTime + "','" + data.TraderID + "','" + std::to_string(data.InstallID) + "','" + data.OptionSelfCloseLocalID + "','" + data.ActionLocalID + "','" + data.ParticipantID + "','" + data.ClientID + "','" + data.BusinessUnit + "','" + (data.OrderActionStatus == 0 ? '0' : data.OrderActionStatus) + "','" + data.UserID + "','" + gbk_to_utf8(data.StatusMsg) + "','" + data.reserve1 + "','" + data.BranchID + "','" + data.InvestUnitID + "','" + data.reserve2 + "','" + data.MacAddress + "','" + data.InstrumentID + "','" + data.IPAddress
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcOptionSelfCloseActionField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcQryOptionSelfCloseFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryOptionSelfCloseField data;
CThostFtdcQryOptionSelfCloseFieldWrapper(const CThostFtdcQryOptionSelfCloseField& _data = { 0 }) :data(_data) { }
CThostFtdcQryOptionSelfCloseFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryOptionSelfCloseField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.OptionSelfCloseSysID, rowValue.at("OptionSelfCloseSysID").c_str(), sizeof(TThostFtdcOrderSysIDType));
strncpy(data.InsertTimeStart, rowValue.at("InsertTimeStart").c_str(), sizeof(TThostFtdcTimeType));
strncpy(data.InsertTimeEnd, rowValue.at("InsertTimeEnd").c_str(), sizeof(TThostFtdcTimeType));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorID + "','" + data.reserve1 + "','" + data.ExchangeID + "','" + data.OptionSelfCloseSysID + "','" + data.InsertTimeStart + "','" + data.InsertTimeEnd + "','" + data.InstrumentID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcQryOptionSelfCloseField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcExchangeOptionSelfCloseFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcExchangeOptionSelfCloseField data;
CThostFtdcExchangeOptionSelfCloseFieldWrapper(const CThostFtdcExchangeOptionSelfCloseField& _data = { 0 }) :data(_data) { }
CThostFtdcExchangeOptionSelfCloseFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcExchangeOptionSelfCloseField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
data.Volume = std::stoi(rowValue.at("Volume"));
data.RequestID = std::stoi(rowValue.at("RequestID"));
strncpy(data.BusinessUnit, rowValue.at("BusinessUnit").c_str(), sizeof(TThostFtdcBusinessUnitType));
data.HedgeFlag = rowValue.at("HedgeFlag").empty() ? '0' : rowValue.at("HedgeFlag")[0];
data.OptSelfCloseFlag = rowValue.at("OptSelfCloseFlag").empty() ? '0' : rowValue.at("OptSelfCloseFlag")[0];
strncpy(data.OptionSelfCloseLocalID, rowValue.at("OptionSelfCloseLocalID").c_str(), sizeof(TThostFtdcOrderLocalIDType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.ParticipantID, rowValue.at("ParticipantID").c_str(), sizeof(TThostFtdcParticipantIDType));
strncpy(data.ClientID, rowValue.at("ClientID").c_str(), sizeof(TThostFtdcClientIDType));
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldExchangeInstIDType));
strncpy(data.TraderID, rowValue.at("TraderID").c_str(), sizeof(TThostFtdcTraderIDType));
data.InstallID = std::stoi(rowValue.at("InstallID"));
data.OrderSubmitStatus = rowValue.at("OrderSubmitStatus").empty() ? '0' : rowValue.at("OrderSubmitStatus")[0];
data.NotifySequence = std::stoi(rowValue.at("NotifySequence"));
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcDateType));
data.SettlementID = std::stoi(rowValue.at("SettlementID"));
strncpy(data.OptionSelfCloseSysID, rowValue.at("OptionSelfCloseSysID").c_str(), sizeof(TThostFtdcOrderSysIDType));
strncpy(data.InsertDate, rowValue.at("InsertDate").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.InsertTime, rowValue.at("InsertTime").c_str(), sizeof(TThostFtdcTimeType));
strncpy(data.CancelTime, rowValue.at("CancelTime").c_str(), sizeof(TThostFtdcTimeType));
data.ExecResult = rowValue.at("ExecResult").empty() ? '0' : rowValue.at("ExecResult")[0];
strncpy(data.ClearingPartID, rowValue.at("ClearingPartID").c_str(), sizeof(TThostFtdcParticipantIDType));
data.SequenceNo = std::stoi(rowValue.at("SequenceNo"));
strncpy(data.BranchID, rowValue.at("BranchID").c_str(), sizeof(TThostFtdcBranchIDType));
strncpy(data.reserve2, rowValue.at("reserve2").c_str(), sizeof(TThostFtdcOldIPAddressType));
strncpy(data.MacAddress, rowValue.at("MacAddress").c_str(), sizeof(TThostFtdcMacAddressType));
strncpy(data.ExchangeInstID, rowValue.at("ExchangeInstID").c_str(), sizeof(TThostFtdcExchangeInstIDType));
strncpy(data.IPAddress, rowValue.at("IPAddress").c_str(), sizeof(TThostFtdcIPAddressType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
std::to_string(data.Volume) + "','" + std::to_string(data.RequestID) + "','" + data.BusinessUnit + "','" + (data.HedgeFlag == 0 ? '0' : data.HedgeFlag) + "','" + (data.OptSelfCloseFlag == 0 ? '0' : data.OptSelfCloseFlag) + "','" + data.OptionSelfCloseLocalID + "','" + data.ExchangeID + "','" + data.ParticipantID + "','" + data.ClientID + "','" + data.reserve1 + "','" + data.TraderID + "','" + std::to_string(data.InstallID) + "','" + (data.OrderSubmitStatus == 0 ? '0' : data.OrderSubmitStatus) + "','" + std::to_string(data.NotifySequence) + "','" + data.TradingDay + "','" + std::to_string(data.SettlementID) + "','" + data.OptionSelfCloseSysID + "','" + data.InsertDate + "','" + data.InsertTime + "','" + data.CancelTime + "','" + (data.ExecResult == 0 ? '0' : data.ExecResult) + "','" + data.ClearingPartID + "','" + std::to_string(data.SequenceNo) + "','" + data.BranchID + "','" + data.reserve2 + "','" + data.MacAddress + "','" + data.ExchangeInstID + "','" + data.IPAddress
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcQryOptionSelfCloseActionFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryOptionSelfCloseActionField data;
CThostFtdcQryOptionSelfCloseActionFieldWrapper(const CThostFtdcQryOptionSelfCloseActionField& _data = { 0 }) :data(_data) { }
CThostFtdcQryOptionSelfCloseActionFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryOptionSelfCloseActionField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorID + "','" + data.ExchangeID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcQryOptionSelfCloseActionField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcExchangeOptionSelfCloseActionFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcExchangeOptionSelfCloseActionField data;
CThostFtdcExchangeOptionSelfCloseActionFieldWrapper(const CThostFtdcExchangeOptionSelfCloseActionField& _data = { 0 }) :data(_data) { }
CThostFtdcExchangeOptionSelfCloseActionFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcExchangeOptionSelfCloseActionField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.OptionSelfCloseSysID, rowValue.at("OptionSelfCloseSysID").c_str(), sizeof(TThostFtdcOrderSysIDType));
data.ActionFlag = rowValue.at("ActionFlag").empty() ? '0' : rowValue.at("ActionFlag")[0];
strncpy(data.ActionDate, rowValue.at("ActionDate").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.ActionTime, rowValue.at("ActionTime").c_str(), sizeof(TThostFtdcTimeType));
strncpy(data.TraderID, rowValue.at("TraderID").c_str(), sizeof(TThostFtdcTraderIDType));
data.InstallID = std::stoi(rowValue.at("InstallID"));
strncpy(data.OptionSelfCloseLocalID, rowValue.at("OptionSelfCloseLocalID").c_str(), sizeof(TThostFtdcOrderLocalIDType));
strncpy(data.ActionLocalID, rowValue.at("ActionLocalID").c_str(), sizeof(TThostFtdcOrderLocalIDType));
strncpy(data.ParticipantID, rowValue.at("ParticipantID").c_str(), sizeof(TThostFtdcParticipantIDType));
strncpy(data.ClientID, rowValue.at("ClientID").c_str(), sizeof(TThostFtdcClientIDType));
strncpy(data.BusinessUnit, rowValue.at("BusinessUnit").c_str(), sizeof(TThostFtdcBusinessUnitType));
data.OrderActionStatus = rowValue.at("OrderActionStatus").empty() ? '0' : rowValue.at("OrderActionStatus")[0];
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
strncpy(data.BranchID, rowValue.at("BranchID").c_str(), sizeof(TThostFtdcBranchIDType));
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldIPAddressType));
strncpy(data.MacAddress, rowValue.at("MacAddress").c_str(), sizeof(TThostFtdcMacAddressType));
strncpy(data.reserve2, rowValue.at("reserve2").c_str(), sizeof(TThostFtdcOldExchangeInstIDType));
data.OptSelfCloseFlag = rowValue.at("OptSelfCloseFlag").empty() ? '0' : rowValue.at("OptSelfCloseFlag")[0];
strncpy(data.IPAddress, rowValue.at("IPAddress").c_str(), sizeof(TThostFtdcIPAddressType));
strncpy(data.ExchangeInstID, rowValue.at("ExchangeInstID").c_str(), sizeof(TThostFtdcExchangeInstIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.ExchangeID + "','" + data.OptionSelfCloseSysID + "','" + (data.ActionFlag == 0 ? '0' : data.ActionFlag) + "','" + data.ActionDate + "','" + data.ActionTime + "','" + data.TraderID + "','" + std::to_string(data.InstallID) + "','" + data.OptionSelfCloseLocalID + "','" + data.ActionLocalID + "','" + data.ParticipantID + "','" + data.ClientID + "','" + data.BusinessUnit + "','" + (data.OrderActionStatus == 0 ? '0' : data.OrderActionStatus) + "','" + data.UserID + "','" + data.BranchID + "','" + data.reserve1 + "','" + data.MacAddress + "','" + data.reserve2 + "','" + (data.OptSelfCloseFlag == 0 ? '0' : data.OptSelfCloseFlag) + "','" + data.IPAddress + "','" + data.ExchangeInstID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcSyncDelaySwapFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcSyncDelaySwapField data;
CThostFtdcSyncDelaySwapFieldWrapper(const CThostFtdcSyncDelaySwapField& _data = { 0 }) :data(_data) { }
CThostFtdcSyncDelaySwapFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcSyncDelaySwapField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.DelaySwapSeqNo, rowValue.at("DelaySwapSeqNo").c_str(), sizeof(TThostFtdcDepositSeqNoType));
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.FromCurrencyID, rowValue.at("FromCurrencyID").c_str(), sizeof(TThostFtdcCurrencyIDType));
data.FromAmount = std::stod(rowValue.at("FromAmount"));
data.FromFrozenSwap = std::stod(rowValue.at("FromFrozenSwap"));
data.FromRemainSwap = std::stod(rowValue.at("FromRemainSwap"));
strncpy(data.ToCurrencyID, rowValue.at("ToCurrencyID").c_str(), sizeof(TThostFtdcCurrencyIDType));
data.ToAmount = std::stod(rowValue.at("ToAmount"));
data.IsManualSwap = std::stoi(rowValue.at("IsManualSwap"));
data.IsAllRemainSetZero = std::stoi(rowValue.at("IsAllRemainSetZero"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.DelaySwapSeqNo + "','" + data.BrokerID + "','" + data.InvestorID + "','" + data.FromCurrencyID + "','" + std::to_string(data.FromAmount) + "','" + std::to_string(data.FromFrozenSwap) + "','" + std::to_string(data.FromRemainSwap) + "','" + data.ToCurrencyID + "','" + std::to_string(data.ToAmount) + "','" + std::to_string(data.IsManualSwap) + "','" + std::to_string(data.IsAllRemainSetZero)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcSyncDelaySwapField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcQrySyncDelaySwapFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQrySyncDelaySwapField data;
CThostFtdcQrySyncDelaySwapFieldWrapper(const CThostFtdcQrySyncDelaySwapField& _data = { 0 }) :data(_data) { }
CThostFtdcQrySyncDelaySwapFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQrySyncDelaySwapField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.DelaySwapSeqNo, rowValue.at("DelaySwapSeqNo").c_str(), sizeof(TThostFtdcDepositSeqNoType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.DelaySwapSeqNo
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcInvestUnitFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcInvestUnitField data;
CThostFtdcInvestUnitFieldWrapper(const CThostFtdcInvestUnitField& _data = { 0 }) :data(_data) { }
CThostFtdcInvestUnitFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcInvestUnitField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.InvestUnitID, rowValue.at("InvestUnitID").c_str(), sizeof(TThostFtdcInvestUnitIDType));
strncpy(data.InvestorUnitName, rowValue.at("InvestorUnitName").c_str(), sizeof(TThostFtdcPartyNameType));
strncpy(data.InvestorGroupID, rowValue.at("InvestorGroupID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.CommModelID, rowValue.at("CommModelID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.MarginModelID, rowValue.at("MarginModelID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.AccountID, rowValue.at("AccountID").c_str(), sizeof(TThostFtdcAccountIDType));
strncpy(data.CurrencyID, rowValue.at("CurrencyID").c_str(), sizeof(TThostFtdcCurrencyIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorID + "','" + data.InvestUnitID + "','" + data.InvestorUnitName + "','" + data.InvestorGroupID + "','" + data.CommModelID + "','" + data.MarginModelID + "','" + data.AccountID + "','" + data.CurrencyID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcInvestUnitField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcQryInvestUnitFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryInvestUnitField data;
CThostFtdcQryInvestUnitFieldWrapper(const CThostFtdcQryInvestUnitField& _data = { 0 }) :data(_data) { }
CThostFtdcQryInvestUnitFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryInvestUnitField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.InvestUnitID, rowValue.at("InvestUnitID").c_str(), sizeof(TThostFtdcInvestUnitIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorID + "','" + data.InvestUnitID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcQryInvestUnitField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcSecAgentCheckModeFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcSecAgentCheckModeField data;
CThostFtdcSecAgentCheckModeFieldWrapper(const CThostFtdcSecAgentCheckModeField& _data = { 0 }) :data(_data) { }
CThostFtdcSecAgentCheckModeFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcSecAgentCheckModeField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.CurrencyID, rowValue.at("CurrencyID").c_str(), sizeof(TThostFtdcCurrencyIDType));
strncpy(data.BrokerSecAgentID, rowValue.at("BrokerSecAgentID").c_str(), sizeof(TThostFtdcAccountIDType));
data.CheckSelfAccount = std::stoi(rowValue.at("CheckSelfAccount"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.InvestorID + "','" + data.BrokerID + "','" + data.CurrencyID + "','" + data.BrokerSecAgentID + "','" + std::to_string(data.CheckSelfAccount)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcSecAgentCheckModeField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcSecAgentTradeInfoFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcSecAgentTradeInfoField data;
CThostFtdcSecAgentTradeInfoFieldWrapper(const CThostFtdcSecAgentTradeInfoField& _data = { 0 }) :data(_data) { }
CThostFtdcSecAgentTradeInfoFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcSecAgentTradeInfoField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.BrokerSecAgentID, rowValue.at("BrokerSecAgentID").c_str(), sizeof(TThostFtdcAccountIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.LongCustomerName, rowValue.at("LongCustomerName").c_str(), sizeof(TThostFtdcLongIndividualNameType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.BrokerSecAgentID + "','" + data.InvestorID + "','" + data.LongCustomerName
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcSecAgentTradeInfoField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcMarketDataFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcMarketDataField data;
CThostFtdcMarketDataFieldWrapper(const CThostFtdcMarketDataField& _data = { 0 }) :data(_data) { }
CThostFtdcMarketDataFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcMarketDataField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.reserve2, rowValue.at("reserve2").c_str(), sizeof(TThostFtdcOldExchangeInstIDType));
data.LastPrice = std::stod(rowValue.at("LastPrice"));
data.PreSettlementPrice = std::stod(rowValue.at("PreSettlementPrice"));
data.PreClosePrice = std::stod(rowValue.at("PreClosePrice"));
data.PreOpenInterest = std::stod(rowValue.at("PreOpenInterest"));
data.OpenPrice = std::stod(rowValue.at("OpenPrice"));
data.HighestPrice = std::stod(rowValue.at("HighestPrice"));
data.LowestPrice = std::stod(rowValue.at("LowestPrice"));
data.Volume = std::stoi(rowValue.at("Volume"));
data.Turnover = std::stod(rowValue.at("Turnover"));
data.OpenInterest = std::stod(rowValue.at("OpenInterest"));
data.ClosePrice = std::stod(rowValue.at("ClosePrice"));
data.SettlementPrice = std::stod(rowValue.at("SettlementPrice"));
data.UpperLimitPrice = std::stod(rowValue.at("UpperLimitPrice"));
data.LowerLimitPrice = std::stod(rowValue.at("LowerLimitPrice"));
data.PreDelta = std::stod(rowValue.at("PreDelta"));
data.CurrDelta = std::stod(rowValue.at("CurrDelta"));
strncpy(data.UpdateTime, rowValue.at("UpdateTime").c_str(), sizeof(TThostFtdcTimeType));
data.UpdateMillisec = std::stoi(rowValue.at("UpdateMillisec"));
strncpy(data.ActionDay, rowValue.at("ActionDay").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
strncpy(data.ExchangeInstID, rowValue.at("ExchangeInstID").c_str(), sizeof(TThostFtdcExchangeInstIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.TradingDay + "','" + data.reserve1 + "','" + data.ExchangeID + "','" + data.reserve2 + "','" + std::to_string(data.LastPrice) + "','" + std::to_string(data.PreSettlementPrice) + "','" + std::to_string(data.PreClosePrice) + "','" + std::to_string(data.PreOpenInterest) + "','" + std::to_string(data.OpenPrice) + "','" + std::to_string(data.HighestPrice) + "','" + std::to_string(data.LowestPrice) + "','" + std::to_string(data.Volume) + "','" + std::to_string(data.Turnover) + "','" + std::to_string(data.OpenInterest) + "','" + std::to_string(data.ClosePrice) + "','" + std::to_string(data.SettlementPrice) + "','" + std::to_string(data.UpperLimitPrice) + "','" + std::to_string(data.LowerLimitPrice) + "','" + std::to_string(data.PreDelta) + "','" + std::to_string(data.CurrDelta) + "','" + data.UpdateTime + "','" + std::to_string(data.UpdateMillisec) + "','" + data.ActionDay + "','" + data.InstrumentID + "','" + data.ExchangeInstID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcMarketDataBaseFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcMarketDataBaseField data;
CThostFtdcMarketDataBaseFieldWrapper(const CThostFtdcMarketDataBaseField& _data = { 0 }) :data(_data) { }
CThostFtdcMarketDataBaseFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcMarketDataBaseField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcDateType));
data.PreSettlementPrice = std::stod(rowValue.at("PreSettlementPrice"));
data.PreClosePrice = std::stod(rowValue.at("PreClosePrice"));
data.PreOpenInterest = std::stod(rowValue.at("PreOpenInterest"));
data.PreDelta = std::stod(rowValue.at("PreDelta"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.TradingDay + "','" + std::to_string(data.PreSettlementPrice) + "','" + std::to_string(data.PreClosePrice) + "','" + std::to_string(data.PreOpenInterest) + "','" + std::to_string(data.PreDelta)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcMarketDataStaticFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcMarketDataStaticField data;
CThostFtdcMarketDataStaticFieldWrapper(const CThostFtdcMarketDataStaticField& _data = { 0 }) :data(_data) { }
CThostFtdcMarketDataStaticFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcMarketDataStaticField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
data.OpenPrice = std::stod(rowValue.at("OpenPrice"));
data.HighestPrice = std::stod(rowValue.at("HighestPrice"));
data.LowestPrice = std::stod(rowValue.at("LowestPrice"));
data.ClosePrice = std::stod(rowValue.at("ClosePrice"));
data.UpperLimitPrice = std::stod(rowValue.at("UpperLimitPrice"));
data.LowerLimitPrice = std::stod(rowValue.at("LowerLimitPrice"));
data.SettlementPrice = std::stod(rowValue.at("SettlementPrice"));
data.CurrDelta = std::stod(rowValue.at("CurrDelta"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
std::to_string(data.OpenPrice) + "','" + std::to_string(data.HighestPrice) + "','" + std::to_string(data.LowestPrice) + "','" + std::to_string(data.ClosePrice) + "','" + std::to_string(data.UpperLimitPrice) + "','" + std::to_string(data.LowerLimitPrice) + "','" + std::to_string(data.SettlementPrice) + "','" + std::to_string(data.CurrDelta)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcMarketDataLastMatchFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcMarketDataLastMatchField data;
CThostFtdcMarketDataLastMatchFieldWrapper(const CThostFtdcMarketDataLastMatchField& _data = { 0 }) :data(_data) { }
CThostFtdcMarketDataLastMatchFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcMarketDataLastMatchField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
data.LastPrice = std::stod(rowValue.at("LastPrice"));
data.Volume = std::stoi(rowValue.at("Volume"));
data.Turnover = std::stod(rowValue.at("Turnover"));
data.OpenInterest = std::stod(rowValue.at("OpenInterest"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
std::to_string(data.LastPrice) + "','" + std::to_string(data.Volume) + "','" + std::to_string(data.Turnover) + "','" + std::to_string(data.OpenInterest)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcMarketDataBestPriceFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcMarketDataBestPriceField data;
CThostFtdcMarketDataBestPriceFieldWrapper(const CThostFtdcMarketDataBestPriceField& _data = { 0 }) :data(_data) { }
CThostFtdcMarketDataBestPriceFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcMarketDataBestPriceField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
data.BidPrice1 = std::stod(rowValue.at("BidPrice1"));
data.BidVolume1 = std::stoi(rowValue.at("BidVolume1"));
data.AskPrice1 = std::stod(rowValue.at("AskPrice1"));
data.AskVolume1 = std::stoi(rowValue.at("AskVolume1"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
std::to_string(data.BidPrice1) + "','" + std::to_string(data.BidVolume1) + "','" + std::to_string(data.AskPrice1) + "','" + std::to_string(data.AskVolume1)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcMarketDataBid23FieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcMarketDataBid23Field data;
CThostFtdcMarketDataBid23FieldWrapper(const CThostFtdcMarketDataBid23Field& _data = { 0 }) :data(_data) { }
CThostFtdcMarketDataBid23FieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcMarketDataBid23Field() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
data.BidPrice2 = std::stod(rowValue.at("BidPrice2"));
data.BidVolume2 = std::stoi(rowValue.at("BidVolume2"));
data.BidPrice3 = std::stod(rowValue.at("BidPrice3"));
data.BidVolume3 = std::stoi(rowValue.at("BidVolume3"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
std::to_string(data.BidPrice2) + "','" + std::to_string(data.BidVolume2) + "','" + std::to_string(data.BidPrice3) + "','" + std::to_string(data.BidVolume3)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcMarketDataAsk23FieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcMarketDataAsk23Field data;
CThostFtdcMarketDataAsk23FieldWrapper(const CThostFtdcMarketDataAsk23Field& _data = { 0 }) :data(_data) { }
CThostFtdcMarketDataAsk23FieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcMarketDataAsk23Field() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
data.AskPrice2 = std::stod(rowValue.at("AskPrice2"));
data.AskVolume2 = std::stoi(rowValue.at("AskVolume2"));
data.AskPrice3 = std::stod(rowValue.at("AskPrice3"));
data.AskVolume3 = std::stoi(rowValue.at("AskVolume3"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
std::to_string(data.AskPrice2) + "','" + std::to_string(data.AskVolume2) + "','" + std::to_string(data.AskPrice3) + "','" + std::to_string(data.AskVolume3)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcMarketDataBid45FieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcMarketDataBid45Field data;
CThostFtdcMarketDataBid45FieldWrapper(const CThostFtdcMarketDataBid45Field& _data = { 0 }) :data(_data) { }
CThostFtdcMarketDataBid45FieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcMarketDataBid45Field() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
data.BidPrice4 = std::stod(rowValue.at("BidPrice4"));
data.BidVolume4 = std::stoi(rowValue.at("BidVolume4"));
data.BidPrice5 = std::stod(rowValue.at("BidPrice5"));
data.BidVolume5 = std::stoi(rowValue.at("BidVolume5"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
std::to_string(data.BidPrice4) + "','" + std::to_string(data.BidVolume4) + "','" + std::to_string(data.BidPrice5) + "','" + std::to_string(data.BidVolume5)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcMarketDataAsk45FieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcMarketDataAsk45Field data;
CThostFtdcMarketDataAsk45FieldWrapper(const CThostFtdcMarketDataAsk45Field& _data = { 0 }) :data(_data) { }
CThostFtdcMarketDataAsk45FieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcMarketDataAsk45Field() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
data.AskPrice4 = std::stod(rowValue.at("AskPrice4"));
data.AskVolume4 = std::stoi(rowValue.at("AskVolume4"));
data.AskPrice5 = std::stod(rowValue.at("AskPrice5"));
data.AskVolume5 = std::stoi(rowValue.at("AskVolume5"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
std::to_string(data.AskPrice4) + "','" + std::to_string(data.AskVolume4) + "','" + std::to_string(data.AskPrice5) + "','" + std::to_string(data.AskVolume5)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcMarketDataUpdateTimeFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcMarketDataUpdateTimeField data;
CThostFtdcMarketDataUpdateTimeFieldWrapper(const CThostFtdcMarketDataUpdateTimeField& _data = { 0 }) :data(_data) { }
CThostFtdcMarketDataUpdateTimeFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcMarketDataUpdateTimeField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
strncpy(data.UpdateTime, rowValue.at("UpdateTime").c_str(), sizeof(TThostFtdcTimeType));
data.UpdateMillisec = std::stoi(rowValue.at("UpdateMillisec"));
strncpy(data.ActionDay, rowValue.at("ActionDay").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.reserve1 + "','" + data.UpdateTime + "','" + std::to_string(data.UpdateMillisec) + "','" + data.ActionDay + "','" + data.InstrumentID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcMarketDataBandingPriceFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcMarketDataBandingPriceField data;
CThostFtdcMarketDataBandingPriceFieldWrapper(const CThostFtdcMarketDataBandingPriceField& _data = { 0 }) :data(_data) { }
CThostFtdcMarketDataBandingPriceFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcMarketDataBandingPriceField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
data.BandingUpperPrice = std::stod(rowValue.at("BandingUpperPrice"));
data.BandingLowerPrice = std::stod(rowValue.at("BandingLowerPrice"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
std::to_string(data.BandingUpperPrice) + "','" + std::to_string(data.BandingLowerPrice)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcMarketDataExchangeFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcMarketDataExchangeField data;
CThostFtdcMarketDataExchangeFieldWrapper(const CThostFtdcMarketDataExchangeField& _data = { 0 }) :data(_data) { }
CThostFtdcMarketDataExchangeFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcMarketDataExchangeField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.ExchangeID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcSpecificInstrumentFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcSpecificInstrumentField data;
CThostFtdcSpecificInstrumentFieldWrapper(const CThostFtdcSpecificInstrumentField& _data = { 0 }) :data(_data) { }
CThostFtdcSpecificInstrumentFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcSpecificInstrumentField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.reserve1 + "','" + data.InstrumentID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcInstrumentStatusFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcInstrumentStatusField data;
CThostFtdcInstrumentStatusFieldWrapper(const CThostFtdcInstrumentStatusField& _data = { 0 }) :data(_data) { }
CThostFtdcInstrumentStatusFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcInstrumentStatusField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldExchangeInstIDType));
strncpy(data.SettlementGroupID, rowValue.at("SettlementGroupID").c_str(), sizeof(TThostFtdcSettlementGroupIDType));
strncpy(data.reserve2, rowValue.at("reserve2").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
data.InstrumentStatus = rowValue.at("InstrumentStatus").empty() ? '0' : rowValue.at("InstrumentStatus")[0];
data.TradingSegmentSN = std::stoi(rowValue.at("TradingSegmentSN"));
strncpy(data.EnterTime, rowValue.at("EnterTime").c_str(), sizeof(TThostFtdcTimeType));
data.EnterReason = rowValue.at("EnterReason").empty() ? '0' : rowValue.at("EnterReason")[0];
strncpy(data.ExchangeInstID, rowValue.at("ExchangeInstID").c_str(), sizeof(TThostFtdcExchangeInstIDType));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.ExchangeID + "','" + data.reserve1 + "','" + data.SettlementGroupID + "','" + data.reserve2 + "','" + (data.InstrumentStatus == 0 ? '0' : data.InstrumentStatus) + "','" + std::to_string(data.TradingSegmentSN) + "','" + data.EnterTime + "','" + (data.EnterReason == 0 ? '0' : data.EnterReason) + "','" + data.ExchangeInstID + "','" + data.InstrumentID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcQryInstrumentStatusFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryInstrumentStatusField data;
CThostFtdcQryInstrumentStatusFieldWrapper(const CThostFtdcQryInstrumentStatusField& _data = { 0 }) :data(_data) { }
CThostFtdcQryInstrumentStatusFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryInstrumentStatusField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldExchangeInstIDType));
strncpy(data.ExchangeInstID, rowValue.at("ExchangeInstID").c_str(), sizeof(TThostFtdcExchangeInstIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.ExchangeID + "','" + data.reserve1 + "','" + data.ExchangeInstID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcInvestorAccountFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcInvestorAccountField data;
CThostFtdcInvestorAccountFieldWrapper(const CThostFtdcInvestorAccountField& _data = { 0 }) :data(_data) { }
CThostFtdcInvestorAccountFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcInvestorAccountField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.AccountID, rowValue.at("AccountID").c_str(), sizeof(TThostFtdcAccountIDType));
strncpy(data.CurrencyID, rowValue.at("CurrencyID").c_str(), sizeof(TThostFtdcCurrencyIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorID + "','" + data.AccountID + "','" + data.CurrencyID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcInvestorAccountField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcPositionProfitAlgorithmFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcPositionProfitAlgorithmField data;
CThostFtdcPositionProfitAlgorithmFieldWrapper(const CThostFtdcPositionProfitAlgorithmField& _data = { 0 }) :data(_data) { }
CThostFtdcPositionProfitAlgorithmFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcPositionProfitAlgorithmField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.AccountID, rowValue.at("AccountID").c_str(), sizeof(TThostFtdcAccountIDType));
data.Algorithm = rowValue.at("Algorithm").empty() ? '0' : rowValue.at("Algorithm")[0];
strncpy(data.Memo, rowValue.at("Memo").c_str(), sizeof(TThostFtdcMemoType));
strncpy(data.CurrencyID, rowValue.at("CurrencyID").c_str(), sizeof(TThostFtdcCurrencyIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.AccountID + "','" + (data.Algorithm == 0 ? '0' : data.Algorithm) + "','" + data.Memo + "','" + data.CurrencyID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.AccountID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& AccountID) {
return "SELECT * FROM 'CThostFtdcPositionProfitAlgorithmField' where BrokerID='" + BrokerID + "' and AccountID='" + AccountID + "';";
}
};
struct CThostFtdcDiscountFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcDiscountField data;
CThostFtdcDiscountFieldWrapper(const CThostFtdcDiscountField& _data = { 0 }) :data(_data) { }
CThostFtdcDiscountFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcDiscountField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
data.InvestorRange = rowValue.at("InvestorRange").empty() ? '0' : rowValue.at("InvestorRange")[0];
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
data.Discount = std::stod(rowValue.at("Discount"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + (data.InvestorRange == 0 ? '0' : data.InvestorRange) + "','" + data.InvestorID + "','" + std::to_string(data.Discount)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcDiscountField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcQryTransferBankFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryTransferBankField data;
CThostFtdcQryTransferBankFieldWrapper(const CThostFtdcQryTransferBankField& _data = { 0 }) :data(_data) { }
CThostFtdcQryTransferBankFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryTransferBankField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BankID, rowValue.at("BankID").c_str(), sizeof(TThostFtdcBankIDType));
strncpy(data.BankBrchID, rowValue.at("BankBrchID").c_str(), sizeof(TThostFtdcBankBrchIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BankID + "','" + data.BankBrchID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcTransferBankFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcTransferBankField data;
CThostFtdcTransferBankFieldWrapper(const CThostFtdcTransferBankField& _data = { 0 }) :data(_data) { }
CThostFtdcTransferBankFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcTransferBankField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BankID, rowValue.at("BankID").c_str(), sizeof(TThostFtdcBankIDType));
strncpy(data.BankBrchID, rowValue.at("BankBrchID").c_str(), sizeof(TThostFtdcBankBrchIDType));
strncpy(data.BankName, rowValue.at("BankName").c_str(), sizeof(TThostFtdcBankNameType));
data.IsActive = std::stoi(rowValue.at("IsActive"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BankID + "','" + data.BankBrchID + "','" + data.BankName + "','" + std::to_string(data.IsActive)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcQryInvestorPositionDetailFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryInvestorPositionDetailField data;
CThostFtdcQryInvestorPositionDetailFieldWrapper(const CThostFtdcQryInvestorPositionDetailField& _data = { 0 }) :data(_data) { }
CThostFtdcQryInvestorPositionDetailFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryInvestorPositionDetailField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.InvestUnitID, rowValue.at("InvestUnitID").c_str(), sizeof(TThostFtdcInvestUnitIDType));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorID + "','" + data.reserve1 + "','" + data.ExchangeID + "','" + data.InvestUnitID + "','" + data.InstrumentID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcQryInvestorPositionDetailField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcInvestorPositionDetailFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcInvestorPositionDetailField data;
CThostFtdcInvestorPositionDetailFieldWrapper(const CThostFtdcInvestorPositionDetailField& _data = { 0 }) :data(_data) { }
CThostFtdcInvestorPositionDetailFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcInvestorPositionDetailField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
data.HedgeFlag = rowValue.at("HedgeFlag").empty() ? '0' : rowValue.at("HedgeFlag")[0];
data.Direction = rowValue.at("Direction").empty() ? '0' : rowValue.at("Direction")[0];
strncpy(data.OpenDate, rowValue.at("OpenDate").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.TradeID, rowValue.at("TradeID").c_str(), sizeof(TThostFtdcTradeIDType));
data.Volume = std::stoi(rowValue.at("Volume"));
data.OpenPrice = std::stod(rowValue.at("OpenPrice"));
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcDateType));
data.SettlementID = std::stoi(rowValue.at("SettlementID"));
data.TradeType = rowValue.at("TradeType").empty() ? '0' : rowValue.at("TradeType")[0];
strncpy(data.reserve2, rowValue.at("reserve2").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
data.CloseProfitByDate = std::stod(rowValue.at("CloseProfitByDate"));
data.CloseProfitByTrade = std::stod(rowValue.at("CloseProfitByTrade"));
data.PositionProfitByDate = std::stod(rowValue.at("PositionProfitByDate"));
data.PositionProfitByTrade = std::stod(rowValue.at("PositionProfitByTrade"));
data.Margin = std::stod(rowValue.at("Margin"));
data.ExchMargin = std::stod(rowValue.at("ExchMargin"));
data.MarginRateByMoney = std::stod(rowValue.at("MarginRateByMoney"));
data.MarginRateByVolume = std::stod(rowValue.at("MarginRateByVolume"));
data.LastSettlementPrice = std::stod(rowValue.at("LastSettlementPrice"));
data.SettlementPrice = std::stod(rowValue.at("SettlementPrice"));
data.CloseVolume = std::stoi(rowValue.at("CloseVolume"));
data.CloseAmount = std::stod(rowValue.at("CloseAmount"));
data.TimeFirstVolume = std::stoi(rowValue.at("TimeFirstVolume"));
strncpy(data.InvestUnitID, rowValue.at("InvestUnitID").c_str(), sizeof(TThostFtdcInvestUnitIDType));
data.SpecPosiType = rowValue.at("SpecPosiType").empty() ? '0' : rowValue.at("SpecPosiType")[0];
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
strncpy(data.CombInstrumentID, rowValue.at("CombInstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.reserve1 + "','" + data.BrokerID + "','" + data.InvestorID + "','" + (data.HedgeFlag == 0 ? '0' : data.HedgeFlag) + "','" + (data.Direction == 0 ? '0' : data.Direction) + "','" + data.OpenDate + "','" + data.TradeID + "','" + std::to_string(data.Volume) + "','" + std::to_string(data.OpenPrice) + "','" + data.TradingDay + "','" + std::to_string(data.SettlementID) + "','" + (data.TradeType == 0 ? '0' : data.TradeType) + "','" + data.reserve2 + "','" + data.ExchangeID + "','" + std::to_string(data.CloseProfitByDate) + "','" + std::to_string(data.CloseProfitByTrade) + "','" + std::to_string(data.PositionProfitByDate) + "','" + std::to_string(data.PositionProfitByTrade) + "','" + std::to_string(data.Margin) + "','" + std::to_string(data.ExchMargin) + "','" + std::to_string(data.MarginRateByMoney) + "','" + std::to_string(data.MarginRateByVolume) + "','" + std::to_string(data.LastSettlementPrice) + "','" + std::to_string(data.SettlementPrice) + "','" + std::to_string(data.CloseVolume) + "','" + std::to_string(data.CloseAmount) + "','" + std::to_string(data.TimeFirstVolume) + "','" + data.InvestUnitID + "','" + (data.SpecPosiType == 0 ? '0' : data.SpecPosiType) + "','" + data.InstrumentID + "','" + data.CombInstrumentID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcInvestorPositionDetailField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcTradingAccountPasswordFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcTradingAccountPasswordField data;
CThostFtdcTradingAccountPasswordFieldWrapper(const CThostFtdcTradingAccountPasswordField& _data = { 0 }) :data(_data) { }
CThostFtdcTradingAccountPasswordFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcTradingAccountPasswordField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.AccountID, rowValue.at("AccountID").c_str(), sizeof(TThostFtdcAccountIDType));
strncpy(data.Password, rowValue.at("Password").c_str(), sizeof(TThostFtdcPasswordType));
strncpy(data.CurrencyID, rowValue.at("CurrencyID").c_str(), sizeof(TThostFtdcCurrencyIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.AccountID + "','" + data.Password + "','" + data.CurrencyID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.AccountID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& AccountID) {
return "SELECT * FROM 'CThostFtdcTradingAccountPasswordField' where BrokerID='" + BrokerID + "' and AccountID='" + AccountID + "';";
}
};
struct CThostFtdcMDTraderOfferFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcMDTraderOfferField data;
CThostFtdcMDTraderOfferFieldWrapper(const CThostFtdcMDTraderOfferField& _data = { 0 }) :data(_data) { }
CThostFtdcMDTraderOfferFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcMDTraderOfferField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.TraderID, rowValue.at("TraderID").c_str(), sizeof(TThostFtdcTraderIDType));
strncpy(data.ParticipantID, rowValue.at("ParticipantID").c_str(), sizeof(TThostFtdcParticipantIDType));
strncpy(data.Password, rowValue.at("Password").c_str(), sizeof(TThostFtdcPasswordType));
data.InstallID = std::stoi(rowValue.at("InstallID"));
strncpy(data.OrderLocalID, rowValue.at("OrderLocalID").c_str(), sizeof(TThostFtdcOrderLocalIDType));
data.TraderConnectStatus = rowValue.at("TraderConnectStatus").empty() ? '0' : rowValue.at("TraderConnectStatus")[0];
strncpy(data.ConnectRequestDate, rowValue.at("ConnectRequestDate").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.ConnectRequestTime, rowValue.at("ConnectRequestTime").c_str(), sizeof(TThostFtdcTimeType));
strncpy(data.LastReportDate, rowValue.at("LastReportDate").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.LastReportTime, rowValue.at("LastReportTime").c_str(), sizeof(TThostFtdcTimeType));
strncpy(data.ConnectDate, rowValue.at("ConnectDate").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.ConnectTime, rowValue.at("ConnectTime").c_str(), sizeof(TThostFtdcTimeType));
strncpy(data.StartDate, rowValue.at("StartDate").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.StartTime, rowValue.at("StartTime").c_str(), sizeof(TThostFtdcTimeType));
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.MaxTradeID, rowValue.at("MaxTradeID").c_str(), sizeof(TThostFtdcTradeIDType));
strncpy(data.MaxOrderMessageReference, rowValue.at("MaxOrderMessageReference").c_str(), sizeof(TThostFtdcReturnCodeType));
data.OrderCancelAlg = rowValue.at("OrderCancelAlg").empty() ? '0' : rowValue.at("OrderCancelAlg")[0];
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.ExchangeID + "','" + data.TraderID + "','" + data.ParticipantID + "','" + data.Password + "','" + std::to_string(data.InstallID) + "','" + data.OrderLocalID + "','" + (data.TraderConnectStatus == 0 ? '0' : data.TraderConnectStatus) + "','" + data.ConnectRequestDate + "','" + data.ConnectRequestTime + "','" + data.LastReportDate + "','" + data.LastReportTime + "','" + data.ConnectDate + "','" + data.ConnectTime + "','" + data.StartDate + "','" + data.StartTime + "','" + data.TradingDay + "','" + data.BrokerID + "','" + data.MaxTradeID + "','" + data.MaxOrderMessageReference + "','" + (data.OrderCancelAlg == 0 ? '0' : data.OrderCancelAlg)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcQryMDTraderOfferFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryMDTraderOfferField data;
CThostFtdcQryMDTraderOfferFieldWrapper(const CThostFtdcQryMDTraderOfferField& _data = { 0 }) :data(_data) { }
CThostFtdcQryMDTraderOfferFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryMDTraderOfferField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.ParticipantID, rowValue.at("ParticipantID").c_str(), sizeof(TThostFtdcParticipantIDType));
strncpy(data.TraderID, rowValue.at("TraderID").c_str(), sizeof(TThostFtdcTraderIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.ExchangeID + "','" + data.ParticipantID + "','" + data.TraderID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcQryNoticeFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryNoticeField data;
CThostFtdcQryNoticeFieldWrapper(const CThostFtdcQryNoticeField& _data = { 0 }) :data(_data) { }
CThostFtdcQryNoticeFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryNoticeField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcNoticeFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcNoticeField data;
CThostFtdcNoticeFieldWrapper(const CThostFtdcNoticeField& _data = { 0 }) :data(_data) { }
CThostFtdcNoticeFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcNoticeField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.Content, rowValue.at("Content").c_str(), sizeof(TThostFtdcContentType));
strncpy(data.SequenceLabel, rowValue.at("SequenceLabel").c_str(), sizeof(TThostFtdcSequenceLabelType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.Content + "','" + data.SequenceLabel
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcUserRightFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcUserRightField data;
CThostFtdcUserRightFieldWrapper(const CThostFtdcUserRightField& _data = { 0 }) :data(_data) { }
CThostFtdcUserRightFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcUserRightField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
data.UserRightType = rowValue.at("UserRightType").empty() ? '0' : rowValue.at("UserRightType")[0];
data.IsForbidden = std::stoi(rowValue.at("IsForbidden"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.UserID + "','" + (data.UserRightType == 0 ? '0' : data.UserRightType) + "','" + std::to_string(data.IsForbidden)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.UserID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& UserID) {
return "SELECT * FROM 'CThostFtdcUserRightField' where BrokerID='" + BrokerID + "' and UserID='" + UserID + "';";
}
};
struct CThostFtdcQrySettlementInfoConfirmFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQrySettlementInfoConfirmField data;
CThostFtdcQrySettlementInfoConfirmFieldWrapper(const CThostFtdcQrySettlementInfoConfirmField& _data = { 0 }) :data(_data) { }
CThostFtdcQrySettlementInfoConfirmFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQrySettlementInfoConfirmField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.AccountID, rowValue.at("AccountID").c_str(), sizeof(TThostFtdcAccountIDType));
strncpy(data.CurrencyID, rowValue.at("CurrencyID").c_str(), sizeof(TThostFtdcCurrencyIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorID + "','" + data.AccountID + "','" + data.CurrencyID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcQrySettlementInfoConfirmField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcLoadSettlementInfoFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcLoadSettlementInfoField data;
CThostFtdcLoadSettlementInfoFieldWrapper(const CThostFtdcLoadSettlementInfoField& _data = { 0 }) :data(_data) { }
CThostFtdcLoadSettlementInfoFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcLoadSettlementInfoField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcBrokerWithdrawAlgorithmFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcBrokerWithdrawAlgorithmField data;
CThostFtdcBrokerWithdrawAlgorithmFieldWrapper(const CThostFtdcBrokerWithdrawAlgorithmField& _data = { 0 }) :data(_data) { }
CThostFtdcBrokerWithdrawAlgorithmFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcBrokerWithdrawAlgorithmField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
data.WithdrawAlgorithm = rowValue.at("WithdrawAlgorithm").empty() ? '0' : rowValue.at("WithdrawAlgorithm")[0];
data.UsingRatio = std::stod(rowValue.at("UsingRatio"));
data.IncludeCloseProfit = rowValue.at("IncludeCloseProfit").empty() ? '0' : rowValue.at("IncludeCloseProfit")[0];
data.AllWithoutTrade = rowValue.at("AllWithoutTrade").empty() ? '0' : rowValue.at("AllWithoutTrade")[0];
data.AvailIncludeCloseProfit = rowValue.at("AvailIncludeCloseProfit").empty() ? '0' : rowValue.at("AvailIncludeCloseProfit")[0];
data.IsBrokerUserEvent = std::stoi(rowValue.at("IsBrokerUserEvent"));
strncpy(data.CurrencyID, rowValue.at("CurrencyID").c_str(), sizeof(TThostFtdcCurrencyIDType));
data.FundMortgageRatio = std::stod(rowValue.at("FundMortgageRatio"));
data.BalanceAlgorithm = rowValue.at("BalanceAlgorithm").empty() ? '0' : rowValue.at("BalanceAlgorithm")[0];
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + (data.WithdrawAlgorithm == 0 ? '0' : data.WithdrawAlgorithm) + "','" + std::to_string(data.UsingRatio) + "','" + (data.IncludeCloseProfit == 0 ? '0' : data.IncludeCloseProfit) + "','" + (data.AllWithoutTrade == 0 ? '0' : data.AllWithoutTrade) + "','" + (data.AvailIncludeCloseProfit == 0 ? '0' : data.AvailIncludeCloseProfit) + "','" + std::to_string(data.IsBrokerUserEvent) + "','" + data.CurrencyID + "','" + std::to_string(data.FundMortgageRatio) + "','" + (data.BalanceAlgorithm == 0 ? '0' : data.BalanceAlgorithm)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcTradingAccountPasswordUpdateV1FieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcTradingAccountPasswordUpdateV1Field data;
CThostFtdcTradingAccountPasswordUpdateV1FieldWrapper(const CThostFtdcTradingAccountPasswordUpdateV1Field& _data = { 0 }) :data(_data) { }
CThostFtdcTradingAccountPasswordUpdateV1FieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcTradingAccountPasswordUpdateV1Field() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.OldPassword, rowValue.at("OldPassword").c_str(), sizeof(TThostFtdcPasswordType));
strncpy(data.NewPassword, rowValue.at("NewPassword").c_str(), sizeof(TThostFtdcPasswordType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorID + "','" + data.OldPassword + "','" + data.NewPassword
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcTradingAccountPasswordUpdateV1Field' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcTradingAccountPasswordUpdateFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcTradingAccountPasswordUpdateField data;
CThostFtdcTradingAccountPasswordUpdateFieldWrapper(const CThostFtdcTradingAccountPasswordUpdateField& _data = { 0 }) :data(_data) { }
CThostFtdcTradingAccountPasswordUpdateFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcTradingAccountPasswordUpdateField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.AccountID, rowValue.at("AccountID").c_str(), sizeof(TThostFtdcAccountIDType));
strncpy(data.OldPassword, rowValue.at("OldPassword").c_str(), sizeof(TThostFtdcPasswordType));
strncpy(data.NewPassword, rowValue.at("NewPassword").c_str(), sizeof(TThostFtdcPasswordType));
strncpy(data.CurrencyID, rowValue.at("CurrencyID").c_str(), sizeof(TThostFtdcCurrencyIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.AccountID + "','" + data.OldPassword + "','" + data.NewPassword + "','" + data.CurrencyID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.AccountID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& AccountID) {
return "SELECT * FROM 'CThostFtdcTradingAccountPasswordUpdateField' where BrokerID='" + BrokerID + "' and AccountID='" + AccountID + "';";
}
};
struct CThostFtdcQryCombinationLegFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryCombinationLegField data;
CThostFtdcQryCombinationLegFieldWrapper(const CThostFtdcQryCombinationLegField& _data = { 0 }) :data(_data) { }
CThostFtdcQryCombinationLegFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryCombinationLegField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
data.LegID = std::stoi(rowValue.at("LegID"));
strncpy(data.reserve2, rowValue.at("reserve2").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
strncpy(data.CombInstrumentID, rowValue.at("CombInstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
strncpy(data.LegInstrumentID, rowValue.at("LegInstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.reserve1 + "','" + std::to_string(data.LegID) + "','" + data.reserve2 + "','" + data.CombInstrumentID + "','" + data.LegInstrumentID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcQrySyncStatusFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQrySyncStatusField data;
CThostFtdcQrySyncStatusFieldWrapper(const CThostFtdcQrySyncStatusField& _data = { 0 }) :data(_data) { }
CThostFtdcQrySyncStatusFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQrySyncStatusField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcDateType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.TradingDay
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcCombinationLegFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcCombinationLegField data;
CThostFtdcCombinationLegFieldWrapper(const CThostFtdcCombinationLegField& _data = { 0 }) :data(_data) { }
CThostFtdcCombinationLegFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcCombinationLegField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
data.LegID = std::stoi(rowValue.at("LegID"));
strncpy(data.reserve2, rowValue.at("reserve2").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
data.Direction = rowValue.at("Direction").empty() ? '0' : rowValue.at("Direction")[0];
data.LegMultiple = std::stoi(rowValue.at("LegMultiple"));
data.ImplyLevel = std::stoi(rowValue.at("ImplyLevel"));
strncpy(data.CombInstrumentID, rowValue.at("CombInstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
strncpy(data.LegInstrumentID, rowValue.at("LegInstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.reserve1 + "','" + std::to_string(data.LegID) + "','" + data.reserve2 + "','" + (data.Direction == 0 ? '0' : data.Direction) + "','" + std::to_string(data.LegMultiple) + "','" + std::to_string(data.ImplyLevel) + "','" + data.CombInstrumentID + "','" + data.LegInstrumentID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcSyncStatusFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcSyncStatusField data;
CThostFtdcSyncStatusFieldWrapper(const CThostFtdcSyncStatusField& _data = { 0 }) :data(_data) { }
CThostFtdcSyncStatusFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcSyncStatusField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcDateType));
data.DataSyncStatus = rowValue.at("DataSyncStatus").empty() ? '0' : rowValue.at("DataSyncStatus")[0];
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.TradingDay + "','" + (data.DataSyncStatus == 0 ? '0' : data.DataSyncStatus)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcQryLinkManFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryLinkManField data;
CThostFtdcQryLinkManFieldWrapper(const CThostFtdcQryLinkManField& _data = { 0 }) :data(_data) { }
CThostFtdcQryLinkManFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryLinkManField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcQryLinkManField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcLinkManFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcLinkManField data;
CThostFtdcLinkManFieldWrapper(const CThostFtdcLinkManField& _data = { 0 }) :data(_data) { }
CThostFtdcLinkManFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcLinkManField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
data.PersonType = rowValue.at("PersonType").empty() ? '0' : rowValue.at("PersonType")[0];
data.IdentifiedCardType = rowValue.at("IdentifiedCardType").empty() ? '0' : rowValue.at("IdentifiedCardType")[0];
strncpy(data.IdentifiedCardNo, rowValue.at("IdentifiedCardNo").c_str(), sizeof(TThostFtdcIdentifiedCardNoType));
strncpy(data.PersonName, rowValue.at("PersonName").c_str(), sizeof(TThostFtdcPartyNameType));
strncpy(data.Telephone, rowValue.at("Telephone").c_str(), sizeof(TThostFtdcTelephoneType));
strncpy(data.Address, rowValue.at("Address").c_str(), sizeof(TThostFtdcAddressType));
strncpy(data.ZipCode, rowValue.at("ZipCode").c_str(), sizeof(TThostFtdcZipCodeType));
data.Priority = std::stoi(rowValue.at("Priority"));
strncpy(data.UOAZipCode, rowValue.at("UOAZipCode").c_str(), sizeof(TThostFtdcUOAZipCodeType));
strncpy(data.PersonFullName, rowValue.at("PersonFullName").c_str(), sizeof(TThostFtdcInvestorFullNameType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorID + "','" + (data.PersonType == 0 ? '0' : data.PersonType) + "','" + (data.IdentifiedCardType == 0 ? '0' : data.IdentifiedCardType) + "','" + data.IdentifiedCardNo + "','" + data.PersonName + "','" + data.Telephone + "','" + data.Address + "','" + data.ZipCode + "','" + std::to_string(data.Priority) + "','" + data.UOAZipCode + "','" + data.PersonFullName
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcLinkManField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcQryBrokerUserEventFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryBrokerUserEventField data;
CThostFtdcQryBrokerUserEventFieldWrapper(const CThostFtdcQryBrokerUserEventField& _data = { 0 }) :data(_data) { }
CThostFtdcQryBrokerUserEventFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryBrokerUserEventField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
data.UserEventType = rowValue.at("UserEventType").empty() ? '0' : rowValue.at("UserEventType")[0];
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.UserID + "','" + (data.UserEventType == 0 ? '0' : data.UserEventType)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.UserID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& UserID) {
return "SELECT * FROM 'CThostFtdcQryBrokerUserEventField' where BrokerID='" + BrokerID + "' and UserID='" + UserID + "';";
}
};
struct CThostFtdcBrokerUserEventFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcBrokerUserEventField data;
CThostFtdcBrokerUserEventFieldWrapper(const CThostFtdcBrokerUserEventField& _data = { 0 }) :data(_data) { }
CThostFtdcBrokerUserEventFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcBrokerUserEventField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
data.UserEventType = rowValue.at("UserEventType").empty() ? '0' : rowValue.at("UserEventType")[0];
data.EventSequenceNo = std::stoi(rowValue.at("EventSequenceNo"));
strncpy(data.EventDate, rowValue.at("EventDate").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.EventTime, rowValue.at("EventTime").c_str(), sizeof(TThostFtdcTimeType));
strncpy(data.UserEventInfo, rowValue.at("UserEventInfo").c_str(), sizeof(TThostFtdcUserEventInfoType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
data.DRIdentityID = std::stoi(rowValue.at("DRIdentityID"));
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcDateType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.UserID + "','" + (data.UserEventType == 0 ? '0' : data.UserEventType) + "','" + std::to_string(data.EventSequenceNo) + "','" + data.EventDate + "','" + data.EventTime + "','" + data.UserEventInfo + "','" + data.InvestorID + "','" + data.reserve1 + "','" + data.InstrumentID + "','" + std::to_string(data.DRIdentityID) + "','" + data.TradingDay
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcBrokerUserEventField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcQryContractBankFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryContractBankField data;
CThostFtdcQryContractBankFieldWrapper(const CThostFtdcQryContractBankField& _data = { 0 }) :data(_data) { }
CThostFtdcQryContractBankFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryContractBankField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.BankID, rowValue.at("BankID").c_str(), sizeof(TThostFtdcBankIDType));
strncpy(data.BankBrchID, rowValue.at("BankBrchID").c_str(), sizeof(TThostFtdcBankBrchIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.BankID + "','" + data.BankBrchID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcContractBankFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcContractBankField data;
CThostFtdcContractBankFieldWrapper(const CThostFtdcContractBankField& _data = { 0 }) :data(_data) { }
CThostFtdcContractBankFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcContractBankField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.BankID, rowValue.at("BankID").c_str(), sizeof(TThostFtdcBankIDType));
strncpy(data.BankBrchID, rowValue.at("BankBrchID").c_str(), sizeof(TThostFtdcBankBrchIDType));
strncpy(data.BankName, rowValue.at("BankName").c_str(), sizeof(TThostFtdcBankNameType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.BankID + "','" + data.BankBrchID + "','" + data.BankName
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcInvestorPositionCombineDetailFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcInvestorPositionCombineDetailField data;
CThostFtdcInvestorPositionCombineDetailFieldWrapper(const CThostFtdcInvestorPositionCombineDetailField& _data = { 0 }) :data(_data) { }
CThostFtdcInvestorPositionCombineDetailFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcInvestorPositionCombineDetailField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.OpenDate, rowValue.at("OpenDate").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
data.SettlementID = std::stoi(rowValue.at("SettlementID"));
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.ComTradeID, rowValue.at("ComTradeID").c_str(), sizeof(TThostFtdcTradeIDType));
strncpy(data.TradeID, rowValue.at("TradeID").c_str(), sizeof(TThostFtdcTradeIDType));
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
data.HedgeFlag = rowValue.at("HedgeFlag").empty() ? '0' : rowValue.at("HedgeFlag")[0];
data.Direction = rowValue.at("Direction").empty() ? '0' : rowValue.at("Direction")[0];
data.TotalAmt = std::stoi(rowValue.at("TotalAmt"));
data.Margin = std::stod(rowValue.at("Margin"));
data.ExchMargin = std::stod(rowValue.at("ExchMargin"));
data.MarginRateByMoney = std::stod(rowValue.at("MarginRateByMoney"));
data.MarginRateByVolume = std::stod(rowValue.at("MarginRateByVolume"));
data.LegID = std::stoi(rowValue.at("LegID"));
data.LegMultiple = std::stoi(rowValue.at("LegMultiple"));
strncpy(data.reserve2, rowValue.at("reserve2").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
data.TradeGroupID = std::stoi(rowValue.at("TradeGroupID"));
strncpy(data.InvestUnitID, rowValue.at("InvestUnitID").c_str(), sizeof(TThostFtdcInvestUnitIDType));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
strncpy(data.CombInstrumentID, rowValue.at("CombInstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.TradingDay + "','" + data.OpenDate + "','" + data.ExchangeID + "','" + std::to_string(data.SettlementID) + "','" + data.BrokerID + "','" + data.InvestorID + "','" + data.ComTradeID + "','" + data.TradeID + "','" + data.reserve1 + "','" + (data.HedgeFlag == 0 ? '0' : data.HedgeFlag) + "','" + (data.Direction == 0 ? '0' : data.Direction) + "','" + std::to_string(data.TotalAmt) + "','" + std::to_string(data.Margin) + "','" + std::to_string(data.ExchMargin) + "','" + std::to_string(data.MarginRateByMoney) + "','" + std::to_string(data.MarginRateByVolume) + "','" + std::to_string(data.LegID) + "','" + std::to_string(data.LegMultiple) + "','" + data.reserve2 + "','" + std::to_string(data.TradeGroupID) + "','" + data.InvestUnitID + "','" + data.InstrumentID + "','" + data.CombInstrumentID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcInvestorPositionCombineDetailField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcParkedOrderFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcParkedOrderField data;
CThostFtdcParkedOrderFieldWrapper(const CThostFtdcParkedOrderField& _data = { 0 }) :data(_data) { }
CThostFtdcParkedOrderFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcParkedOrderField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
strncpy(data.OrderRef, rowValue.at("OrderRef").c_str(), sizeof(TThostFtdcOrderRefType));
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
data.OrderPriceType = rowValue.at("OrderPriceType").empty() ? '0' : rowValue.at("OrderPriceType")[0];
data.Direction = rowValue.at("Direction").empty() ? '0' : rowValue.at("Direction")[0];
strncpy(data.CombOffsetFlag, rowValue.at("CombOffsetFlag").c_str(), sizeof(TThostFtdcCombOffsetFlagType));
strncpy(data.CombHedgeFlag, rowValue.at("CombHedgeFlag").c_str(), sizeof(TThostFtdcCombHedgeFlagType));
data.LimitPrice = std::stod(rowValue.at("LimitPrice"));
data.VolumeTotalOriginal = std::stoi(rowValue.at("VolumeTotalOriginal"));
data.TimeCondition = rowValue.at("TimeCondition").empty() ? '0' : rowValue.at("TimeCondition")[0];
strncpy(data.GTDDate, rowValue.at("GTDDate").c_str(), sizeof(TThostFtdcDateType));
data.VolumeCondition = rowValue.at("VolumeCondition").empty() ? '0' : rowValue.at("VolumeCondition")[0];
data.MinVolume = std::stoi(rowValue.at("MinVolume"));
data.ContingentCondition = rowValue.at("ContingentCondition").empty() ? '0' : rowValue.at("ContingentCondition")[0];
data.StopPrice = std::stod(rowValue.at("StopPrice"));
data.ForceCloseReason = rowValue.at("ForceCloseReason").empty() ? '0' : rowValue.at("ForceCloseReason")[0];
data.IsAutoSuspend = std::stoi(rowValue.at("IsAutoSuspend"));
strncpy(data.BusinessUnit, rowValue.at("BusinessUnit").c_str(), sizeof(TThostFtdcBusinessUnitType));
data.RequestID = std::stoi(rowValue.at("RequestID"));
data.UserForceClose = std::stoi(rowValue.at("UserForceClose"));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.ParkedOrderID, rowValue.at("ParkedOrderID").c_str(), sizeof(TThostFtdcParkedOrderIDType));
data.UserType = rowValue.at("UserType").empty() ? '0' : rowValue.at("UserType")[0];
data.Status = rowValue.at("Status").empty() ? '0' : rowValue.at("Status")[0];
data.ErrorID = std::stoi(rowValue.at("ErrorID"));
strncpy(data.ErrorMsg, utf8_to_gbk(rowValue.at("ErrorMsg")).c_str(), sizeof(TThostFtdcErrorMsgType));
data.IsSwapOrder = std::stoi(rowValue.at("IsSwapOrder"));
strncpy(data.AccountID, rowValue.at("AccountID").c_str(), sizeof(TThostFtdcAccountIDType));
strncpy(data.CurrencyID, rowValue.at("CurrencyID").c_str(), sizeof(TThostFtdcCurrencyIDType));
strncpy(data.ClientID, rowValue.at("ClientID").c_str(), sizeof(TThostFtdcClientIDType));
strncpy(data.InvestUnitID, rowValue.at("InvestUnitID").c_str(), sizeof(TThostFtdcInvestUnitIDType));
strncpy(data.reserve2, rowValue.at("reserve2").c_str(), sizeof(TThostFtdcOldIPAddressType));
strncpy(data.MacAddress, rowValue.at("MacAddress").c_str(), sizeof(TThostFtdcMacAddressType));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
strncpy(data.IPAddress, rowValue.at("IPAddress").c_str(), sizeof(TThostFtdcIPAddressType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorID + "','" + data.reserve1 + "','" + data.OrderRef + "','" + data.UserID + "','" + (data.OrderPriceType == 0 ? '0' : data.OrderPriceType) + "','" + (data.Direction == 0 ? '0' : data.Direction) + "','" + data.CombOffsetFlag + "','" + data.CombHedgeFlag + "','" + std::to_string(data.LimitPrice) + "','" + std::to_string(data.VolumeTotalOriginal) + "','" + (data.TimeCondition == 0 ? '0' : data.TimeCondition) + "','" + data.GTDDate + "','" + (data.VolumeCondition == 0 ? '0' : data.VolumeCondition) + "','" + std::to_string(data.MinVolume) + "','" + (data.ContingentCondition == 0 ? '0' : data.ContingentCondition) + "','" + std::to_string(data.StopPrice) + "','" + (data.ForceCloseReason == 0 ? '0' : data.ForceCloseReason) + "','" + std::to_string(data.IsAutoSuspend) + "','" + data.BusinessUnit + "','" + std::to_string(data.RequestID) + "','" + std::to_string(data.UserForceClose) + "','" + data.ExchangeID + "','" + data.ParkedOrderID + "','" + (data.UserType == 0 ? '0' : data.UserType) + "','" + (data.Status == 0 ? '0' : data.Status) + "','" + std::to_string(data.ErrorID) + "','" + gbk_to_utf8(data.ErrorMsg) + "','" + std::to_string(data.IsSwapOrder) + "','" + data.AccountID + "','" + data.CurrencyID + "','" + data.ClientID + "','" + data.InvestUnitID + "','" + data.reserve2 + "','" + data.MacAddress + "','" + data.InstrumentID + "','" + data.IPAddress
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcParkedOrderField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcParkedOrderActionFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcParkedOrderActionField data;
CThostFtdcParkedOrderActionFieldWrapper(const CThostFtdcParkedOrderActionField& _data = { 0 }) :data(_data) { }
CThostFtdcParkedOrderActionFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcParkedOrderActionField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
data.OrderActionRef = std::stoi(rowValue.at("OrderActionRef"));
strncpy(data.OrderRef, rowValue.at("OrderRef").c_str(), sizeof(TThostFtdcOrderRefType));
data.RequestID = std::stoi(rowValue.at("RequestID"));
data.FrontID = std::stoi(rowValue.at("FrontID"));
data.SessionID = std::stoi(rowValue.at("SessionID"));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.OrderSysID, rowValue.at("OrderSysID").c_str(), sizeof(TThostFtdcOrderSysIDType));
data.ActionFlag = rowValue.at("ActionFlag").empty() ? '0' : rowValue.at("ActionFlag")[0];
data.LimitPrice = std::stod(rowValue.at("LimitPrice"));
data.VolumeChange = std::stoi(rowValue.at("VolumeChange"));
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
strncpy(data.ParkedOrderActionID, rowValue.at("ParkedOrderActionID").c_str(), sizeof(TThostFtdcParkedOrderActionIDType));
data.UserType = rowValue.at("UserType").empty() ? '0' : rowValue.at("UserType")[0];
data.Status = rowValue.at("Status").empty() ? '0' : rowValue.at("Status")[0];
data.ErrorID = std::stoi(rowValue.at("ErrorID"));
strncpy(data.ErrorMsg, utf8_to_gbk(rowValue.at("ErrorMsg")).c_str(), sizeof(TThostFtdcErrorMsgType));
strncpy(data.InvestUnitID, rowValue.at("InvestUnitID").c_str(), sizeof(TThostFtdcInvestUnitIDType));
strncpy(data.reserve2, rowValue.at("reserve2").c_str(), sizeof(TThostFtdcOldIPAddressType));
strncpy(data.MacAddress, rowValue.at("MacAddress").c_str(), sizeof(TThostFtdcMacAddressType));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
strncpy(data.IPAddress, rowValue.at("IPAddress").c_str(), sizeof(TThostFtdcIPAddressType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorID + "','" + std::to_string(data.OrderActionRef) + "','" + data.OrderRef + "','" + std::to_string(data.RequestID) + "','" + std::to_string(data.FrontID) + "','" + std::to_string(data.SessionID) + "','" + data.ExchangeID + "','" + data.OrderSysID + "','" + (data.ActionFlag == 0 ? '0' : data.ActionFlag) + "','" + std::to_string(data.LimitPrice) + "','" + std::to_string(data.VolumeChange) + "','" + data.UserID + "','" + data.reserve1 + "','" + data.ParkedOrderActionID + "','" + (data.UserType == 0 ? '0' : data.UserType) + "','" + (data.Status == 0 ? '0' : data.Status) + "','" + std::to_string(data.ErrorID) + "','" + gbk_to_utf8(data.ErrorMsg) + "','" + data.InvestUnitID + "','" + data.reserve2 + "','" + data.MacAddress + "','" + data.InstrumentID + "','" + data.IPAddress
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcParkedOrderActionField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcQryParkedOrderFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryParkedOrderField data;
CThostFtdcQryParkedOrderFieldWrapper(const CThostFtdcQryParkedOrderField& _data = { 0 }) :data(_data) { }
CThostFtdcQryParkedOrderFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryParkedOrderField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.InvestUnitID, rowValue.at("InvestUnitID").c_str(), sizeof(TThostFtdcInvestUnitIDType));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorID + "','" + data.reserve1 + "','" + data.ExchangeID + "','" + data.InvestUnitID + "','" + data.InstrumentID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcQryParkedOrderField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcQryParkedOrderActionFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryParkedOrderActionField data;
CThostFtdcQryParkedOrderActionFieldWrapper(const CThostFtdcQryParkedOrderActionField& _data = { 0 }) :data(_data) { }
CThostFtdcQryParkedOrderActionFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryParkedOrderActionField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.InvestUnitID, rowValue.at("InvestUnitID").c_str(), sizeof(TThostFtdcInvestUnitIDType));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorID + "','" + data.reserve1 + "','" + data.ExchangeID + "','" + data.InvestUnitID + "','" + data.InstrumentID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcQryParkedOrderActionField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcRemoveParkedOrderFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcRemoveParkedOrderField data;
CThostFtdcRemoveParkedOrderFieldWrapper(const CThostFtdcRemoveParkedOrderField& _data = { 0 }) :data(_data) { }
CThostFtdcRemoveParkedOrderFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcRemoveParkedOrderField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.ParkedOrderID, rowValue.at("ParkedOrderID").c_str(), sizeof(TThostFtdcParkedOrderIDType));
strncpy(data.InvestUnitID, rowValue.at("InvestUnitID").c_str(), sizeof(TThostFtdcInvestUnitIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorID + "','" + data.ParkedOrderID + "','" + data.InvestUnitID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcRemoveParkedOrderField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcRemoveParkedOrderActionFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcRemoveParkedOrderActionField data;
CThostFtdcRemoveParkedOrderActionFieldWrapper(const CThostFtdcRemoveParkedOrderActionField& _data = { 0 }) :data(_data) { }
CThostFtdcRemoveParkedOrderActionFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcRemoveParkedOrderActionField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.ParkedOrderActionID, rowValue.at("ParkedOrderActionID").c_str(), sizeof(TThostFtdcParkedOrderActionIDType));
strncpy(data.InvestUnitID, rowValue.at("InvestUnitID").c_str(), sizeof(TThostFtdcInvestUnitIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorID + "','" + data.ParkedOrderActionID + "','" + data.InvestUnitID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcRemoveParkedOrderActionField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcInvestorWithdrawAlgorithmFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcInvestorWithdrawAlgorithmField data;
CThostFtdcInvestorWithdrawAlgorithmFieldWrapper(const CThostFtdcInvestorWithdrawAlgorithmField& _data = { 0 }) :data(_data) { }
CThostFtdcInvestorWithdrawAlgorithmFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcInvestorWithdrawAlgorithmField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
data.InvestorRange = rowValue.at("InvestorRange").empty() ? '0' : rowValue.at("InvestorRange")[0];
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
data.UsingRatio = std::stod(rowValue.at("UsingRatio"));
strncpy(data.CurrencyID, rowValue.at("CurrencyID").c_str(), sizeof(TThostFtdcCurrencyIDType));
data.FundMortgageRatio = std::stod(rowValue.at("FundMortgageRatio"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + (data.InvestorRange == 0 ? '0' : data.InvestorRange) + "','" + data.InvestorID + "','" + std::to_string(data.UsingRatio) + "','" + data.CurrencyID + "','" + std::to_string(data.FundMortgageRatio)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcInvestorWithdrawAlgorithmField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcQryInvestorPositionCombineDetailFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryInvestorPositionCombineDetailField data;
CThostFtdcQryInvestorPositionCombineDetailFieldWrapper(const CThostFtdcQryInvestorPositionCombineDetailField& _data = { 0 }) :data(_data) { }
CThostFtdcQryInvestorPositionCombineDetailFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryInvestorPositionCombineDetailField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.InvestUnitID, rowValue.at("InvestUnitID").c_str(), sizeof(TThostFtdcInvestUnitIDType));
strncpy(data.CombInstrumentID, rowValue.at("CombInstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorID + "','" + data.reserve1 + "','" + data.ExchangeID + "','" + data.InvestUnitID + "','" + data.CombInstrumentID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcQryInvestorPositionCombineDetailField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcMarketDataAveragePriceFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcMarketDataAveragePriceField data;
CThostFtdcMarketDataAveragePriceFieldWrapper(const CThostFtdcMarketDataAveragePriceField& _data = { 0 }) :data(_data) { }
CThostFtdcMarketDataAveragePriceFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcMarketDataAveragePriceField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
data.AveragePrice = std::stod(rowValue.at("AveragePrice"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
std::to_string(data.AveragePrice)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcVerifyInvestorPasswordFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcVerifyInvestorPasswordField data;
CThostFtdcVerifyInvestorPasswordFieldWrapper(const CThostFtdcVerifyInvestorPasswordField& _data = { 0 }) :data(_data) { }
CThostFtdcVerifyInvestorPasswordFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcVerifyInvestorPasswordField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.Password, rowValue.at("Password").c_str(), sizeof(TThostFtdcPasswordType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorID + "','" + data.Password
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcVerifyInvestorPasswordField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcUserIPFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcUserIPField data;
CThostFtdcUserIPFieldWrapper(const CThostFtdcUserIPField& _data = { 0 }) :data(_data) { }
CThostFtdcUserIPFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcUserIPField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldIPAddressType));
strncpy(data.reserve2, rowValue.at("reserve2").c_str(), sizeof(TThostFtdcOldIPAddressType));
strncpy(data.MacAddress, rowValue.at("MacAddress").c_str(), sizeof(TThostFtdcMacAddressType));
strncpy(data.IPAddress, rowValue.at("IPAddress").c_str(), sizeof(TThostFtdcIPAddressType));
strncpy(data.IPMask, rowValue.at("IPMask").c_str(), sizeof(TThostFtdcIPAddressType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.UserID + "','" + data.reserve1 + "','" + data.reserve2 + "','" + data.MacAddress + "','" + data.IPAddress + "','" + data.IPMask
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.UserID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& UserID) {
return "SELECT * FROM 'CThostFtdcUserIPField' where BrokerID='" + BrokerID + "' and UserID='" + UserID + "';";
}
};
struct CThostFtdcTradingNoticeInfoFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcTradingNoticeInfoField data;
CThostFtdcTradingNoticeInfoFieldWrapper(const CThostFtdcTradingNoticeInfoField& _data = { 0 }) :data(_data) { }
CThostFtdcTradingNoticeInfoFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcTradingNoticeInfoField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.SendTime, rowValue.at("SendTime").c_str(), sizeof(TThostFtdcTimeType));
strncpy(data.FieldContent, rowValue.at("FieldContent").c_str(), sizeof(TThostFtdcContentType));
data.SequenceSeries = std::stoi(rowValue.at("SequenceSeries"));
data.SequenceNo = std::stoi(rowValue.at("SequenceNo"));
strncpy(data.InvestUnitID, rowValue.at("InvestUnitID").c_str(), sizeof(TThostFtdcInvestUnitIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorID + "','" + data.SendTime + "','" + data.FieldContent + "','" + std::to_string(data.SequenceSeries) + "','" + std::to_string(data.SequenceNo) + "','" + data.InvestUnitID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcTradingNoticeInfoField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcTradingNoticeFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcTradingNoticeField data;
CThostFtdcTradingNoticeFieldWrapper(const CThostFtdcTradingNoticeField& _data = { 0 }) :data(_data) { }
CThostFtdcTradingNoticeFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcTradingNoticeField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
data.InvestorRange = rowValue.at("InvestorRange").empty() ? '0' : rowValue.at("InvestorRange")[0];
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
data.SequenceSeries = std::stoi(rowValue.at("SequenceSeries"));
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
strncpy(data.SendTime, rowValue.at("SendTime").c_str(), sizeof(TThostFtdcTimeType));
data.SequenceNo = std::stoi(rowValue.at("SequenceNo"));
strncpy(data.FieldContent, rowValue.at("FieldContent").c_str(), sizeof(TThostFtdcContentType));
strncpy(data.InvestUnitID, rowValue.at("InvestUnitID").c_str(), sizeof(TThostFtdcInvestUnitIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + (data.InvestorRange == 0 ? '0' : data.InvestorRange) + "','" + data.InvestorID + "','" + std::to_string(data.SequenceSeries) + "','" + data.UserID + "','" + data.SendTime + "','" + std::to_string(data.SequenceNo) + "','" + data.FieldContent + "','" + data.InvestUnitID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcTradingNoticeField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcQryTradingNoticeFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryTradingNoticeField data;
CThostFtdcQryTradingNoticeFieldWrapper(const CThostFtdcQryTradingNoticeField& _data = { 0 }) :data(_data) { }
CThostFtdcQryTradingNoticeFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryTradingNoticeField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.InvestUnitID, rowValue.at("InvestUnitID").c_str(), sizeof(TThostFtdcInvestUnitIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorID + "','" + data.InvestUnitID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcQryTradingNoticeField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcQryErrOrderFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryErrOrderField data;
CThostFtdcQryErrOrderFieldWrapper(const CThostFtdcQryErrOrderField& _data = { 0 }) :data(_data) { }
CThostFtdcQryErrOrderFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryErrOrderField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcQryErrOrderField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcErrOrderFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcErrOrderField data;
CThostFtdcErrOrderFieldWrapper(const CThostFtdcErrOrderField& _data = { 0 }) :data(_data) { }
CThostFtdcErrOrderFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcErrOrderField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
strncpy(data.OrderRef, rowValue.at("OrderRef").c_str(), sizeof(TThostFtdcOrderRefType));
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
data.OrderPriceType = rowValue.at("OrderPriceType").empty() ? '0' : rowValue.at("OrderPriceType")[0];
data.Direction = rowValue.at("Direction").empty() ? '0' : rowValue.at("Direction")[0];
strncpy(data.CombOffsetFlag, rowValue.at("CombOffsetFlag").c_str(), sizeof(TThostFtdcCombOffsetFlagType));
strncpy(data.CombHedgeFlag, rowValue.at("CombHedgeFlag").c_str(), sizeof(TThostFtdcCombHedgeFlagType));
data.LimitPrice = std::stod(rowValue.at("LimitPrice"));
data.VolumeTotalOriginal = std::stoi(rowValue.at("VolumeTotalOriginal"));
data.TimeCondition = rowValue.at("TimeCondition").empty() ? '0' : rowValue.at("TimeCondition")[0];
strncpy(data.GTDDate, rowValue.at("GTDDate").c_str(), sizeof(TThostFtdcDateType));
data.VolumeCondition = rowValue.at("VolumeCondition").empty() ? '0' : rowValue.at("VolumeCondition")[0];
data.MinVolume = std::stoi(rowValue.at("MinVolume"));
data.ContingentCondition = rowValue.at("ContingentCondition").empty() ? '0' : rowValue.at("ContingentCondition")[0];
data.StopPrice = std::stod(rowValue.at("StopPrice"));
data.ForceCloseReason = rowValue.at("ForceCloseReason").empty() ? '0' : rowValue.at("ForceCloseReason")[0];
data.IsAutoSuspend = std::stoi(rowValue.at("IsAutoSuspend"));
strncpy(data.BusinessUnit, rowValue.at("BusinessUnit").c_str(), sizeof(TThostFtdcBusinessUnitType));
data.RequestID = std::stoi(rowValue.at("RequestID"));
data.UserForceClose = std::stoi(rowValue.at("UserForceClose"));
data.ErrorID = std::stoi(rowValue.at("ErrorID"));
strncpy(data.ErrorMsg, utf8_to_gbk(rowValue.at("ErrorMsg")).c_str(), sizeof(TThostFtdcErrorMsgType));
data.IsSwapOrder = std::stoi(rowValue.at("IsSwapOrder"));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.InvestUnitID, rowValue.at("InvestUnitID").c_str(), sizeof(TThostFtdcInvestUnitIDType));
strncpy(data.AccountID, rowValue.at("AccountID").c_str(), sizeof(TThostFtdcAccountIDType));
strncpy(data.CurrencyID, rowValue.at("CurrencyID").c_str(), sizeof(TThostFtdcCurrencyIDType));
strncpy(data.ClientID, rowValue.at("ClientID").c_str(), sizeof(TThostFtdcClientIDType));
strncpy(data.reserve2, rowValue.at("reserve2").c_str(), sizeof(TThostFtdcOldIPAddressType));
strncpy(data.MacAddress, rowValue.at("MacAddress").c_str(), sizeof(TThostFtdcMacAddressType));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
strncpy(data.IPAddress, rowValue.at("IPAddress").c_str(), sizeof(TThostFtdcIPAddressType));
strncpy(data.OrderMemo, rowValue.at("OrderMemo").c_str(), sizeof(TThostFtdcOrderMemoType));
data.SessionReqSeq = std::stoi(rowValue.at("SessionReqSeq"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorID + "','" + data.reserve1 + "','" + data.OrderRef + "','" + data.UserID + "','" + (data.OrderPriceType == 0 ? '0' : data.OrderPriceType) + "','" + (data.Direction == 0 ? '0' : data.Direction) + "','" + data.CombOffsetFlag + "','" + data.CombHedgeFlag + "','" + std::to_string(data.LimitPrice) + "','" + std::to_string(data.VolumeTotalOriginal) + "','" + (data.TimeCondition == 0 ? '0' : data.TimeCondition) + "','" + data.GTDDate + "','" + (data.VolumeCondition == 0 ? '0' : data.VolumeCondition) + "','" + std::to_string(data.MinVolume) + "','" + (data.ContingentCondition == 0 ? '0' : data.ContingentCondition) + "','" + std::to_string(data.StopPrice) + "','" + (data.ForceCloseReason == 0 ? '0' : data.ForceCloseReason) + "','" + std::to_string(data.IsAutoSuspend) + "','" + data.BusinessUnit + "','" + std::to_string(data.RequestID) + "','" + std::to_string(data.UserForceClose) + "','" + std::to_string(data.ErrorID) + "','" + gbk_to_utf8(data.ErrorMsg) + "','" + std::to_string(data.IsSwapOrder) + "','" + data.ExchangeID + "','" + data.InvestUnitID + "','" + data.AccountID + "','" + data.CurrencyID + "','" + data.ClientID + "','" + data.reserve2 + "','" + data.MacAddress + "','" + data.InstrumentID + "','" + data.IPAddress + "','" + data.OrderMemo + "','" + std::to_string(data.SessionReqSeq)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcErrOrderField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcErrorConditionalOrderFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcErrorConditionalOrderField data;
CThostFtdcErrorConditionalOrderFieldWrapper(const CThostFtdcErrorConditionalOrderField& _data = { 0 }) :data(_data) { }
CThostFtdcErrorConditionalOrderFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcErrorConditionalOrderField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
strncpy(data.OrderRef, rowValue.at("OrderRef").c_str(), sizeof(TThostFtdcOrderRefType));
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
data.OrderPriceType = rowValue.at("OrderPriceType").empty() ? '0' : rowValue.at("OrderPriceType")[0];
data.Direction = rowValue.at("Direction").empty() ? '0' : rowValue.at("Direction")[0];
strncpy(data.CombOffsetFlag, rowValue.at("CombOffsetFlag").c_str(), sizeof(TThostFtdcCombOffsetFlagType));
strncpy(data.CombHedgeFlag, rowValue.at("CombHedgeFlag").c_str(), sizeof(TThostFtdcCombHedgeFlagType));
data.LimitPrice = std::stod(rowValue.at("LimitPrice"));
data.VolumeTotalOriginal = std::stoi(rowValue.at("VolumeTotalOriginal"));
data.TimeCondition = rowValue.at("TimeCondition").empty() ? '0' : rowValue.at("TimeCondition")[0];
strncpy(data.GTDDate, rowValue.at("GTDDate").c_str(), sizeof(TThostFtdcDateType));
data.VolumeCondition = rowValue.at("VolumeCondition").empty() ? '0' : rowValue.at("VolumeCondition")[0];
data.MinVolume = std::stoi(rowValue.at("MinVolume"));
data.ContingentCondition = rowValue.at("ContingentCondition").empty() ? '0' : rowValue.at("ContingentCondition")[0];
data.StopPrice = std::stod(rowValue.at("StopPrice"));
data.ForceCloseReason = rowValue.at("ForceCloseReason").empty() ? '0' : rowValue.at("ForceCloseReason")[0];
data.IsAutoSuspend = std::stoi(rowValue.at("IsAutoSuspend"));
strncpy(data.BusinessUnit, rowValue.at("BusinessUnit").c_str(), sizeof(TThostFtdcBusinessUnitType));
data.RequestID = std::stoi(rowValue.at("RequestID"));
strncpy(data.OrderLocalID, rowValue.at("OrderLocalID").c_str(), sizeof(TThostFtdcOrderLocalIDType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.ParticipantID, rowValue.at("ParticipantID").c_str(), sizeof(TThostFtdcParticipantIDType));
strncpy(data.ClientID, rowValue.at("ClientID").c_str(), sizeof(TThostFtdcClientIDType));
strncpy(data.reserve2, rowValue.at("reserve2").c_str(), sizeof(TThostFtdcOldExchangeInstIDType));
strncpy(data.TraderID, rowValue.at("TraderID").c_str(), sizeof(TThostFtdcTraderIDType));
data.InstallID = std::stoi(rowValue.at("InstallID"));
data.OrderSubmitStatus = rowValue.at("OrderSubmitStatus").empty() ? '0' : rowValue.at("OrderSubmitStatus")[0];
data.NotifySequence = std::stoi(rowValue.at("NotifySequence"));
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcDateType));
data.SettlementID = std::stoi(rowValue.at("SettlementID"));
strncpy(data.OrderSysID, rowValue.at("OrderSysID").c_str(), sizeof(TThostFtdcOrderSysIDType));
data.OrderSource = rowValue.at("OrderSource").empty() ? '0' : rowValue.at("OrderSource")[0];
data.OrderStatus = rowValue.at("OrderStatus").empty() ? '0' : rowValue.at("OrderStatus")[0];
data.OrderType = rowValue.at("OrderType").empty() ? '0' : rowValue.at("OrderType")[0];
data.VolumeTraded = std::stoi(rowValue.at("VolumeTraded"));
data.VolumeTotal = std::stoi(rowValue.at("VolumeTotal"));
strncpy(data.InsertDate, rowValue.at("InsertDate").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.InsertTime, rowValue.at("InsertTime").c_str(), sizeof(TThostFtdcTimeType));
strncpy(data.ActiveTime, rowValue.at("ActiveTime").c_str(), sizeof(TThostFtdcTimeType));
strncpy(data.SuspendTime, rowValue.at("SuspendTime").c_str(), sizeof(TThostFtdcTimeType));
strncpy(data.UpdateTime, rowValue.at("UpdateTime").c_str(), sizeof(TThostFtdcTimeType));
strncpy(data.CancelTime, rowValue.at("CancelTime").c_str(), sizeof(TThostFtdcTimeType));
strncpy(data.ActiveTraderID, rowValue.at("ActiveTraderID").c_str(), sizeof(TThostFtdcTraderIDType));
strncpy(data.ClearingPartID, rowValue.at("ClearingPartID").c_str(), sizeof(TThostFtdcParticipantIDType));
data.SequenceNo = std::stoi(rowValue.at("SequenceNo"));
data.FrontID = std::stoi(rowValue.at("FrontID"));
data.SessionID = std::stoi(rowValue.at("SessionID"));
strncpy(data.UserProductInfo, rowValue.at("UserProductInfo").c_str(), sizeof(TThostFtdcProductInfoType));
strncpy(data.StatusMsg, utf8_to_gbk(rowValue.at("StatusMsg")).c_str(), sizeof(TThostFtdcErrorMsgType));
data.UserForceClose = std::stoi(rowValue.at("UserForceClose"));
strncpy(data.ActiveUserID, rowValue.at("ActiveUserID").c_str(), sizeof(TThostFtdcUserIDType));
data.BrokerOrderSeq = std::stoi(rowValue.at("BrokerOrderSeq"));
strncpy(data.RelativeOrderSysID, rowValue.at("RelativeOrderSysID").c_str(), sizeof(TThostFtdcOrderSysIDType));
data.ZCETotalTradedVolume = std::stoi(rowValue.at("ZCETotalTradedVolume"));
data.ErrorID = std::stoi(rowValue.at("ErrorID"));
strncpy(data.ErrorMsg, utf8_to_gbk(rowValue.at("ErrorMsg")).c_str(), sizeof(TThostFtdcErrorMsgType));
data.IsSwapOrder = std::stoi(rowValue.at("IsSwapOrder"));
strncpy(data.BranchID, rowValue.at("BranchID").c_str(), sizeof(TThostFtdcBranchIDType));
strncpy(data.InvestUnitID, rowValue.at("InvestUnitID").c_str(), sizeof(TThostFtdcInvestUnitIDType));
strncpy(data.AccountID, rowValue.at("AccountID").c_str(), sizeof(TThostFtdcAccountIDType));
strncpy(data.CurrencyID, rowValue.at("CurrencyID").c_str(), sizeof(TThostFtdcCurrencyIDType));
strncpy(data.reserve3, rowValue.at("reserve3").c_str(), sizeof(TThostFtdcOldIPAddressType));
strncpy(data.MacAddress, rowValue.at("MacAddress").c_str(), sizeof(TThostFtdcMacAddressType));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
strncpy(data.ExchangeInstID, rowValue.at("ExchangeInstID").c_str(), sizeof(TThostFtdcExchangeInstIDType));
strncpy(data.IPAddress, rowValue.at("IPAddress").c_str(), sizeof(TThostFtdcIPAddressType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorID + "','" + data.reserve1 + "','" + data.OrderRef + "','" + data.UserID + "','" + (data.OrderPriceType == 0 ? '0' : data.OrderPriceType) + "','" + (data.Direction == 0 ? '0' : data.Direction) + "','" + data.CombOffsetFlag + "','" + data.CombHedgeFlag + "','" + std::to_string(data.LimitPrice) + "','" + std::to_string(data.VolumeTotalOriginal) + "','" + (data.TimeCondition == 0 ? '0' : data.TimeCondition) + "','" + data.GTDDate + "','" + (data.VolumeCondition == 0 ? '0' : data.VolumeCondition) + "','" + std::to_string(data.MinVolume) + "','" + (data.ContingentCondition == 0 ? '0' : data.ContingentCondition) + "','" + std::to_string(data.StopPrice) + "','" + (data.ForceCloseReason == 0 ? '0' : data.ForceCloseReason) + "','" + std::to_string(data.IsAutoSuspend) + "','" + data.BusinessUnit + "','" + std::to_string(data.RequestID) + "','" + data.OrderLocalID + "','" + data.ExchangeID + "','" + data.ParticipantID + "','" + data.ClientID + "','" + data.reserve2 + "','" + data.TraderID + "','" + std::to_string(data.InstallID) + "','" + (data.OrderSubmitStatus == 0 ? '0' : data.OrderSubmitStatus) + "','" + std::to_string(data.NotifySequence) + "','" + data.TradingDay + "','" + std::to_string(data.SettlementID) + "','" + data.OrderSysID + "','" + (data.OrderSource == 0 ? '0' : data.OrderSource) + "','" + (data.OrderStatus == 0 ? '0' : data.OrderStatus) + "','" + (data.OrderType == 0 ? '0' : data.OrderType) + "','" + std::to_string(data.VolumeTraded) + "','" + std::to_string(data.VolumeTotal) + "','" + data.InsertDate + "','" + data.InsertTime + "','" + data.ActiveTime + "','" + data.SuspendTime + "','" + data.UpdateTime + "','" + data.CancelTime + "','" + data.ActiveTraderID + "','" + data.ClearingPartID + "','" + std::to_string(data.SequenceNo) + "','" + std::to_string(data.FrontID) + "','" + std::to_string(data.SessionID) + "','" + data.UserProductInfo + "','" + gbk_to_utf8(data.StatusMsg) + "','" + std::to_string(data.UserForceClose) + "','" + data.ActiveUserID + "','" + std::to_string(data.BrokerOrderSeq) + "','" + data.RelativeOrderSysID + "','" + std::to_string(data.ZCETotalTradedVolume) + "','" + std::to_string(data.ErrorID) + "','" + gbk_to_utf8(data.ErrorMsg) + "','" + std::to_string(data.IsSwapOrder) + "','" + data.BranchID + "','" + data.InvestUnitID + "','" + data.AccountID + "','" + data.CurrencyID + "','" + data.reserve3 + "','" + data.MacAddress + "','" + data.InstrumentID + "','" + data.ExchangeInstID + "','" + data.IPAddress
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcErrorConditionalOrderField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcQryErrOrderActionFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryErrOrderActionField data;
CThostFtdcQryErrOrderActionFieldWrapper(const CThostFtdcQryErrOrderActionField& _data = { 0 }) :data(_data) { }
CThostFtdcQryErrOrderActionFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryErrOrderActionField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcQryErrOrderActionField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcErrOrderActionFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcErrOrderActionField data;
CThostFtdcErrOrderActionFieldWrapper(const CThostFtdcErrOrderActionField& _data = { 0 }) :data(_data) { }
CThostFtdcErrOrderActionFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcErrOrderActionField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
data.OrderActionRef = std::stoi(rowValue.at("OrderActionRef"));
strncpy(data.OrderRef, rowValue.at("OrderRef").c_str(), sizeof(TThostFtdcOrderRefType));
data.RequestID = std::stoi(rowValue.at("RequestID"));
data.FrontID = std::stoi(rowValue.at("FrontID"));
data.SessionID = std::stoi(rowValue.at("SessionID"));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.OrderSysID, rowValue.at("OrderSysID").c_str(), sizeof(TThostFtdcOrderSysIDType));
data.ActionFlag = rowValue.at("ActionFlag").empty() ? '0' : rowValue.at("ActionFlag")[0];
data.LimitPrice = std::stod(rowValue.at("LimitPrice"));
data.VolumeChange = std::stoi(rowValue.at("VolumeChange"));
strncpy(data.ActionDate, rowValue.at("ActionDate").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.ActionTime, rowValue.at("ActionTime").c_str(), sizeof(TThostFtdcTimeType));
strncpy(data.TraderID, rowValue.at("TraderID").c_str(), sizeof(TThostFtdcTraderIDType));
data.InstallID = std::stoi(rowValue.at("InstallID"));
strncpy(data.OrderLocalID, rowValue.at("OrderLocalID").c_str(), sizeof(TThostFtdcOrderLocalIDType));
strncpy(data.ActionLocalID, rowValue.at("ActionLocalID").c_str(), sizeof(TThostFtdcOrderLocalIDType));
strncpy(data.ParticipantID, rowValue.at("ParticipantID").c_str(), sizeof(TThostFtdcParticipantIDType));
strncpy(data.ClientID, rowValue.at("ClientID").c_str(), sizeof(TThostFtdcClientIDType));
strncpy(data.BusinessUnit, rowValue.at("BusinessUnit").c_str(), sizeof(TThostFtdcBusinessUnitType));
data.OrderActionStatus = rowValue.at("OrderActionStatus").empty() ? '0' : rowValue.at("OrderActionStatus")[0];
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
strncpy(data.StatusMsg, utf8_to_gbk(rowValue.at("StatusMsg")).c_str(), sizeof(TThostFtdcErrorMsgType));
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
strncpy(data.BranchID, rowValue.at("BranchID").c_str(), sizeof(TThostFtdcBranchIDType));
strncpy(data.InvestUnitID, rowValue.at("InvestUnitID").c_str(), sizeof(TThostFtdcInvestUnitIDType));
strncpy(data.reserve2, rowValue.at("reserve2").c_str(), sizeof(TThostFtdcOldIPAddressType));
strncpy(data.MacAddress, rowValue.at("MacAddress").c_str(), sizeof(TThostFtdcMacAddressType));
data.ErrorID = std::stoi(rowValue.at("ErrorID"));
strncpy(data.ErrorMsg, utf8_to_gbk(rowValue.at("ErrorMsg")).c_str(), sizeof(TThostFtdcErrorMsgType));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
strncpy(data.IPAddress, rowValue.at("IPAddress").c_str(), sizeof(TThostFtdcIPAddressType));
strncpy(data.OrderMemo, rowValue.at("OrderMemo").c_str(), sizeof(TThostFtdcOrderMemoType));
data.SessionReqSeq = std::stoi(rowValue.at("SessionReqSeq"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorID + "','" + std::to_string(data.OrderActionRef) + "','" + data.OrderRef + "','" + std::to_string(data.RequestID) + "','" + std::to_string(data.FrontID) + "','" + std::to_string(data.SessionID) + "','" + data.ExchangeID + "','" + data.OrderSysID + "','" + (data.ActionFlag == 0 ? '0' : data.ActionFlag) + "','" + std::to_string(data.LimitPrice) + "','" + std::to_string(data.VolumeChange) + "','" + data.ActionDate + "','" + data.ActionTime + "','" + data.TraderID + "','" + std::to_string(data.InstallID) + "','" + data.OrderLocalID + "','" + data.ActionLocalID + "','" + data.ParticipantID + "','" + data.ClientID + "','" + data.BusinessUnit + "','" + (data.OrderActionStatus == 0 ? '0' : data.OrderActionStatus) + "','" + data.UserID + "','" + gbk_to_utf8(data.StatusMsg) + "','" + data.reserve1 + "','" + data.BranchID + "','" + data.InvestUnitID + "','" + data.reserve2 + "','" + data.MacAddress + "','" + std::to_string(data.ErrorID) + "','" + gbk_to_utf8(data.ErrorMsg) + "','" + data.InstrumentID + "','" + data.IPAddress + "','" + data.OrderMemo + "','" + std::to_string(data.SessionReqSeq)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcErrOrderActionField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcQryExchangeSequenceFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryExchangeSequenceField data;
CThostFtdcQryExchangeSequenceFieldWrapper(const CThostFtdcQryExchangeSequenceField& _data = { 0 }) :data(_data) { }
CThostFtdcQryExchangeSequenceFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryExchangeSequenceField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.ExchangeID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcExchangeSequenceFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcExchangeSequenceField data;
CThostFtdcExchangeSequenceFieldWrapper(const CThostFtdcExchangeSequenceField& _data = { 0 }) :data(_data) { }
CThostFtdcExchangeSequenceFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcExchangeSequenceField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
data.SequenceNo = std::stoi(rowValue.at("SequenceNo"));
data.MarketStatus = rowValue.at("MarketStatus").empty() ? '0' : rowValue.at("MarketStatus")[0];
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.ExchangeID + "','" + std::to_string(data.SequenceNo) + "','" + (data.MarketStatus == 0 ? '0' : data.MarketStatus)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcQryMaxOrderVolumeWithPriceFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryMaxOrderVolumeWithPriceField data;
CThostFtdcQryMaxOrderVolumeWithPriceFieldWrapper(const CThostFtdcQryMaxOrderVolumeWithPriceField& _data = { 0 }) :data(_data) { }
CThostFtdcQryMaxOrderVolumeWithPriceFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryMaxOrderVolumeWithPriceField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
data.Direction = rowValue.at("Direction").empty() ? '0' : rowValue.at("Direction")[0];
data.OffsetFlag = rowValue.at("OffsetFlag").empty() ? '0' : rowValue.at("OffsetFlag")[0];
data.HedgeFlag = rowValue.at("HedgeFlag").empty() ? '0' : rowValue.at("HedgeFlag")[0];
data.MaxVolume = std::stoi(rowValue.at("MaxVolume"));
data.Price = std::stod(rowValue.at("Price"));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.InvestUnitID, rowValue.at("InvestUnitID").c_str(), sizeof(TThostFtdcInvestUnitIDType));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorID + "','" + data.reserve1 + "','" + (data.Direction == 0 ? '0' : data.Direction) + "','" + (data.OffsetFlag == 0 ? '0' : data.OffsetFlag) + "','" + (data.HedgeFlag == 0 ? '0' : data.HedgeFlag) + "','" + std::to_string(data.MaxVolume) + "','" + std::to_string(data.Price) + "','" + data.ExchangeID + "','" + data.InvestUnitID + "','" + data.InstrumentID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcQryMaxOrderVolumeWithPriceField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcQryBrokerTradingParamsFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryBrokerTradingParamsField data;
CThostFtdcQryBrokerTradingParamsFieldWrapper(const CThostFtdcQryBrokerTradingParamsField& _data = { 0 }) :data(_data) { }
CThostFtdcQryBrokerTradingParamsFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryBrokerTradingParamsField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.CurrencyID, rowValue.at("CurrencyID").c_str(), sizeof(TThostFtdcCurrencyIDType));
strncpy(data.AccountID, rowValue.at("AccountID").c_str(), sizeof(TThostFtdcAccountIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorID + "','" + data.CurrencyID + "','" + data.AccountID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcQryBrokerTradingParamsField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcBrokerTradingParamsFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcBrokerTradingParamsField data;
CThostFtdcBrokerTradingParamsFieldWrapper(const CThostFtdcBrokerTradingParamsField& _data = { 0 }) :data(_data) { }
CThostFtdcBrokerTradingParamsFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcBrokerTradingParamsField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
data.MarginPriceType = rowValue.at("MarginPriceType").empty() ? '0' : rowValue.at("MarginPriceType")[0];
data.Algorithm = rowValue.at("Algorithm").empty() ? '0' : rowValue.at("Algorithm")[0];
data.AvailIncludeCloseProfit = rowValue.at("AvailIncludeCloseProfit").empty() ? '0' : rowValue.at("AvailIncludeCloseProfit")[0];
strncpy(data.CurrencyID, rowValue.at("CurrencyID").c_str(), sizeof(TThostFtdcCurrencyIDType));
data.OptionRoyaltyPriceType = rowValue.at("OptionRoyaltyPriceType").empty() ? '0' : rowValue.at("OptionRoyaltyPriceType")[0];
strncpy(data.AccountID, rowValue.at("AccountID").c_str(), sizeof(TThostFtdcAccountIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorID + "','" + (data.MarginPriceType == 0 ? '0' : data.MarginPriceType) + "','" + (data.Algorithm == 0 ? '0' : data.Algorithm) + "','" + (data.AvailIncludeCloseProfit == 0 ? '0' : data.AvailIncludeCloseProfit) + "','" + data.CurrencyID + "','" + (data.OptionRoyaltyPriceType == 0 ? '0' : data.OptionRoyaltyPriceType) + "','" + data.AccountID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcBrokerTradingParamsField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcQryBrokerTradingAlgosFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryBrokerTradingAlgosField data;
CThostFtdcQryBrokerTradingAlgosFieldWrapper(const CThostFtdcQryBrokerTradingAlgosField& _data = { 0 }) :data(_data) { }
CThostFtdcQryBrokerTradingAlgosFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryBrokerTradingAlgosField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.ExchangeID + "','" + data.reserve1 + "','" + data.InstrumentID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcBrokerTradingAlgosFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcBrokerTradingAlgosField data;
CThostFtdcBrokerTradingAlgosFieldWrapper(const CThostFtdcBrokerTradingAlgosField& _data = { 0 }) :data(_data) { }
CThostFtdcBrokerTradingAlgosFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcBrokerTradingAlgosField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
data.HandlePositionAlgoID = rowValue.at("HandlePositionAlgoID").empty() ? '0' : rowValue.at("HandlePositionAlgoID")[0];
data.FindMarginRateAlgoID = rowValue.at("FindMarginRateAlgoID").empty() ? '0' : rowValue.at("FindMarginRateAlgoID")[0];
data.HandleTradingAccountAlgoID = rowValue.at("HandleTradingAccountAlgoID").empty() ? '0' : rowValue.at("HandleTradingAccountAlgoID")[0];
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.ExchangeID + "','" + data.reserve1 + "','" + (data.HandlePositionAlgoID == 0 ? '0' : data.HandlePositionAlgoID) + "','" + (data.FindMarginRateAlgoID == 0 ? '0' : data.FindMarginRateAlgoID) + "','" + (data.HandleTradingAccountAlgoID == 0 ? '0' : data.HandleTradingAccountAlgoID) + "','" + data.InstrumentID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcQueryBrokerDepositFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQueryBrokerDepositField data;
CThostFtdcQueryBrokerDepositFieldWrapper(const CThostFtdcQueryBrokerDepositField& _data = { 0 }) :data(_data) { }
CThostFtdcQueryBrokerDepositFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQueryBrokerDepositField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.ExchangeID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcBrokerDepositFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcBrokerDepositField data;
CThostFtdcBrokerDepositFieldWrapper(const CThostFtdcBrokerDepositField& _data = { 0 }) :data(_data) { }
CThostFtdcBrokerDepositFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcBrokerDepositField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcTradeDateType));
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.ParticipantID, rowValue.at("ParticipantID").c_str(), sizeof(TThostFtdcParticipantIDType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
data.PreBalance = std::stod(rowValue.at("PreBalance"));
data.CurrMargin = std::stod(rowValue.at("CurrMargin"));
data.CloseProfit = std::stod(rowValue.at("CloseProfit"));
data.Balance = std::stod(rowValue.at("Balance"));
data.Deposit = std::stod(rowValue.at("Deposit"));
data.Withdraw = std::stod(rowValue.at("Withdraw"));
data.Available = std::stod(rowValue.at("Available"));
data.Reserve = std::stod(rowValue.at("Reserve"));
data.FrozenMargin = std::stod(rowValue.at("FrozenMargin"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.TradingDay + "','" + data.BrokerID + "','" + data.ParticipantID + "','" + data.ExchangeID + "','" + std::to_string(data.PreBalance) + "','" + std::to_string(data.CurrMargin) + "','" + std::to_string(data.CloseProfit) + "','" + std::to_string(data.Balance) + "','" + std::to_string(data.Deposit) + "','" + std::to_string(data.Withdraw) + "','" + std::to_string(data.Available) + "','" + std::to_string(data.Reserve) + "','" + std::to_string(data.FrozenMargin)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcQryCFMMCBrokerKeyFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryCFMMCBrokerKeyField data;
CThostFtdcQryCFMMCBrokerKeyFieldWrapper(const CThostFtdcQryCFMMCBrokerKeyField& _data = { 0 }) :data(_data) { }
CThostFtdcQryCFMMCBrokerKeyFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryCFMMCBrokerKeyField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcCFMMCBrokerKeyFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcCFMMCBrokerKeyField data;
CThostFtdcCFMMCBrokerKeyFieldWrapper(const CThostFtdcCFMMCBrokerKeyField& _data = { 0 }) :data(_data) { }
CThostFtdcCFMMCBrokerKeyFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcCFMMCBrokerKeyField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.ParticipantID, rowValue.at("ParticipantID").c_str(), sizeof(TThostFtdcParticipantIDType));
strncpy(data.CreateDate, rowValue.at("CreateDate").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.CreateTime, rowValue.at("CreateTime").c_str(), sizeof(TThostFtdcTimeType));
data.KeyID = std::stoi(rowValue.at("KeyID"));
strncpy(data.CurrentKey, rowValue.at("CurrentKey").c_str(), sizeof(TThostFtdcCFMMCKeyType));
data.KeyKind = rowValue.at("KeyKind").empty() ? '0' : rowValue.at("KeyKind")[0];
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.ParticipantID + "','" + data.CreateDate + "','" + data.CreateTime + "','" + std::to_string(data.KeyID) + "','" + data.CurrentKey + "','" + (data.KeyKind == 0 ? '0' : data.KeyKind)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcCFMMCTradingAccountKeyFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcCFMMCTradingAccountKeyField data;
CThostFtdcCFMMCTradingAccountKeyFieldWrapper(const CThostFtdcCFMMCTradingAccountKeyField& _data = { 0 }) :data(_data) { }
CThostFtdcCFMMCTradingAccountKeyFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcCFMMCTradingAccountKeyField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.ParticipantID, rowValue.at("ParticipantID").c_str(), sizeof(TThostFtdcParticipantIDType));
strncpy(data.AccountID, rowValue.at("AccountID").c_str(), sizeof(TThostFtdcAccountIDType));
data.KeyID = std::stoi(rowValue.at("KeyID"));
strncpy(data.CurrentKey, rowValue.at("CurrentKey").c_str(), sizeof(TThostFtdcCFMMCKeyType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.ParticipantID + "','" + data.AccountID + "','" + std::to_string(data.KeyID) + "','" + data.CurrentKey
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.AccountID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& AccountID) {
return "SELECT * FROM 'CThostFtdcCFMMCTradingAccountKeyField' where BrokerID='" + BrokerID + "' and AccountID='" + AccountID + "';";
}
};
struct CThostFtdcQryCFMMCTradingAccountKeyFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryCFMMCTradingAccountKeyField data;
CThostFtdcQryCFMMCTradingAccountKeyFieldWrapper(const CThostFtdcQryCFMMCTradingAccountKeyField& _data = { 0 }) :data(_data) { }
CThostFtdcQryCFMMCTradingAccountKeyFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryCFMMCTradingAccountKeyField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcQryCFMMCTradingAccountKeyField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcBrokerUserOTPParamFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcBrokerUserOTPParamField data;
CThostFtdcBrokerUserOTPParamFieldWrapper(const CThostFtdcBrokerUserOTPParamField& _data = { 0 }) :data(_data) { }
CThostFtdcBrokerUserOTPParamFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcBrokerUserOTPParamField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
strncpy(data.OTPVendorsID, rowValue.at("OTPVendorsID").c_str(), sizeof(TThostFtdcOTPVendorsIDType));
strncpy(data.SerialNumber, rowValue.at("SerialNumber").c_str(), sizeof(TThostFtdcSerialNumberType));
strncpy(data.AuthKey, rowValue.at("AuthKey").c_str(), sizeof(TThostFtdcAuthKeyType));
data.LastDrift = std::stoi(rowValue.at("LastDrift"));
data.LastSuccess = std::stoi(rowValue.at("LastSuccess"));
data.OTPType = rowValue.at("OTPType").empty() ? '0' : rowValue.at("OTPType")[0];
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.UserID + "','" + data.OTPVendorsID + "','" + data.SerialNumber + "','" + data.AuthKey + "','" + std::to_string(data.LastDrift) + "','" + std::to_string(data.LastSuccess) + "','" + (data.OTPType == 0 ? '0' : data.OTPType)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.UserID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& UserID) {
return "SELECT * FROM 'CThostFtdcBrokerUserOTPParamField' where BrokerID='" + BrokerID + "' and UserID='" + UserID + "';";
}
};
struct CThostFtdcManualSyncBrokerUserOTPFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcManualSyncBrokerUserOTPField data;
CThostFtdcManualSyncBrokerUserOTPFieldWrapper(const CThostFtdcManualSyncBrokerUserOTPField& _data = { 0 }) :data(_data) { }
CThostFtdcManualSyncBrokerUserOTPFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcManualSyncBrokerUserOTPField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
data.OTPType = rowValue.at("OTPType").empty() ? '0' : rowValue.at("OTPType")[0];
strncpy(data.FirstOTP, rowValue.at("FirstOTP").c_str(), sizeof(TThostFtdcPasswordType));
strncpy(data.SecondOTP, rowValue.at("SecondOTP").c_str(), sizeof(TThostFtdcPasswordType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.UserID + "','" + (data.OTPType == 0 ? '0' : data.OTPType) + "','" + data.FirstOTP + "','" + data.SecondOTP
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.UserID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& UserID) {
return "SELECT * FROM 'CThostFtdcManualSyncBrokerUserOTPField' where BrokerID='" + BrokerID + "' and UserID='" + UserID + "';";
}
};
struct CThostFtdcCommRateModelFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcCommRateModelField data;
CThostFtdcCommRateModelFieldWrapper(const CThostFtdcCommRateModelField& _data = { 0 }) :data(_data) { }
CThostFtdcCommRateModelFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcCommRateModelField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.CommModelID, rowValue.at("CommModelID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.CommModelName, rowValue.at("CommModelName").c_str(), sizeof(TThostFtdcCommModelNameType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.CommModelID + "','" + data.CommModelName
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcQryCommRateModelFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryCommRateModelField data;
CThostFtdcQryCommRateModelFieldWrapper(const CThostFtdcQryCommRateModelField& _data = { 0 }) :data(_data) { }
CThostFtdcQryCommRateModelFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryCommRateModelField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.CommModelID, rowValue.at("CommModelID").c_str(), sizeof(TThostFtdcInvestorIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.CommModelID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcMarginModelFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcMarginModelField data;
CThostFtdcMarginModelFieldWrapper(const CThostFtdcMarginModelField& _data = { 0 }) :data(_data) { }
CThostFtdcMarginModelFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcMarginModelField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.MarginModelID, rowValue.at("MarginModelID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.MarginModelName, rowValue.at("MarginModelName").c_str(), sizeof(TThostFtdcCommModelNameType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.MarginModelID + "','" + data.MarginModelName
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcQryMarginModelFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryMarginModelField data;
CThostFtdcQryMarginModelFieldWrapper(const CThostFtdcQryMarginModelField& _data = { 0 }) :data(_data) { }
CThostFtdcQryMarginModelFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryMarginModelField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.MarginModelID, rowValue.at("MarginModelID").c_str(), sizeof(TThostFtdcInvestorIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.MarginModelID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcEWarrantOffsetFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcEWarrantOffsetField data;
CThostFtdcEWarrantOffsetFieldWrapper(const CThostFtdcEWarrantOffsetField& _data = { 0 }) :data(_data) { }
CThostFtdcEWarrantOffsetFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcEWarrantOffsetField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcTradeDateType));
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
data.Direction = rowValue.at("Direction").empty() ? '0' : rowValue.at("Direction")[0];
data.HedgeFlag = rowValue.at("HedgeFlag").empty() ? '0' : rowValue.at("HedgeFlag")[0];
data.Volume = std::stoi(rowValue.at("Volume"));
strncpy(data.InvestUnitID, rowValue.at("InvestUnitID").c_str(), sizeof(TThostFtdcInvestUnitIDType));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.TradingDay + "','" + data.BrokerID + "','" + data.InvestorID + "','" + data.ExchangeID + "','" + data.reserve1 + "','" + (data.Direction == 0 ? '0' : data.Direction) + "','" + (data.HedgeFlag == 0 ? '0' : data.HedgeFlag) + "','" + std::to_string(data.Volume) + "','" + data.InvestUnitID + "','" + data.InstrumentID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcEWarrantOffsetField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcQryEWarrantOffsetFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryEWarrantOffsetField data;
CThostFtdcQryEWarrantOffsetFieldWrapper(const CThostFtdcQryEWarrantOffsetField& _data = { 0 }) :data(_data) { }
CThostFtdcQryEWarrantOffsetFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryEWarrantOffsetField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
strncpy(data.InvestUnitID, rowValue.at("InvestUnitID").c_str(), sizeof(TThostFtdcInvestUnitIDType));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorID + "','" + data.ExchangeID + "','" + data.reserve1 + "','" + data.InvestUnitID + "','" + data.InstrumentID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcQryEWarrantOffsetField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcQryInvestorProductGroupMarginFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryInvestorProductGroupMarginField data;
CThostFtdcQryInvestorProductGroupMarginFieldWrapper(const CThostFtdcQryInvestorProductGroupMarginField& _data = { 0 }) :data(_data) { }
CThostFtdcQryInvestorProductGroupMarginFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryInvestorProductGroupMarginField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
data.HedgeFlag = rowValue.at("HedgeFlag").empty() ? '0' : rowValue.at("HedgeFlag")[0];
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.InvestUnitID, rowValue.at("InvestUnitID").c_str(), sizeof(TThostFtdcInvestUnitIDType));
strncpy(data.ProductGroupID, rowValue.at("ProductGroupID").c_str(), sizeof(TThostFtdcInstrumentIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorID + "','" + data.reserve1 + "','" + (data.HedgeFlag == 0 ? '0' : data.HedgeFlag) + "','" + data.ExchangeID + "','" + data.InvestUnitID + "','" + data.ProductGroupID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcQryInvestorProductGroupMarginField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcInvestorProductGroupMarginFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcInvestorProductGroupMarginField data;
CThostFtdcInvestorProductGroupMarginFieldWrapper(const CThostFtdcInvestorProductGroupMarginField& _data = { 0 }) :data(_data) { }
CThostFtdcInvestorProductGroupMarginFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcInvestorProductGroupMarginField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcDateType));
data.SettlementID = std::stoi(rowValue.at("SettlementID"));
data.FrozenMargin = std::stod(rowValue.at("FrozenMargin"));
data.LongFrozenMargin = std::stod(rowValue.at("LongFrozenMargin"));
data.ShortFrozenMargin = std::stod(rowValue.at("ShortFrozenMargin"));
data.UseMargin = std::stod(rowValue.at("UseMargin"));
data.LongUseMargin = std::stod(rowValue.at("LongUseMargin"));
data.ShortUseMargin = std::stod(rowValue.at("ShortUseMargin"));
data.ExchMargin = std::stod(rowValue.at("ExchMargin"));
data.LongExchMargin = std::stod(rowValue.at("LongExchMargin"));
data.ShortExchMargin = std::stod(rowValue.at("ShortExchMargin"));
data.CloseProfit = std::stod(rowValue.at("CloseProfit"));
data.FrozenCommission = std::stod(rowValue.at("FrozenCommission"));
data.Commission = std::stod(rowValue.at("Commission"));
data.FrozenCash = std::stod(rowValue.at("FrozenCash"));
data.CashIn = std::stod(rowValue.at("CashIn"));
data.PositionProfit = std::stod(rowValue.at("PositionProfit"));
data.OffsetAmount = std::stod(rowValue.at("OffsetAmount"));
data.LongOffsetAmount = std::stod(rowValue.at("LongOffsetAmount"));
data.ShortOffsetAmount = std::stod(rowValue.at("ShortOffsetAmount"));
data.ExchOffsetAmount = std::stod(rowValue.at("ExchOffsetAmount"));
data.LongExchOffsetAmount = std::stod(rowValue.at("LongExchOffsetAmount"));
data.ShortExchOffsetAmount = std::stod(rowValue.at("ShortExchOffsetAmount"));
data.HedgeFlag = rowValue.at("HedgeFlag").empty() ? '0' : rowValue.at("HedgeFlag")[0];
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.InvestUnitID, rowValue.at("InvestUnitID").c_str(), sizeof(TThostFtdcInvestUnitIDType));
strncpy(data.ProductGroupID, rowValue.at("ProductGroupID").c_str(), sizeof(TThostFtdcInstrumentIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.reserve1 + "','" + data.BrokerID + "','" + data.InvestorID + "','" + data.TradingDay + "','" + std::to_string(data.SettlementID) + "','" + std::to_string(data.FrozenMargin) + "','" + std::to_string(data.LongFrozenMargin) + "','" + std::to_string(data.ShortFrozenMargin) + "','" + std::to_string(data.UseMargin) + "','" + std::to_string(data.LongUseMargin) + "','" + std::to_string(data.ShortUseMargin) + "','" + std::to_string(data.ExchMargin) + "','" + std::to_string(data.LongExchMargin) + "','" + std::to_string(data.ShortExchMargin) + "','" + std::to_string(data.CloseProfit) + "','" + std::to_string(data.FrozenCommission) + "','" + std::to_string(data.Commission) + "','" + std::to_string(data.FrozenCash) + "','" + std::to_string(data.CashIn) + "','" + std::to_string(data.PositionProfit) + "','" + std::to_string(data.OffsetAmount) + "','" + std::to_string(data.LongOffsetAmount) + "','" + std::to_string(data.ShortOffsetAmount) + "','" + std::to_string(data.ExchOffsetAmount) + "','" + std::to_string(data.LongExchOffsetAmount) + "','" + std::to_string(data.ShortExchOffsetAmount) + "','" + (data.HedgeFlag == 0 ? '0' : data.HedgeFlag) + "','" + data.ExchangeID + "','" + data.InvestUnitID + "','" + data.ProductGroupID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcInvestorProductGroupMarginField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcQueryCFMMCTradingAccountTokenFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQueryCFMMCTradingAccountTokenField data;
CThostFtdcQueryCFMMCTradingAccountTokenFieldWrapper(const CThostFtdcQueryCFMMCTradingAccountTokenField& _data = { 0 }) :data(_data) { }
CThostFtdcQueryCFMMCTradingAccountTokenFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQueryCFMMCTradingAccountTokenField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.InvestUnitID, rowValue.at("InvestUnitID").c_str(), sizeof(TThostFtdcInvestUnitIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorID + "','" + data.InvestUnitID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcQueryCFMMCTradingAccountTokenField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcCFMMCTradingAccountTokenFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcCFMMCTradingAccountTokenField data;
CThostFtdcCFMMCTradingAccountTokenFieldWrapper(const CThostFtdcCFMMCTradingAccountTokenField& _data = { 0 }) :data(_data) { }
CThostFtdcCFMMCTradingAccountTokenFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcCFMMCTradingAccountTokenField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.ParticipantID, rowValue.at("ParticipantID").c_str(), sizeof(TThostFtdcParticipantIDType));
strncpy(data.AccountID, rowValue.at("AccountID").c_str(), sizeof(TThostFtdcAccountIDType));
data.KeyID = std::stoi(rowValue.at("KeyID"));
strncpy(data.Token, rowValue.at("Token").c_str(), sizeof(TThostFtdcCFMMCTokenType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.ParticipantID + "','" + data.AccountID + "','" + std::to_string(data.KeyID) + "','" + data.Token
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.AccountID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& AccountID) {
return "SELECT * FROM 'CThostFtdcCFMMCTradingAccountTokenField' where BrokerID='" + BrokerID + "' and AccountID='" + AccountID + "';";
}
};
struct CThostFtdcQryProductGroupFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryProductGroupField data;
CThostFtdcQryProductGroupFieldWrapper(const CThostFtdcQryProductGroupField& _data = { 0 }) :data(_data) { }
CThostFtdcQryProductGroupFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryProductGroupField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.ProductID, rowValue.at("ProductID").c_str(), sizeof(TThostFtdcInstrumentIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.reserve1 + "','" + data.ExchangeID + "','" + data.ProductID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcProductGroupFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcProductGroupField data;
CThostFtdcProductGroupFieldWrapper(const CThostFtdcProductGroupField& _data = { 0 }) :data(_data) { }
CThostFtdcProductGroupFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcProductGroupField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.reserve2, rowValue.at("reserve2").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
strncpy(data.ProductID, rowValue.at("ProductID").c_str(), sizeof(TThostFtdcInstrumentIDType));
strncpy(data.ProductGroupID, rowValue.at("ProductGroupID").c_str(), sizeof(TThostFtdcInstrumentIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.reserve1 + "','" + data.ExchangeID + "','" + data.reserve2 + "','" + data.ProductID + "','" + data.ProductGroupID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcBulletinFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcBulletinField data;
CThostFtdcBulletinFieldWrapper(const CThostFtdcBulletinField& _data = { 0 }) :data(_data) { }
CThostFtdcBulletinFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcBulletinField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcDateType));
data.BulletinID = std::stoi(rowValue.at("BulletinID"));
data.SequenceNo = std::stoi(rowValue.at("SequenceNo"));
strncpy(data.NewsType, rowValue.at("NewsType").c_str(), sizeof(TThostFtdcNewsTypeType));
data.NewsUrgency = rowValue.at("NewsUrgency").empty() ? '0' : rowValue.at("NewsUrgency")[0];
strncpy(data.SendTime, rowValue.at("SendTime").c_str(), sizeof(TThostFtdcTimeType));
strncpy(data.Abstract, rowValue.at("Abstract").c_str(), sizeof(TThostFtdcAbstractType));
strncpy(data.ComeFrom, rowValue.at("ComeFrom").c_str(), sizeof(TThostFtdcComeFromType));
strncpy(data.Content, rowValue.at("Content").c_str(), sizeof(TThostFtdcContentType));
strncpy(data.URLLink, rowValue.at("URLLink").c_str(), sizeof(TThostFtdcURLLinkType));
strncpy(data.MarketID, rowValue.at("MarketID").c_str(), sizeof(TThostFtdcMarketIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.ExchangeID + "','" + data.TradingDay + "','" + std::to_string(data.BulletinID) + "','" + std::to_string(data.SequenceNo) + "','" + data.NewsType + "','" + (data.NewsUrgency == 0 ? '0' : data.NewsUrgency) + "','" + data.SendTime + "','" + data.Abstract + "','" + data.ComeFrom + "','" + data.Content + "','" + data.URLLink + "','" + data.MarketID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcQryBulletinFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryBulletinField data;
CThostFtdcQryBulletinFieldWrapper(const CThostFtdcQryBulletinField& _data = { 0 }) :data(_data) { }
CThostFtdcQryBulletinFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryBulletinField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
data.BulletinID = std::stoi(rowValue.at("BulletinID"));
data.SequenceNo = std::stoi(rowValue.at("SequenceNo"));
strncpy(data.NewsType, rowValue.at("NewsType").c_str(), sizeof(TThostFtdcNewsTypeType));
data.NewsUrgency = rowValue.at("NewsUrgency").empty() ? '0' : rowValue.at("NewsUrgency")[0];
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.ExchangeID + "','" + std::to_string(data.BulletinID) + "','" + std::to_string(data.SequenceNo) + "','" + data.NewsType + "','" + (data.NewsUrgency == 0 ? '0' : data.NewsUrgency)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcMulticastInstrumentFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcMulticastInstrumentField data;
CThostFtdcMulticastInstrumentFieldWrapper(const CThostFtdcMulticastInstrumentField& _data = { 0 }) :data(_data) { }
CThostFtdcMulticastInstrumentFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcMulticastInstrumentField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
data.TopicID = std::stoi(rowValue.at("TopicID"));
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
data.InstrumentNo = std::stoi(rowValue.at("InstrumentNo"));
data.CodePrice = std::stod(rowValue.at("CodePrice"));
data.VolumeMultiple = std::stoi(rowValue.at("VolumeMultiple"));
data.PriceTick = std::stod(rowValue.at("PriceTick"));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
std::to_string(data.TopicID) + "','" + data.reserve1 + "','" + std::to_string(data.InstrumentNo) + "','" + std::to_string(data.CodePrice) + "','" + std::to_string(data.VolumeMultiple) + "','" + std::to_string(data.PriceTick) + "','" + data.InstrumentID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcQryMulticastInstrumentFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryMulticastInstrumentField data;
CThostFtdcQryMulticastInstrumentFieldWrapper(const CThostFtdcQryMulticastInstrumentField& _data = { 0 }) :data(_data) { }
CThostFtdcQryMulticastInstrumentFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryMulticastInstrumentField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
data.TopicID = std::stoi(rowValue.at("TopicID"));
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldInstrumentIDType));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
std::to_string(data.TopicID) + "','" + data.reserve1 + "','" + data.InstrumentID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcAppIDAuthAssignFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcAppIDAuthAssignField data;
CThostFtdcAppIDAuthAssignFieldWrapper(const CThostFtdcAppIDAuthAssignField& _data = { 0 }) :data(_data) { }
CThostFtdcAppIDAuthAssignFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcAppIDAuthAssignField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.AppID, rowValue.at("AppID").c_str(), sizeof(TThostFtdcAppIDType));
data.DRIdentityID = std::stoi(rowValue.at("DRIdentityID"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.AppID + "','" + std::to_string(data.DRIdentityID)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcReqOpenAccountFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcReqOpenAccountField data;
CThostFtdcReqOpenAccountFieldWrapper(const CThostFtdcReqOpenAccountField& _data = { 0 }) :data(_data) { }
CThostFtdcReqOpenAccountFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcReqOpenAccountField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.TradeCode, rowValue.at("TradeCode").c_str(), sizeof(TThostFtdcTradeCodeType));
strncpy(data.BankID, rowValue.at("BankID").c_str(), sizeof(TThostFtdcBankIDType));
strncpy(data.BankBranchID, rowValue.at("BankBranchID").c_str(), sizeof(TThostFtdcBankBrchIDType));
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.BrokerBranchID, rowValue.at("BrokerBranchID").c_str(), sizeof(TThostFtdcFutureBranchIDType));
strncpy(data.TradeDate, rowValue.at("TradeDate").c_str(), sizeof(TThostFtdcTradeDateType));
strncpy(data.TradeTime, rowValue.at("TradeTime").c_str(), sizeof(TThostFtdcTradeTimeType));
strncpy(data.BankSerial, rowValue.at("BankSerial").c_str(), sizeof(TThostFtdcBankSerialType));
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcTradeDateType));
data.PlateSerial = std::stoi(rowValue.at("PlateSerial"));
data.LastFragment = rowValue.at("LastFragment").empty() ? '0' : rowValue.at("LastFragment")[0];
data.SessionID = std::stoi(rowValue.at("SessionID"));
strncpy(data.CustomerName, rowValue.at("CustomerName").c_str(), sizeof(TThostFtdcIndividualNameType));
data.IdCardType = rowValue.at("IdCardType").empty() ? '0' : rowValue.at("IdCardType")[0];
strncpy(data.IdentifiedCardNo, rowValue.at("IdentifiedCardNo").c_str(), sizeof(TThostFtdcIdentifiedCardNoType));
data.Gender = rowValue.at("Gender").empty() ? '0' : rowValue.at("Gender")[0];
strncpy(data.CountryCode, rowValue.at("CountryCode").c_str(), sizeof(TThostFtdcCountryCodeType));
data.CustType = rowValue.at("CustType").empty() ? '0' : rowValue.at("CustType")[0];
strncpy(data.Address, rowValue.at("Address").c_str(), sizeof(TThostFtdcAddressType));
strncpy(data.ZipCode, rowValue.at("ZipCode").c_str(), sizeof(TThostFtdcZipCodeType));
strncpy(data.Telephone, rowValue.at("Telephone").c_str(), sizeof(TThostFtdcTelephoneType));
strncpy(data.MobilePhone, rowValue.at("MobilePhone").c_str(), sizeof(TThostFtdcMobilePhoneType));
strncpy(data.Fax, rowValue.at("Fax").c_str(), sizeof(TThostFtdcFaxType));
strncpy(data.EMail, rowValue.at("EMail").c_str(), sizeof(TThostFtdcEMailType));
data.MoneyAccountStatus = rowValue.at("MoneyAccountStatus").empty() ? '0' : rowValue.at("MoneyAccountStatus")[0];
strncpy(data.BankAccount, rowValue.at("BankAccount").c_str(), sizeof(TThostFtdcBankAccountType));
strncpy(data.BankPassWord, rowValue.at("BankPassWord").c_str(), sizeof(TThostFtdcPasswordType));
strncpy(data.AccountID, rowValue.at("AccountID").c_str(), sizeof(TThostFtdcAccountIDType));
strncpy(data.Password, rowValue.at("Password").c_str(), sizeof(TThostFtdcPasswordType));
data.InstallID = std::stoi(rowValue.at("InstallID"));
data.VerifyCertNoFlag = rowValue.at("VerifyCertNoFlag").empty() ? '0' : rowValue.at("VerifyCertNoFlag")[0];
strncpy(data.CurrencyID, rowValue.at("CurrencyID").c_str(), sizeof(TThostFtdcCurrencyIDType));
data.CashExchangeCode = rowValue.at("CashExchangeCode").empty() ? '0' : rowValue.at("CashExchangeCode")[0];
strncpy(data.Digest, rowValue.at("Digest").c_str(), sizeof(TThostFtdcDigestType));
data.BankAccType = rowValue.at("BankAccType").empty() ? '0' : rowValue.at("BankAccType")[0];
strncpy(data.DeviceID, rowValue.at("DeviceID").c_str(), sizeof(TThostFtdcDeviceIDType));
data.BankSecuAccType = rowValue.at("BankSecuAccType").empty() ? '0' : rowValue.at("BankSecuAccType")[0];
strncpy(data.BrokerIDByBank, rowValue.at("BrokerIDByBank").c_str(), sizeof(TThostFtdcBankCodingForFutureType));
strncpy(data.BankSecuAcc, rowValue.at("BankSecuAcc").c_str(), sizeof(TThostFtdcBankAccountType));
data.BankPwdFlag = rowValue.at("BankPwdFlag").empty() ? '0' : rowValue.at("BankPwdFlag")[0];
data.SecuPwdFlag = rowValue.at("SecuPwdFlag").empty() ? '0' : rowValue.at("SecuPwdFlag")[0];
strncpy(data.OperNo, rowValue.at("OperNo").c_str(), sizeof(TThostFtdcOperNoType));
data.TID = std::stoi(rowValue.at("TID"));
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
strncpy(data.LongCustomerName, rowValue.at("LongCustomerName").c_str(), sizeof(TThostFtdcLongIndividualNameType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.TradeCode + "','" + data.BankID + "','" + data.BankBranchID + "','" + data.BrokerID + "','" + data.BrokerBranchID + "','" + data.TradeDate + "','" + data.TradeTime + "','" + data.BankSerial + "','" + data.TradingDay + "','" + std::to_string(data.PlateSerial) + "','" + (data.LastFragment == 0 ? '0' : data.LastFragment) + "','" + std::to_string(data.SessionID) + "','" + data.CustomerName + "','" + (data.IdCardType == 0 ? '0' : data.IdCardType) + "','" + data.IdentifiedCardNo + "','" + (data.Gender == 0 ? '0' : data.Gender) + "','" + data.CountryCode + "','" + (data.CustType == 0 ? '0' : data.CustType) + "','" + data.Address + "','" + data.ZipCode + "','" + data.Telephone + "','" + data.MobilePhone + "','" + data.Fax + "','" + data.EMail + "','" + (data.MoneyAccountStatus == 0 ? '0' : data.MoneyAccountStatus) + "','" + data.BankAccount + "','" + data.BankPassWord + "','" + data.AccountID + "','" + data.Password + "','" + std::to_string(data.InstallID) + "','" + (data.VerifyCertNoFlag == 0 ? '0' : data.VerifyCertNoFlag) + "','" + data.CurrencyID + "','" + (data.CashExchangeCode == 0 ? '0' : data.CashExchangeCode) + "','" + data.Digest + "','" + (data.BankAccType == 0 ? '0' : data.BankAccType) + "','" + data.DeviceID + "','" + (data.BankSecuAccType == 0 ? '0' : data.BankSecuAccType) + "','" + data.BrokerIDByBank + "','" + data.BankSecuAcc + "','" + (data.BankPwdFlag == 0 ? '0' : data.BankPwdFlag) + "','" + (data.SecuPwdFlag == 0 ? '0' : data.SecuPwdFlag) + "','" + data.OperNo + "','" + std::to_string(data.TID) + "','" + data.UserID + "','" + data.LongCustomerName
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.AccountID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& AccountID) {
return "SELECT * FROM 'CThostFtdcReqOpenAccountField' where BrokerID='" + BrokerID + "' and AccountID='" + AccountID + "';";
}
};
struct CThostFtdcReqCancelAccountFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcReqCancelAccountField data;
CThostFtdcReqCancelAccountFieldWrapper(const CThostFtdcReqCancelAccountField& _data = { 0 }) :data(_data) { }
CThostFtdcReqCancelAccountFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcReqCancelAccountField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.TradeCode, rowValue.at("TradeCode").c_str(), sizeof(TThostFtdcTradeCodeType));
strncpy(data.BankID, rowValue.at("BankID").c_str(), sizeof(TThostFtdcBankIDType));
strncpy(data.BankBranchID, rowValue.at("BankBranchID").c_str(), sizeof(TThostFtdcBankBrchIDType));
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.BrokerBranchID, rowValue.at("BrokerBranchID").c_str(), sizeof(TThostFtdcFutureBranchIDType));
strncpy(data.TradeDate, rowValue.at("TradeDate").c_str(), sizeof(TThostFtdcTradeDateType));
strncpy(data.TradeTime, rowValue.at("TradeTime").c_str(), sizeof(TThostFtdcTradeTimeType));
strncpy(data.BankSerial, rowValue.at("BankSerial").c_str(), sizeof(TThostFtdcBankSerialType));
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcTradeDateType));
data.PlateSerial = std::stoi(rowValue.at("PlateSerial"));
data.LastFragment = rowValue.at("LastFragment").empty() ? '0' : rowValue.at("LastFragment")[0];
data.SessionID = std::stoi(rowValue.at("SessionID"));
strncpy(data.CustomerName, rowValue.at("CustomerName").c_str(), sizeof(TThostFtdcIndividualNameType));
data.IdCardType = rowValue.at("IdCardType").empty() ? '0' : rowValue.at("IdCardType")[0];
strncpy(data.IdentifiedCardNo, rowValue.at("IdentifiedCardNo").c_str(), sizeof(TThostFtdcIdentifiedCardNoType));
data.Gender = rowValue.at("Gender").empty() ? '0' : rowValue.at("Gender")[0];
strncpy(data.CountryCode, rowValue.at("CountryCode").c_str(), sizeof(TThostFtdcCountryCodeType));
data.CustType = rowValue.at("CustType").empty() ? '0' : rowValue.at("CustType")[0];
strncpy(data.Address, rowValue.at("Address").c_str(), sizeof(TThostFtdcAddressType));
strncpy(data.ZipCode, rowValue.at("ZipCode").c_str(), sizeof(TThostFtdcZipCodeType));
strncpy(data.Telephone, rowValue.at("Telephone").c_str(), sizeof(TThostFtdcTelephoneType));
strncpy(data.MobilePhone, rowValue.at("MobilePhone").c_str(), sizeof(TThostFtdcMobilePhoneType));
strncpy(data.Fax, rowValue.at("Fax").c_str(), sizeof(TThostFtdcFaxType));
strncpy(data.EMail, rowValue.at("EMail").c_str(), sizeof(TThostFtdcEMailType));
data.MoneyAccountStatus = rowValue.at("MoneyAccountStatus").empty() ? '0' : rowValue.at("MoneyAccountStatus")[0];
strncpy(data.BankAccount, rowValue.at("BankAccount").c_str(), sizeof(TThostFtdcBankAccountType));
strncpy(data.BankPassWord, rowValue.at("BankPassWord").c_str(), sizeof(TThostFtdcPasswordType));
strncpy(data.AccountID, rowValue.at("AccountID").c_str(), sizeof(TThostFtdcAccountIDType));
strncpy(data.Password, rowValue.at("Password").c_str(), sizeof(TThostFtdcPasswordType));
data.InstallID = std::stoi(rowValue.at("InstallID"));
data.VerifyCertNoFlag = rowValue.at("VerifyCertNoFlag").empty() ? '0' : rowValue.at("VerifyCertNoFlag")[0];
strncpy(data.CurrencyID, rowValue.at("CurrencyID").c_str(), sizeof(TThostFtdcCurrencyIDType));
data.CashExchangeCode = rowValue.at("CashExchangeCode").empty() ? '0' : rowValue.at("CashExchangeCode")[0];
strncpy(data.Digest, rowValue.at("Digest").c_str(), sizeof(TThostFtdcDigestType));
data.BankAccType = rowValue.at("BankAccType").empty() ? '0' : rowValue.at("BankAccType")[0];
strncpy(data.DeviceID, rowValue.at("DeviceID").c_str(), sizeof(TThostFtdcDeviceIDType));
data.BankSecuAccType = rowValue.at("BankSecuAccType").empty() ? '0' : rowValue.at("BankSecuAccType")[0];
strncpy(data.BrokerIDByBank, rowValue.at("BrokerIDByBank").c_str(), sizeof(TThostFtdcBankCodingForFutureType));
strncpy(data.BankSecuAcc, rowValue.at("BankSecuAcc").c_str(), sizeof(TThostFtdcBankAccountType));
data.BankPwdFlag = rowValue.at("BankPwdFlag").empty() ? '0' : rowValue.at("BankPwdFlag")[0];
data.SecuPwdFlag = rowValue.at("SecuPwdFlag").empty() ? '0' : rowValue.at("SecuPwdFlag")[0];
strncpy(data.OperNo, rowValue.at("OperNo").c_str(), sizeof(TThostFtdcOperNoType));
data.TID = std::stoi(rowValue.at("TID"));
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
strncpy(data.LongCustomerName, rowValue.at("LongCustomerName").c_str(), sizeof(TThostFtdcLongIndividualNameType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.TradeCode + "','" + data.BankID + "','" + data.BankBranchID + "','" + data.BrokerID + "','" + data.BrokerBranchID + "','" + data.TradeDate + "','" + data.TradeTime + "','" + data.BankSerial + "','" + data.TradingDay + "','" + std::to_string(data.PlateSerial) + "','" + (data.LastFragment == 0 ? '0' : data.LastFragment) + "','" + std::to_string(data.SessionID) + "','" + data.CustomerName + "','" + (data.IdCardType == 0 ? '0' : data.IdCardType) + "','" + data.IdentifiedCardNo + "','" + (data.Gender == 0 ? '0' : data.Gender) + "','" + data.CountryCode + "','" + (data.CustType == 0 ? '0' : data.CustType) + "','" + data.Address + "','" + data.ZipCode + "','" + data.Telephone + "','" + data.MobilePhone + "','" + data.Fax + "','" + data.EMail + "','" + (data.MoneyAccountStatus == 0 ? '0' : data.MoneyAccountStatus) + "','" + data.BankAccount + "','" + data.BankPassWord + "','" + data.AccountID + "','" + data.Password + "','" + std::to_string(data.InstallID) + "','" + (data.VerifyCertNoFlag == 0 ? '0' : data.VerifyCertNoFlag) + "','" + data.CurrencyID + "','" + (data.CashExchangeCode == 0 ? '0' : data.CashExchangeCode) + "','" + data.Digest + "','" + (data.BankAccType == 0 ? '0' : data.BankAccType) + "','" + data.DeviceID + "','" + (data.BankSecuAccType == 0 ? '0' : data.BankSecuAccType) + "','" + data.BrokerIDByBank + "','" + data.BankSecuAcc + "','" + (data.BankPwdFlag == 0 ? '0' : data.BankPwdFlag) + "','" + (data.SecuPwdFlag == 0 ? '0' : data.SecuPwdFlag) + "','" + data.OperNo + "','" + std::to_string(data.TID) + "','" + data.UserID + "','" + data.LongCustomerName
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.AccountID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& AccountID) {
return "SELECT * FROM 'CThostFtdcReqCancelAccountField' where BrokerID='" + BrokerID + "' and AccountID='" + AccountID + "';";
}
};
struct CThostFtdcReqChangeAccountFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcReqChangeAccountField data;
CThostFtdcReqChangeAccountFieldWrapper(const CThostFtdcReqChangeAccountField& _data = { 0 }) :data(_data) { }
CThostFtdcReqChangeAccountFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcReqChangeAccountField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.TradeCode, rowValue.at("TradeCode").c_str(), sizeof(TThostFtdcTradeCodeType));
strncpy(data.BankID, rowValue.at("BankID").c_str(), sizeof(TThostFtdcBankIDType));
strncpy(data.BankBranchID, rowValue.at("BankBranchID").c_str(), sizeof(TThostFtdcBankBrchIDType));
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.BrokerBranchID, rowValue.at("BrokerBranchID").c_str(), sizeof(TThostFtdcFutureBranchIDType));
strncpy(data.TradeDate, rowValue.at("TradeDate").c_str(), sizeof(TThostFtdcTradeDateType));
strncpy(data.TradeTime, rowValue.at("TradeTime").c_str(), sizeof(TThostFtdcTradeTimeType));
strncpy(data.BankSerial, rowValue.at("BankSerial").c_str(), sizeof(TThostFtdcBankSerialType));
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcTradeDateType));
data.PlateSerial = std::stoi(rowValue.at("PlateSerial"));
data.LastFragment = rowValue.at("LastFragment").empty() ? '0' : rowValue.at("LastFragment")[0];
data.SessionID = std::stoi(rowValue.at("SessionID"));
strncpy(data.CustomerName, rowValue.at("CustomerName").c_str(), sizeof(TThostFtdcIndividualNameType));
data.IdCardType = rowValue.at("IdCardType").empty() ? '0' : rowValue.at("IdCardType")[0];
strncpy(data.IdentifiedCardNo, rowValue.at("IdentifiedCardNo").c_str(), sizeof(TThostFtdcIdentifiedCardNoType));
data.Gender = rowValue.at("Gender").empty() ? '0' : rowValue.at("Gender")[0];
strncpy(data.CountryCode, rowValue.at("CountryCode").c_str(), sizeof(TThostFtdcCountryCodeType));
data.CustType = rowValue.at("CustType").empty() ? '0' : rowValue.at("CustType")[0];
strncpy(data.Address, rowValue.at("Address").c_str(), sizeof(TThostFtdcAddressType));
strncpy(data.ZipCode, rowValue.at("ZipCode").c_str(), sizeof(TThostFtdcZipCodeType));
strncpy(data.Telephone, rowValue.at("Telephone").c_str(), sizeof(TThostFtdcTelephoneType));
strncpy(data.MobilePhone, rowValue.at("MobilePhone").c_str(), sizeof(TThostFtdcMobilePhoneType));
strncpy(data.Fax, rowValue.at("Fax").c_str(), sizeof(TThostFtdcFaxType));
strncpy(data.EMail, rowValue.at("EMail").c_str(), sizeof(TThostFtdcEMailType));
data.MoneyAccountStatus = rowValue.at("MoneyAccountStatus").empty() ? '0' : rowValue.at("MoneyAccountStatus")[0];
strncpy(data.BankAccount, rowValue.at("BankAccount").c_str(), sizeof(TThostFtdcBankAccountType));
strncpy(data.BankPassWord, rowValue.at("BankPassWord").c_str(), sizeof(TThostFtdcPasswordType));
strncpy(data.NewBankAccount, rowValue.at("NewBankAccount").c_str(), sizeof(TThostFtdcBankAccountType));
strncpy(data.NewBankPassWord, rowValue.at("NewBankPassWord").c_str(), sizeof(TThostFtdcPasswordType));
strncpy(data.AccountID, rowValue.at("AccountID").c_str(), sizeof(TThostFtdcAccountIDType));
strncpy(data.Password, rowValue.at("Password").c_str(), sizeof(TThostFtdcPasswordType));
data.BankAccType = rowValue.at("BankAccType").empty() ? '0' : rowValue.at("BankAccType")[0];
data.InstallID = std::stoi(rowValue.at("InstallID"));
data.VerifyCertNoFlag = rowValue.at("VerifyCertNoFlag").empty() ? '0' : rowValue.at("VerifyCertNoFlag")[0];
strncpy(data.CurrencyID, rowValue.at("CurrencyID").c_str(), sizeof(TThostFtdcCurrencyIDType));
strncpy(data.BrokerIDByBank, rowValue.at("BrokerIDByBank").c_str(), sizeof(TThostFtdcBankCodingForFutureType));
data.BankPwdFlag = rowValue.at("BankPwdFlag").empty() ? '0' : rowValue.at("BankPwdFlag")[0];
data.SecuPwdFlag = rowValue.at("SecuPwdFlag").empty() ? '0' : rowValue.at("SecuPwdFlag")[0];
data.TID = std::stoi(rowValue.at("TID"));
strncpy(data.Digest, rowValue.at("Digest").c_str(), sizeof(TThostFtdcDigestType));
strncpy(data.LongCustomerName, rowValue.at("LongCustomerName").c_str(), sizeof(TThostFtdcLongIndividualNameType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.TradeCode + "','" + data.BankID + "','" + data.BankBranchID + "','" + data.BrokerID + "','" + data.BrokerBranchID + "','" + data.TradeDate + "','" + data.TradeTime + "','" + data.BankSerial + "','" + data.TradingDay + "','" + std::to_string(data.PlateSerial) + "','" + (data.LastFragment == 0 ? '0' : data.LastFragment) + "','" + std::to_string(data.SessionID) + "','" + data.CustomerName + "','" + (data.IdCardType == 0 ? '0' : data.IdCardType) + "','" + data.IdentifiedCardNo + "','" + (data.Gender == 0 ? '0' : data.Gender) + "','" + data.CountryCode + "','" + (data.CustType == 0 ? '0' : data.CustType) + "','" + data.Address + "','" + data.ZipCode + "','" + data.Telephone + "','" + data.MobilePhone + "','" + data.Fax + "','" + data.EMail + "','" + (data.MoneyAccountStatus == 0 ? '0' : data.MoneyAccountStatus) + "','" + data.BankAccount + "','" + data.BankPassWord + "','" + data.NewBankAccount + "','" + data.NewBankPassWord + "','" + data.AccountID + "','" + data.Password + "','" + (data.BankAccType == 0 ? '0' : data.BankAccType) + "','" + std::to_string(data.InstallID) + "','" + (data.VerifyCertNoFlag == 0 ? '0' : data.VerifyCertNoFlag) + "','" + data.CurrencyID + "','" + data.BrokerIDByBank + "','" + (data.BankPwdFlag == 0 ? '0' : data.BankPwdFlag) + "','" + (data.SecuPwdFlag == 0 ? '0' : data.SecuPwdFlag) + "','" + std::to_string(data.TID) + "','" + data.Digest + "','" + data.LongCustomerName
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.AccountID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& AccountID) {
return "SELECT * FROM 'CThostFtdcReqChangeAccountField' where BrokerID='" + BrokerID + "' and AccountID='" + AccountID + "';";
}
};
struct CThostFtdcReqTransferFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcReqTransferField data;
CThostFtdcReqTransferFieldWrapper(const CThostFtdcReqTransferField& _data = { 0 }) :data(_data) { }
CThostFtdcReqTransferFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcReqTransferField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.TradeCode, rowValue.at("TradeCode").c_str(), sizeof(TThostFtdcTradeCodeType));
strncpy(data.BankID, rowValue.at("BankID").c_str(), sizeof(TThostFtdcBankIDType));
strncpy(data.BankBranchID, rowValue.at("BankBranchID").c_str(), sizeof(TThostFtdcBankBrchIDType));
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.BrokerBranchID, rowValue.at("BrokerBranchID").c_str(), sizeof(TThostFtdcFutureBranchIDType));
strncpy(data.TradeDate, rowValue.at("TradeDate").c_str(), sizeof(TThostFtdcTradeDateType));
strncpy(data.TradeTime, rowValue.at("TradeTime").c_str(), sizeof(TThostFtdcTradeTimeType));
strncpy(data.BankSerial, rowValue.at("BankSerial").c_str(), sizeof(TThostFtdcBankSerialType));
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcTradeDateType));
data.PlateSerial = std::stoi(rowValue.at("PlateSerial"));
data.LastFragment = rowValue.at("LastFragment").empty() ? '0' : rowValue.at("LastFragment")[0];
data.SessionID = std::stoi(rowValue.at("SessionID"));
strncpy(data.CustomerName, rowValue.at("CustomerName").c_str(), sizeof(TThostFtdcIndividualNameType));
data.IdCardType = rowValue.at("IdCardType").empty() ? '0' : rowValue.at("IdCardType")[0];
strncpy(data.IdentifiedCardNo, rowValue.at("IdentifiedCardNo").c_str(), sizeof(TThostFtdcIdentifiedCardNoType));
data.CustType = rowValue.at("CustType").empty() ? '0' : rowValue.at("CustType")[0];
strncpy(data.BankAccount, rowValue.at("BankAccount").c_str(), sizeof(TThostFtdcBankAccountType));
strncpy(data.BankPassWord, rowValue.at("BankPassWord").c_str(), sizeof(TThostFtdcPasswordType));
strncpy(data.AccountID, rowValue.at("AccountID").c_str(), sizeof(TThostFtdcAccountIDType));
strncpy(data.Password, rowValue.at("Password").c_str(), sizeof(TThostFtdcPasswordType));
data.InstallID = std::stoi(rowValue.at("InstallID"));
data.FutureSerial = std::stoi(rowValue.at("FutureSerial"));
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
data.VerifyCertNoFlag = rowValue.at("VerifyCertNoFlag").empty() ? '0' : rowValue.at("VerifyCertNoFlag")[0];
strncpy(data.CurrencyID, rowValue.at("CurrencyID").c_str(), sizeof(TThostFtdcCurrencyIDType));
data.TradeAmount = std::stod(rowValue.at("TradeAmount"));
data.FutureFetchAmount = std::stod(rowValue.at("FutureFetchAmount"));
data.FeePayFlag = rowValue.at("FeePayFlag").empty() ? '0' : rowValue.at("FeePayFlag")[0];
data.CustFee = std::stod(rowValue.at("CustFee"));
data.BrokerFee = std::stod(rowValue.at("BrokerFee"));
strncpy(data.Message, rowValue.at("Message").c_str(), sizeof(TThostFtdcAddInfoType));
strncpy(data.Digest, rowValue.at("Digest").c_str(), sizeof(TThostFtdcDigestType));
data.BankAccType = rowValue.at("BankAccType").empty() ? '0' : rowValue.at("BankAccType")[0];
strncpy(data.DeviceID, rowValue.at("DeviceID").c_str(), sizeof(TThostFtdcDeviceIDType));
data.BankSecuAccType = rowValue.at("BankSecuAccType").empty() ? '0' : rowValue.at("BankSecuAccType")[0];
strncpy(data.BrokerIDByBank, rowValue.at("BrokerIDByBank").c_str(), sizeof(TThostFtdcBankCodingForFutureType));
strncpy(data.BankSecuAcc, rowValue.at("BankSecuAcc").c_str(), sizeof(TThostFtdcBankAccountType));
data.BankPwdFlag = rowValue.at("BankPwdFlag").empty() ? '0' : rowValue.at("BankPwdFlag")[0];
data.SecuPwdFlag = rowValue.at("SecuPwdFlag").empty() ? '0' : rowValue.at("SecuPwdFlag")[0];
strncpy(data.OperNo, rowValue.at("OperNo").c_str(), sizeof(TThostFtdcOperNoType));
data.RequestID = std::stoi(rowValue.at("RequestID"));
data.TID = std::stoi(rowValue.at("TID"));
data.TransferStatus = rowValue.at("TransferStatus").empty() ? '0' : rowValue.at("TransferStatus")[0];
strncpy(data.LongCustomerName, rowValue.at("LongCustomerName").c_str(), sizeof(TThostFtdcLongIndividualNameType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.TradeCode + "','" + data.BankID + "','" + data.BankBranchID + "','" + data.BrokerID + "','" + data.BrokerBranchID + "','" + data.TradeDate + "','" + data.TradeTime + "','" + data.BankSerial + "','" + data.TradingDay + "','" + std::to_string(data.PlateSerial) + "','" + (data.LastFragment == 0 ? '0' : data.LastFragment) + "','" + std::to_string(data.SessionID) + "','" + data.CustomerName + "','" + (data.IdCardType == 0 ? '0' : data.IdCardType) + "','" + data.IdentifiedCardNo + "','" + (data.CustType == 0 ? '0' : data.CustType) + "','" + data.BankAccount + "','" + data.BankPassWord + "','" + data.AccountID + "','" + data.Password + "','" + std::to_string(data.InstallID) + "','" + std::to_string(data.FutureSerial) + "','" + data.UserID + "','" + (data.VerifyCertNoFlag == 0 ? '0' : data.VerifyCertNoFlag) + "','" + data.CurrencyID + "','" + std::to_string(data.TradeAmount) + "','" + std::to_string(data.FutureFetchAmount) + "','" + (data.FeePayFlag == 0 ? '0' : data.FeePayFlag) + "','" + std::to_string(data.CustFee) + "','" + std::to_string(data.BrokerFee) + "','" + data.Message + "','" + data.Digest + "','" + (data.BankAccType == 0 ? '0' : data.BankAccType) + "','" + data.DeviceID + "','" + (data.BankSecuAccType == 0 ? '0' : data.BankSecuAccType) + "','" + data.BrokerIDByBank + "','" + data.BankSecuAcc + "','" + (data.BankPwdFlag == 0 ? '0' : data.BankPwdFlag) + "','" + (data.SecuPwdFlag == 0 ? '0' : data.SecuPwdFlag) + "','" + data.OperNo + "','" + std::to_string(data.RequestID) + "','" + std::to_string(data.TID) + "','" + (data.TransferStatus == 0 ? '0' : data.TransferStatus) + "','" + data.LongCustomerName
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.AccountID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& AccountID) {
return "SELECT * FROM 'CThostFtdcReqTransferField' where BrokerID='" + BrokerID + "' and AccountID='" + AccountID + "';";
}
};
struct CThostFtdcRspTransferFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcRspTransferField data;
CThostFtdcRspTransferFieldWrapper(const CThostFtdcRspTransferField& _data = { 0 }) :data(_data) { }
CThostFtdcRspTransferFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcRspTransferField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.TradeCode, rowValue.at("TradeCode").c_str(), sizeof(TThostFtdcTradeCodeType));
strncpy(data.BankID, rowValue.at("BankID").c_str(), sizeof(TThostFtdcBankIDType));
strncpy(data.BankBranchID, rowValue.at("BankBranchID").c_str(), sizeof(TThostFtdcBankBrchIDType));
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.BrokerBranchID, rowValue.at("BrokerBranchID").c_str(), sizeof(TThostFtdcFutureBranchIDType));
strncpy(data.TradeDate, rowValue.at("TradeDate").c_str(), sizeof(TThostFtdcTradeDateType));
strncpy(data.TradeTime, rowValue.at("TradeTime").c_str(), sizeof(TThostFtdcTradeTimeType));
strncpy(data.BankSerial, rowValue.at("BankSerial").c_str(), sizeof(TThostFtdcBankSerialType));
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcTradeDateType));
data.PlateSerial = std::stoi(rowValue.at("PlateSerial"));
data.LastFragment = rowValue.at("LastFragment").empty() ? '0' : rowValue.at("LastFragment")[0];
data.SessionID = std::stoi(rowValue.at("SessionID"));
strncpy(data.CustomerName, rowValue.at("CustomerName").c_str(), sizeof(TThostFtdcIndividualNameType));
data.IdCardType = rowValue.at("IdCardType").empty() ? '0' : rowValue.at("IdCardType")[0];
strncpy(data.IdentifiedCardNo, rowValue.at("IdentifiedCardNo").c_str(), sizeof(TThostFtdcIdentifiedCardNoType));
data.CustType = rowValue.at("CustType").empty() ? '0' : rowValue.at("CustType")[0];
strncpy(data.BankAccount, rowValue.at("BankAccount").c_str(), sizeof(TThostFtdcBankAccountType));
strncpy(data.BankPassWord, rowValue.at("BankPassWord").c_str(), sizeof(TThostFtdcPasswordType));
strncpy(data.AccountID, rowValue.at("AccountID").c_str(), sizeof(TThostFtdcAccountIDType));
strncpy(data.Password, rowValue.at("Password").c_str(), sizeof(TThostFtdcPasswordType));
data.InstallID = std::stoi(rowValue.at("InstallID"));
data.FutureSerial = std::stoi(rowValue.at("FutureSerial"));
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
data.VerifyCertNoFlag = rowValue.at("VerifyCertNoFlag").empty() ? '0' : rowValue.at("VerifyCertNoFlag")[0];
strncpy(data.CurrencyID, rowValue.at("CurrencyID").c_str(), sizeof(TThostFtdcCurrencyIDType));
data.TradeAmount = std::stod(rowValue.at("TradeAmount"));
data.FutureFetchAmount = std::stod(rowValue.at("FutureFetchAmount"));
data.FeePayFlag = rowValue.at("FeePayFlag").empty() ? '0' : rowValue.at("FeePayFlag")[0];
data.CustFee = std::stod(rowValue.at("CustFee"));
data.BrokerFee = std::stod(rowValue.at("BrokerFee"));
strncpy(data.Message, rowValue.at("Message").c_str(), sizeof(TThostFtdcAddInfoType));
strncpy(data.Digest, rowValue.at("Digest").c_str(), sizeof(TThostFtdcDigestType));
data.BankAccType = rowValue.at("BankAccType").empty() ? '0' : rowValue.at("BankAccType")[0];
strncpy(data.DeviceID, rowValue.at("DeviceID").c_str(), sizeof(TThostFtdcDeviceIDType));
data.BankSecuAccType = rowValue.at("BankSecuAccType").empty() ? '0' : rowValue.at("BankSecuAccType")[0];
strncpy(data.BrokerIDByBank, rowValue.at("BrokerIDByBank").c_str(), sizeof(TThostFtdcBankCodingForFutureType));
strncpy(data.BankSecuAcc, rowValue.at("BankSecuAcc").c_str(), sizeof(TThostFtdcBankAccountType));
data.BankPwdFlag = rowValue.at("BankPwdFlag").empty() ? '0' : rowValue.at("BankPwdFlag")[0];
data.SecuPwdFlag = rowValue.at("SecuPwdFlag").empty() ? '0' : rowValue.at("SecuPwdFlag")[0];
strncpy(data.OperNo, rowValue.at("OperNo").c_str(), sizeof(TThostFtdcOperNoType));
data.RequestID = std::stoi(rowValue.at("RequestID"));
data.TID = std::stoi(rowValue.at("TID"));
data.TransferStatus = rowValue.at("TransferStatus").empty() ? '0' : rowValue.at("TransferStatus")[0];
data.ErrorID = std::stoi(rowValue.at("ErrorID"));
strncpy(data.ErrorMsg, utf8_to_gbk(rowValue.at("ErrorMsg")).c_str(), sizeof(TThostFtdcErrorMsgType));
strncpy(data.LongCustomerName, rowValue.at("LongCustomerName").c_str(), sizeof(TThostFtdcLongIndividualNameType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.TradeCode + "','" + data.BankID + "','" + data.BankBranchID + "','" + data.BrokerID + "','" + data.BrokerBranchID + "','" + data.TradeDate + "','" + data.TradeTime + "','" + data.BankSerial + "','" + data.TradingDay + "','" + std::to_string(data.PlateSerial) + "','" + (data.LastFragment == 0 ? '0' : data.LastFragment) + "','" + std::to_string(data.SessionID) + "','" + data.CustomerName + "','" + (data.IdCardType == 0 ? '0' : data.IdCardType) + "','" + data.IdentifiedCardNo + "','" + (data.CustType == 0 ? '0' : data.CustType) + "','" + data.BankAccount + "','" + data.BankPassWord + "','" + data.AccountID + "','" + data.Password + "','" + std::to_string(data.InstallID) + "','" + std::to_string(data.FutureSerial) + "','" + data.UserID + "','" + (data.VerifyCertNoFlag == 0 ? '0' : data.VerifyCertNoFlag) + "','" + data.CurrencyID + "','" + std::to_string(data.TradeAmount) + "','" + std::to_string(data.FutureFetchAmount) + "','" + (data.FeePayFlag == 0 ? '0' : data.FeePayFlag) + "','" + std::to_string(data.CustFee) + "','" + std::to_string(data.BrokerFee) + "','" + data.Message + "','" + data.Digest + "','" + (data.BankAccType == 0 ? '0' : data.BankAccType) + "','" + data.DeviceID + "','" + (data.BankSecuAccType == 0 ? '0' : data.BankSecuAccType) + "','" + data.BrokerIDByBank + "','" + data.BankSecuAcc + "','" + (data.BankPwdFlag == 0 ? '0' : data.BankPwdFlag) + "','" + (data.SecuPwdFlag == 0 ? '0' : data.SecuPwdFlag) + "','" + data.OperNo + "','" + std::to_string(data.RequestID) + "','" + std::to_string(data.TID) + "','" + (data.TransferStatus == 0 ? '0' : data.TransferStatus) + "','" + std::to_string(data.ErrorID) + "','" + gbk_to_utf8(data.ErrorMsg) + "','" + data.LongCustomerName
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.AccountID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& AccountID) {
return "SELECT * FROM 'CThostFtdcRspTransferField' where BrokerID='" + BrokerID + "' and AccountID='" + AccountID + "';";
}
};
struct CThostFtdcReqRepealFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcReqRepealField data;
CThostFtdcReqRepealFieldWrapper(const CThostFtdcReqRepealField& _data = { 0 }) :data(_data) { }
CThostFtdcReqRepealFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcReqRepealField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
data.RepealTimeInterval = std::stoi(rowValue.at("RepealTimeInterval"));
data.RepealedTimes = std::stoi(rowValue.at("RepealedTimes"));
data.BankRepealFlag = rowValue.at("BankRepealFlag").empty() ? '0' : rowValue.at("BankRepealFlag")[0];
data.BrokerRepealFlag = rowValue.at("BrokerRepealFlag").empty() ? '0' : rowValue.at("BrokerRepealFlag")[0];
data.PlateRepealSerial = std::stoi(rowValue.at("PlateRepealSerial"));
strncpy(data.BankRepealSerial, rowValue.at("BankRepealSerial").c_str(), sizeof(TThostFtdcBankSerialType));
data.FutureRepealSerial = std::stoi(rowValue.at("FutureRepealSerial"));
strncpy(data.TradeCode, rowValue.at("TradeCode").c_str(), sizeof(TThostFtdcTradeCodeType));
strncpy(data.BankID, rowValue.at("BankID").c_str(), sizeof(TThostFtdcBankIDType));
strncpy(data.BankBranchID, rowValue.at("BankBranchID").c_str(), sizeof(TThostFtdcBankBrchIDType));
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.BrokerBranchID, rowValue.at("BrokerBranchID").c_str(), sizeof(TThostFtdcFutureBranchIDType));
strncpy(data.TradeDate, rowValue.at("TradeDate").c_str(), sizeof(TThostFtdcTradeDateType));
strncpy(data.TradeTime, rowValue.at("TradeTime").c_str(), sizeof(TThostFtdcTradeTimeType));
strncpy(data.BankSerial, rowValue.at("BankSerial").c_str(), sizeof(TThostFtdcBankSerialType));
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcTradeDateType));
data.PlateSerial = std::stoi(rowValue.at("PlateSerial"));
data.LastFragment = rowValue.at("LastFragment").empty() ? '0' : rowValue.at("LastFragment")[0];
data.SessionID = std::stoi(rowValue.at("SessionID"));
strncpy(data.CustomerName, rowValue.at("CustomerName").c_str(), sizeof(TThostFtdcIndividualNameType));
data.IdCardType = rowValue.at("IdCardType").empty() ? '0' : rowValue.at("IdCardType")[0];
strncpy(data.IdentifiedCardNo, rowValue.at("IdentifiedCardNo").c_str(), sizeof(TThostFtdcIdentifiedCardNoType));
data.CustType = rowValue.at("CustType").empty() ? '0' : rowValue.at("CustType")[0];
strncpy(data.BankAccount, rowValue.at("BankAccount").c_str(), sizeof(TThostFtdcBankAccountType));
strncpy(data.BankPassWord, rowValue.at("BankPassWord").c_str(), sizeof(TThostFtdcPasswordType));
strncpy(data.AccountID, rowValue.at("AccountID").c_str(), sizeof(TThostFtdcAccountIDType));
strncpy(data.Password, rowValue.at("Password").c_str(), sizeof(TThostFtdcPasswordType));
data.InstallID = std::stoi(rowValue.at("InstallID"));
data.FutureSerial = std::stoi(rowValue.at("FutureSerial"));
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
data.VerifyCertNoFlag = rowValue.at("VerifyCertNoFlag").empty() ? '0' : rowValue.at("VerifyCertNoFlag")[0];
strncpy(data.CurrencyID, rowValue.at("CurrencyID").c_str(), sizeof(TThostFtdcCurrencyIDType));
data.TradeAmount = std::stod(rowValue.at("TradeAmount"));
data.FutureFetchAmount = std::stod(rowValue.at("FutureFetchAmount"));
data.FeePayFlag = rowValue.at("FeePayFlag").empty() ? '0' : rowValue.at("FeePayFlag")[0];
data.CustFee = std::stod(rowValue.at("CustFee"));
data.BrokerFee = std::stod(rowValue.at("BrokerFee"));
strncpy(data.Message, rowValue.at("Message").c_str(), sizeof(TThostFtdcAddInfoType));
strncpy(data.Digest, rowValue.at("Digest").c_str(), sizeof(TThostFtdcDigestType));
data.BankAccType = rowValue.at("BankAccType").empty() ? '0' : rowValue.at("BankAccType")[0];
strncpy(data.DeviceID, rowValue.at("DeviceID").c_str(), sizeof(TThostFtdcDeviceIDType));
data.BankSecuAccType = rowValue.at("BankSecuAccType").empty() ? '0' : rowValue.at("BankSecuAccType")[0];
strncpy(data.BrokerIDByBank, rowValue.at("BrokerIDByBank").c_str(), sizeof(TThostFtdcBankCodingForFutureType));
strncpy(data.BankSecuAcc, rowValue.at("BankSecuAcc").c_str(), sizeof(TThostFtdcBankAccountType));
data.BankPwdFlag = rowValue.at("BankPwdFlag").empty() ? '0' : rowValue.at("BankPwdFlag")[0];
data.SecuPwdFlag = rowValue.at("SecuPwdFlag").empty() ? '0' : rowValue.at("SecuPwdFlag")[0];
strncpy(data.OperNo, rowValue.at("OperNo").c_str(), sizeof(TThostFtdcOperNoType));
data.RequestID = std::stoi(rowValue.at("RequestID"));
data.TID = std::stoi(rowValue.at("TID"));
data.TransferStatus = rowValue.at("TransferStatus").empty() ? '0' : rowValue.at("TransferStatus")[0];
strncpy(data.LongCustomerName, rowValue.at("LongCustomerName").c_str(), sizeof(TThostFtdcLongIndividualNameType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
std::to_string(data.RepealTimeInterval) + "','" + std::to_string(data.RepealedTimes) + "','" + (data.BankRepealFlag == 0 ? '0' : data.BankRepealFlag) + "','" + (data.BrokerRepealFlag == 0 ? '0' : data.BrokerRepealFlag) + "','" + std::to_string(data.PlateRepealSerial) + "','" + data.BankRepealSerial + "','" + std::to_string(data.FutureRepealSerial) + "','" + data.TradeCode + "','" + data.BankID + "','" + data.BankBranchID + "','" + data.BrokerID + "','" + data.BrokerBranchID + "','" + data.TradeDate + "','" + data.TradeTime + "','" + data.BankSerial + "','" + data.TradingDay + "','" + std::to_string(data.PlateSerial) + "','" + (data.LastFragment == 0 ? '0' : data.LastFragment) + "','" + std::to_string(data.SessionID) + "','" + data.CustomerName + "','" + (data.IdCardType == 0 ? '0' : data.IdCardType) + "','" + data.IdentifiedCardNo + "','" + (data.CustType == 0 ? '0' : data.CustType) + "','" + data.BankAccount + "','" + data.BankPassWord + "','" + data.AccountID + "','" + data.Password + "','" + std::to_string(data.InstallID) + "','" + std::to_string(data.FutureSerial) + "','" + data.UserID + "','" + (data.VerifyCertNoFlag == 0 ? '0' : data.VerifyCertNoFlag) + "','" + data.CurrencyID + "','" + std::to_string(data.TradeAmount) + "','" + std::to_string(data.FutureFetchAmount) + "','" + (data.FeePayFlag == 0 ? '0' : data.FeePayFlag) + "','" + std::to_string(data.CustFee) + "','" + std::to_string(data.BrokerFee) + "','" + data.Message + "','" + data.Digest + "','" + (data.BankAccType == 0 ? '0' : data.BankAccType) + "','" + data.DeviceID + "','" + (data.BankSecuAccType == 0 ? '0' : data.BankSecuAccType) + "','" + data.BrokerIDByBank + "','" + data.BankSecuAcc + "','" + (data.BankPwdFlag == 0 ? '0' : data.BankPwdFlag) + "','" + (data.SecuPwdFlag == 0 ? '0' : data.SecuPwdFlag) + "','" + data.OperNo + "','" + std::to_string(data.RequestID) + "','" + std::to_string(data.TID) + "','" + (data.TransferStatus == 0 ? '0' : data.TransferStatus) + "','" + data.LongCustomerName
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.AccountID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& AccountID) {
return "SELECT * FROM 'CThostFtdcReqRepealField' where BrokerID='" + BrokerID + "' and AccountID='" + AccountID + "';";
}
};
struct CThostFtdcRspRepealFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcRspRepealField data;
CThostFtdcRspRepealFieldWrapper(const CThostFtdcRspRepealField& _data = { 0 }) :data(_data) { }
CThostFtdcRspRepealFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcRspRepealField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
data.RepealTimeInterval = std::stoi(rowValue.at("RepealTimeInterval"));
data.RepealedTimes = std::stoi(rowValue.at("RepealedTimes"));
data.BankRepealFlag = rowValue.at("BankRepealFlag").empty() ? '0' : rowValue.at("BankRepealFlag")[0];
data.BrokerRepealFlag = rowValue.at("BrokerRepealFlag").empty() ? '0' : rowValue.at("BrokerRepealFlag")[0];
data.PlateRepealSerial = std::stoi(rowValue.at("PlateRepealSerial"));
strncpy(data.BankRepealSerial, rowValue.at("BankRepealSerial").c_str(), sizeof(TThostFtdcBankSerialType));
data.FutureRepealSerial = std::stoi(rowValue.at("FutureRepealSerial"));
strncpy(data.TradeCode, rowValue.at("TradeCode").c_str(), sizeof(TThostFtdcTradeCodeType));
strncpy(data.BankID, rowValue.at("BankID").c_str(), sizeof(TThostFtdcBankIDType));
strncpy(data.BankBranchID, rowValue.at("BankBranchID").c_str(), sizeof(TThostFtdcBankBrchIDType));
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.BrokerBranchID, rowValue.at("BrokerBranchID").c_str(), sizeof(TThostFtdcFutureBranchIDType));
strncpy(data.TradeDate, rowValue.at("TradeDate").c_str(), sizeof(TThostFtdcTradeDateType));
strncpy(data.TradeTime, rowValue.at("TradeTime").c_str(), sizeof(TThostFtdcTradeTimeType));
strncpy(data.BankSerial, rowValue.at("BankSerial").c_str(), sizeof(TThostFtdcBankSerialType));
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcTradeDateType));
data.PlateSerial = std::stoi(rowValue.at("PlateSerial"));
data.LastFragment = rowValue.at("LastFragment").empty() ? '0' : rowValue.at("LastFragment")[0];
data.SessionID = std::stoi(rowValue.at("SessionID"));
strncpy(data.CustomerName, rowValue.at("CustomerName").c_str(), sizeof(TThostFtdcIndividualNameType));
data.IdCardType = rowValue.at("IdCardType").empty() ? '0' : rowValue.at("IdCardType")[0];
strncpy(data.IdentifiedCardNo, rowValue.at("IdentifiedCardNo").c_str(), sizeof(TThostFtdcIdentifiedCardNoType));
data.CustType = rowValue.at("CustType").empty() ? '0' : rowValue.at("CustType")[0];
strncpy(data.BankAccount, rowValue.at("BankAccount").c_str(), sizeof(TThostFtdcBankAccountType));
strncpy(data.BankPassWord, rowValue.at("BankPassWord").c_str(), sizeof(TThostFtdcPasswordType));
strncpy(data.AccountID, rowValue.at("AccountID").c_str(), sizeof(TThostFtdcAccountIDType));
strncpy(data.Password, rowValue.at("Password").c_str(), sizeof(TThostFtdcPasswordType));
data.InstallID = std::stoi(rowValue.at("InstallID"));
data.FutureSerial = std::stoi(rowValue.at("FutureSerial"));
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
data.VerifyCertNoFlag = rowValue.at("VerifyCertNoFlag").empty() ? '0' : rowValue.at("VerifyCertNoFlag")[0];
strncpy(data.CurrencyID, rowValue.at("CurrencyID").c_str(), sizeof(TThostFtdcCurrencyIDType));
data.TradeAmount = std::stod(rowValue.at("TradeAmount"));
data.FutureFetchAmount = std::stod(rowValue.at("FutureFetchAmount"));
data.FeePayFlag = rowValue.at("FeePayFlag").empty() ? '0' : rowValue.at("FeePayFlag")[0];
data.CustFee = std::stod(rowValue.at("CustFee"));
data.BrokerFee = std::stod(rowValue.at("BrokerFee"));
strncpy(data.Message, rowValue.at("Message").c_str(), sizeof(TThostFtdcAddInfoType));
strncpy(data.Digest, rowValue.at("Digest").c_str(), sizeof(TThostFtdcDigestType));
data.BankAccType = rowValue.at("BankAccType").empty() ? '0' : rowValue.at("BankAccType")[0];
strncpy(data.DeviceID, rowValue.at("DeviceID").c_str(), sizeof(TThostFtdcDeviceIDType));
data.BankSecuAccType = rowValue.at("BankSecuAccType").empty() ? '0' : rowValue.at("BankSecuAccType")[0];
strncpy(data.BrokerIDByBank, rowValue.at("BrokerIDByBank").c_str(), sizeof(TThostFtdcBankCodingForFutureType));
strncpy(data.BankSecuAcc, rowValue.at("BankSecuAcc").c_str(), sizeof(TThostFtdcBankAccountType));
data.BankPwdFlag = rowValue.at("BankPwdFlag").empty() ? '0' : rowValue.at("BankPwdFlag")[0];
data.SecuPwdFlag = rowValue.at("SecuPwdFlag").empty() ? '0' : rowValue.at("SecuPwdFlag")[0];
strncpy(data.OperNo, rowValue.at("OperNo").c_str(), sizeof(TThostFtdcOperNoType));
data.RequestID = std::stoi(rowValue.at("RequestID"));
data.TID = std::stoi(rowValue.at("TID"));
data.TransferStatus = rowValue.at("TransferStatus").empty() ? '0' : rowValue.at("TransferStatus")[0];
data.ErrorID = std::stoi(rowValue.at("ErrorID"));
strncpy(data.ErrorMsg, utf8_to_gbk(rowValue.at("ErrorMsg")).c_str(), sizeof(TThostFtdcErrorMsgType));
strncpy(data.LongCustomerName, rowValue.at("LongCustomerName").c_str(), sizeof(TThostFtdcLongIndividualNameType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
std::to_string(data.RepealTimeInterval) + "','" + std::to_string(data.RepealedTimes) + "','" + (data.BankRepealFlag == 0 ? '0' : data.BankRepealFlag) + "','" + (data.BrokerRepealFlag == 0 ? '0' : data.BrokerRepealFlag) + "','" + std::to_string(data.PlateRepealSerial) + "','" + data.BankRepealSerial + "','" + std::to_string(data.FutureRepealSerial) + "','" + data.TradeCode + "','" + data.BankID + "','" + data.BankBranchID + "','" + data.BrokerID + "','" + data.BrokerBranchID + "','" + data.TradeDate + "','" + data.TradeTime + "','" + data.BankSerial + "','" + data.TradingDay + "','" + std::to_string(data.PlateSerial) + "','" + (data.LastFragment == 0 ? '0' : data.LastFragment) + "','" + std::to_string(data.SessionID) + "','" + data.CustomerName + "','" + (data.IdCardType == 0 ? '0' : data.IdCardType) + "','" + data.IdentifiedCardNo + "','" + (data.CustType == 0 ? '0' : data.CustType) + "','" + data.BankAccount + "','" + data.BankPassWord + "','" + data.AccountID + "','" + data.Password + "','" + std::to_string(data.InstallID) + "','" + std::to_string(data.FutureSerial) + "','" + data.UserID + "','" + (data.VerifyCertNoFlag == 0 ? '0' : data.VerifyCertNoFlag) + "','" + data.CurrencyID + "','" + std::to_string(data.TradeAmount) + "','" + std::to_string(data.FutureFetchAmount) + "','" + (data.FeePayFlag == 0 ? '0' : data.FeePayFlag) + "','" + std::to_string(data.CustFee) + "','" + std::to_string(data.BrokerFee) + "','" + data.Message + "','" + data.Digest + "','" + (data.BankAccType == 0 ? '0' : data.BankAccType) + "','" + data.DeviceID + "','" + (data.BankSecuAccType == 0 ? '0' : data.BankSecuAccType) + "','" + data.BrokerIDByBank + "','" + data.BankSecuAcc + "','" + (data.BankPwdFlag == 0 ? '0' : data.BankPwdFlag) + "','" + (data.SecuPwdFlag == 0 ? '0' : data.SecuPwdFlag) + "','" + data.OperNo + "','" + std::to_string(data.RequestID) + "','" + std::to_string(data.TID) + "','" + (data.TransferStatus == 0 ? '0' : data.TransferStatus) + "','" + std::to_string(data.ErrorID) + "','" + gbk_to_utf8(data.ErrorMsg) + "','" + data.LongCustomerName
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.AccountID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& AccountID) {
return "SELECT * FROM 'CThostFtdcRspRepealField' where BrokerID='" + BrokerID + "' and AccountID='" + AccountID + "';";
}
};
struct CThostFtdcReqQueryAccountFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcReqQueryAccountField data;
CThostFtdcReqQueryAccountFieldWrapper(const CThostFtdcReqQueryAccountField& _data = { 0 }) :data(_data) { }
CThostFtdcReqQueryAccountFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcReqQueryAccountField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.TradeCode, rowValue.at("TradeCode").c_str(), sizeof(TThostFtdcTradeCodeType));
strncpy(data.BankID, rowValue.at("BankID").c_str(), sizeof(TThostFtdcBankIDType));
strncpy(data.BankBranchID, rowValue.at("BankBranchID").c_str(), sizeof(TThostFtdcBankBrchIDType));
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.BrokerBranchID, rowValue.at("BrokerBranchID").c_str(), sizeof(TThostFtdcFutureBranchIDType));
strncpy(data.TradeDate, rowValue.at("TradeDate").c_str(), sizeof(TThostFtdcTradeDateType));
strncpy(data.TradeTime, rowValue.at("TradeTime").c_str(), sizeof(TThostFtdcTradeTimeType));
strncpy(data.BankSerial, rowValue.at("BankSerial").c_str(), sizeof(TThostFtdcBankSerialType));
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcTradeDateType));
data.PlateSerial = std::stoi(rowValue.at("PlateSerial"));
data.LastFragment = rowValue.at("LastFragment").empty() ? '0' : rowValue.at("LastFragment")[0];
data.SessionID = std::stoi(rowValue.at("SessionID"));
strncpy(data.CustomerName, rowValue.at("CustomerName").c_str(), sizeof(TThostFtdcIndividualNameType));
data.IdCardType = rowValue.at("IdCardType").empty() ? '0' : rowValue.at("IdCardType")[0];
strncpy(data.IdentifiedCardNo, rowValue.at("IdentifiedCardNo").c_str(), sizeof(TThostFtdcIdentifiedCardNoType));
data.CustType = rowValue.at("CustType").empty() ? '0' : rowValue.at("CustType")[0];
strncpy(data.BankAccount, rowValue.at("BankAccount").c_str(), sizeof(TThostFtdcBankAccountType));
strncpy(data.BankPassWord, rowValue.at("BankPassWord").c_str(), sizeof(TThostFtdcPasswordType));
strncpy(data.AccountID, rowValue.at("AccountID").c_str(), sizeof(TThostFtdcAccountIDType));
strncpy(data.Password, rowValue.at("Password").c_str(), sizeof(TThostFtdcPasswordType));
data.FutureSerial = std::stoi(rowValue.at("FutureSerial"));
data.InstallID = std::stoi(rowValue.at("InstallID"));
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
data.VerifyCertNoFlag = rowValue.at("VerifyCertNoFlag").empty() ? '0' : rowValue.at("VerifyCertNoFlag")[0];
strncpy(data.CurrencyID, rowValue.at("CurrencyID").c_str(), sizeof(TThostFtdcCurrencyIDType));
strncpy(data.Digest, rowValue.at("Digest").c_str(), sizeof(TThostFtdcDigestType));
data.BankAccType = rowValue.at("BankAccType").empty() ? '0' : rowValue.at("BankAccType")[0];
strncpy(data.DeviceID, rowValue.at("DeviceID").c_str(), sizeof(TThostFtdcDeviceIDType));
data.BankSecuAccType = rowValue.at("BankSecuAccType").empty() ? '0' : rowValue.at("BankSecuAccType")[0];
strncpy(data.BrokerIDByBank, rowValue.at("BrokerIDByBank").c_str(), sizeof(TThostFtdcBankCodingForFutureType));
strncpy(data.BankSecuAcc, rowValue.at("BankSecuAcc").c_str(), sizeof(TThostFtdcBankAccountType));
data.BankPwdFlag = rowValue.at("BankPwdFlag").empty() ? '0' : rowValue.at("BankPwdFlag")[0];
data.SecuPwdFlag = rowValue.at("SecuPwdFlag").empty() ? '0' : rowValue.at("SecuPwdFlag")[0];
strncpy(data.OperNo, rowValue.at("OperNo").c_str(), sizeof(TThostFtdcOperNoType));
data.RequestID = std::stoi(rowValue.at("RequestID"));
data.TID = std::stoi(rowValue.at("TID"));
strncpy(data.LongCustomerName, rowValue.at("LongCustomerName").c_str(), sizeof(TThostFtdcLongIndividualNameType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.TradeCode + "','" + data.BankID + "','" + data.BankBranchID + "','" + data.BrokerID + "','" + data.BrokerBranchID + "','" + data.TradeDate + "','" + data.TradeTime + "','" + data.BankSerial + "','" + data.TradingDay + "','" + std::to_string(data.PlateSerial) + "','" + (data.LastFragment == 0 ? '0' : data.LastFragment) + "','" + std::to_string(data.SessionID) + "','" + data.CustomerName + "','" + (data.IdCardType == 0 ? '0' : data.IdCardType) + "','" + data.IdentifiedCardNo + "','" + (data.CustType == 0 ? '0' : data.CustType) + "','" + data.BankAccount + "','" + data.BankPassWord + "','" + data.AccountID + "','" + data.Password + "','" + std::to_string(data.FutureSerial) + "','" + std::to_string(data.InstallID) + "','" + data.UserID + "','" + (data.VerifyCertNoFlag == 0 ? '0' : data.VerifyCertNoFlag) + "','" + data.CurrencyID + "','" + data.Digest + "','" + (data.BankAccType == 0 ? '0' : data.BankAccType) + "','" + data.DeviceID + "','" + (data.BankSecuAccType == 0 ? '0' : data.BankSecuAccType) + "','" + data.BrokerIDByBank + "','" + data.BankSecuAcc + "','" + (data.BankPwdFlag == 0 ? '0' : data.BankPwdFlag) + "','" + (data.SecuPwdFlag == 0 ? '0' : data.SecuPwdFlag) + "','" + data.OperNo + "','" + std::to_string(data.RequestID) + "','" + std::to_string(data.TID) + "','" + data.LongCustomerName
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.AccountID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& AccountID) {
return "SELECT * FROM 'CThostFtdcReqQueryAccountField' where BrokerID='" + BrokerID + "' and AccountID='" + AccountID + "';";
}
};
struct CThostFtdcRspQueryAccountFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcRspQueryAccountField data;
CThostFtdcRspQueryAccountFieldWrapper(const CThostFtdcRspQueryAccountField& _data = { 0 }) :data(_data) { }
CThostFtdcRspQueryAccountFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcRspQueryAccountField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.TradeCode, rowValue.at("TradeCode").c_str(), sizeof(TThostFtdcTradeCodeType));
strncpy(data.BankID, rowValue.at("BankID").c_str(), sizeof(TThostFtdcBankIDType));
strncpy(data.BankBranchID, rowValue.at("BankBranchID").c_str(), sizeof(TThostFtdcBankBrchIDType));
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.BrokerBranchID, rowValue.at("BrokerBranchID").c_str(), sizeof(TThostFtdcFutureBranchIDType));
strncpy(data.TradeDate, rowValue.at("TradeDate").c_str(), sizeof(TThostFtdcTradeDateType));
strncpy(data.TradeTime, rowValue.at("TradeTime").c_str(), sizeof(TThostFtdcTradeTimeType));
strncpy(data.BankSerial, rowValue.at("BankSerial").c_str(), sizeof(TThostFtdcBankSerialType));
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcTradeDateType));
data.PlateSerial = std::stoi(rowValue.at("PlateSerial"));
data.LastFragment = rowValue.at("LastFragment").empty() ? '0' : rowValue.at("LastFragment")[0];
data.SessionID = std::stoi(rowValue.at("SessionID"));
strncpy(data.CustomerName, rowValue.at("CustomerName").c_str(), sizeof(TThostFtdcIndividualNameType));
data.IdCardType = rowValue.at("IdCardType").empty() ? '0' : rowValue.at("IdCardType")[0];
strncpy(data.IdentifiedCardNo, rowValue.at("IdentifiedCardNo").c_str(), sizeof(TThostFtdcIdentifiedCardNoType));
data.CustType = rowValue.at("CustType").empty() ? '0' : rowValue.at("CustType")[0];
strncpy(data.BankAccount, rowValue.at("BankAccount").c_str(), sizeof(TThostFtdcBankAccountType));
strncpy(data.BankPassWord, rowValue.at("BankPassWord").c_str(), sizeof(TThostFtdcPasswordType));
strncpy(data.AccountID, rowValue.at("AccountID").c_str(), sizeof(TThostFtdcAccountIDType));
strncpy(data.Password, rowValue.at("Password").c_str(), sizeof(TThostFtdcPasswordType));
data.FutureSerial = std::stoi(rowValue.at("FutureSerial"));
data.InstallID = std::stoi(rowValue.at("InstallID"));
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
data.VerifyCertNoFlag = rowValue.at("VerifyCertNoFlag").empty() ? '0' : rowValue.at("VerifyCertNoFlag")[0];
strncpy(data.CurrencyID, rowValue.at("CurrencyID").c_str(), sizeof(TThostFtdcCurrencyIDType));
strncpy(data.Digest, rowValue.at("Digest").c_str(), sizeof(TThostFtdcDigestType));
data.BankAccType = rowValue.at("BankAccType").empty() ? '0' : rowValue.at("BankAccType")[0];
strncpy(data.DeviceID, rowValue.at("DeviceID").c_str(), sizeof(TThostFtdcDeviceIDType));
data.BankSecuAccType = rowValue.at("BankSecuAccType").empty() ? '0' : rowValue.at("BankSecuAccType")[0];
strncpy(data.BrokerIDByBank, rowValue.at("BrokerIDByBank").c_str(), sizeof(TThostFtdcBankCodingForFutureType));
strncpy(data.BankSecuAcc, rowValue.at("BankSecuAcc").c_str(), sizeof(TThostFtdcBankAccountType));
data.BankPwdFlag = rowValue.at("BankPwdFlag").empty() ? '0' : rowValue.at("BankPwdFlag")[0];
data.SecuPwdFlag = rowValue.at("SecuPwdFlag").empty() ? '0' : rowValue.at("SecuPwdFlag")[0];
strncpy(data.OperNo, rowValue.at("OperNo").c_str(), sizeof(TThostFtdcOperNoType));
data.RequestID = std::stoi(rowValue.at("RequestID"));
data.TID = std::stoi(rowValue.at("TID"));
data.BankUseAmount = std::stod(rowValue.at("BankUseAmount"));
data.BankFetchAmount = std::stod(rowValue.at("BankFetchAmount"));
strncpy(data.LongCustomerName, rowValue.at("LongCustomerName").c_str(), sizeof(TThostFtdcLongIndividualNameType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.TradeCode + "','" + data.BankID + "','" + data.BankBranchID + "','" + data.BrokerID + "','" + data.BrokerBranchID + "','" + data.TradeDate + "','" + data.TradeTime + "','" + data.BankSerial + "','" + data.TradingDay + "','" + std::to_string(data.PlateSerial) + "','" + (data.LastFragment == 0 ? '0' : data.LastFragment) + "','" + std::to_string(data.SessionID) + "','" + data.CustomerName + "','" + (data.IdCardType == 0 ? '0' : data.IdCardType) + "','" + data.IdentifiedCardNo + "','" + (data.CustType == 0 ? '0' : data.CustType) + "','" + data.BankAccount + "','" + data.BankPassWord + "','" + data.AccountID + "','" + data.Password + "','" + std::to_string(data.FutureSerial) + "','" + std::to_string(data.InstallID) + "','" + data.UserID + "','" + (data.VerifyCertNoFlag == 0 ? '0' : data.VerifyCertNoFlag) + "','" + data.CurrencyID + "','" + data.Digest + "','" + (data.BankAccType == 0 ? '0' : data.BankAccType) + "','" + data.DeviceID + "','" + (data.BankSecuAccType == 0 ? '0' : data.BankSecuAccType) + "','" + data.BrokerIDByBank + "','" + data.BankSecuAcc + "','" + (data.BankPwdFlag == 0 ? '0' : data.BankPwdFlag) + "','" + (data.SecuPwdFlag == 0 ? '0' : data.SecuPwdFlag) + "','" + data.OperNo + "','" + std::to_string(data.RequestID) + "','" + std::to_string(data.TID) + "','" + std::to_string(data.BankUseAmount) + "','" + std::to_string(data.BankFetchAmount) + "','" + data.LongCustomerName
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.AccountID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& AccountID) {
return "SELECT * FROM 'CThostFtdcRspQueryAccountField' where BrokerID='" + BrokerID + "' and AccountID='" + AccountID + "';";
}
};
struct CThostFtdcFutureSignIOFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcFutureSignIOField data;
CThostFtdcFutureSignIOFieldWrapper(const CThostFtdcFutureSignIOField& _data = { 0 }) :data(_data) { }
CThostFtdcFutureSignIOFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcFutureSignIOField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.TradeCode, rowValue.at("TradeCode").c_str(), sizeof(TThostFtdcTradeCodeType));
strncpy(data.BankID, rowValue.at("BankID").c_str(), sizeof(TThostFtdcBankIDType));
strncpy(data.BankBranchID, rowValue.at("BankBranchID").c_str(), sizeof(TThostFtdcBankBrchIDType));
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.BrokerBranchID, rowValue.at("BrokerBranchID").c_str(), sizeof(TThostFtdcFutureBranchIDType));
strncpy(data.TradeDate, rowValue.at("TradeDate").c_str(), sizeof(TThostFtdcTradeDateType));
strncpy(data.TradeTime, rowValue.at("TradeTime").c_str(), sizeof(TThostFtdcTradeTimeType));
strncpy(data.BankSerial, rowValue.at("BankSerial").c_str(), sizeof(TThostFtdcBankSerialType));
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcTradeDateType));
data.PlateSerial = std::stoi(rowValue.at("PlateSerial"));
data.LastFragment = rowValue.at("LastFragment").empty() ? '0' : rowValue.at("LastFragment")[0];
data.SessionID = std::stoi(rowValue.at("SessionID"));
data.InstallID = std::stoi(rowValue.at("InstallID"));
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
strncpy(data.Digest, rowValue.at("Digest").c_str(), sizeof(TThostFtdcDigestType));
strncpy(data.CurrencyID, rowValue.at("CurrencyID").c_str(), sizeof(TThostFtdcCurrencyIDType));
strncpy(data.DeviceID, rowValue.at("DeviceID").c_str(), sizeof(TThostFtdcDeviceIDType));
strncpy(data.BrokerIDByBank, rowValue.at("BrokerIDByBank").c_str(), sizeof(TThostFtdcBankCodingForFutureType));
strncpy(data.OperNo, rowValue.at("OperNo").c_str(), sizeof(TThostFtdcOperNoType));
data.RequestID = std::stoi(rowValue.at("RequestID"));
data.TID = std::stoi(rowValue.at("TID"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.TradeCode + "','" + data.BankID + "','" + data.BankBranchID + "','" + data.BrokerID + "','" + data.BrokerBranchID + "','" + data.TradeDate + "','" + data.TradeTime + "','" + data.BankSerial + "','" + data.TradingDay + "','" + std::to_string(data.PlateSerial) + "','" + (data.LastFragment == 0 ? '0' : data.LastFragment) + "','" + std::to_string(data.SessionID) + "','" + std::to_string(data.InstallID) + "','" + data.UserID + "','" + data.Digest + "','" + data.CurrencyID + "','" + data.DeviceID + "','" + data.BrokerIDByBank + "','" + data.OperNo + "','" + std::to_string(data.RequestID) + "','" + std::to_string(data.TID)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.UserID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& UserID) {
return "SELECT * FROM 'CThostFtdcFutureSignIOField' where BrokerID='" + BrokerID + "' and UserID='" + UserID + "';";
}
};
struct CThostFtdcRspFutureSignInFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcRspFutureSignInField data;
CThostFtdcRspFutureSignInFieldWrapper(const CThostFtdcRspFutureSignInField& _data = { 0 }) :data(_data) { }
CThostFtdcRspFutureSignInFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcRspFutureSignInField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.TradeCode, rowValue.at("TradeCode").c_str(), sizeof(TThostFtdcTradeCodeType));
strncpy(data.BankID, rowValue.at("BankID").c_str(), sizeof(TThostFtdcBankIDType));
strncpy(data.BankBranchID, rowValue.at("BankBranchID").c_str(), sizeof(TThostFtdcBankBrchIDType));
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.BrokerBranchID, rowValue.at("BrokerBranchID").c_str(), sizeof(TThostFtdcFutureBranchIDType));
strncpy(data.TradeDate, rowValue.at("TradeDate").c_str(), sizeof(TThostFtdcTradeDateType));
strncpy(data.TradeTime, rowValue.at("TradeTime").c_str(), sizeof(TThostFtdcTradeTimeType));
strncpy(data.BankSerial, rowValue.at("BankSerial").c_str(), sizeof(TThostFtdcBankSerialType));
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcTradeDateType));
data.PlateSerial = std::stoi(rowValue.at("PlateSerial"));
data.LastFragment = rowValue.at("LastFragment").empty() ? '0' : rowValue.at("LastFragment")[0];
data.SessionID = std::stoi(rowValue.at("SessionID"));
data.InstallID = std::stoi(rowValue.at("InstallID"));
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
strncpy(data.Digest, rowValue.at("Digest").c_str(), sizeof(TThostFtdcDigestType));
strncpy(data.CurrencyID, rowValue.at("CurrencyID").c_str(), sizeof(TThostFtdcCurrencyIDType));
strncpy(data.DeviceID, rowValue.at("DeviceID").c_str(), sizeof(TThostFtdcDeviceIDType));
strncpy(data.BrokerIDByBank, rowValue.at("BrokerIDByBank").c_str(), sizeof(TThostFtdcBankCodingForFutureType));
strncpy(data.OperNo, rowValue.at("OperNo").c_str(), sizeof(TThostFtdcOperNoType));
data.RequestID = std::stoi(rowValue.at("RequestID"));
data.TID = std::stoi(rowValue.at("TID"));
data.ErrorID = std::stoi(rowValue.at("ErrorID"));
strncpy(data.ErrorMsg, utf8_to_gbk(rowValue.at("ErrorMsg")).c_str(), sizeof(TThostFtdcErrorMsgType));
strncpy(data.PinKey, rowValue.at("PinKey").c_str(), sizeof(TThostFtdcPasswordKeyType));
strncpy(data.MacKey, rowValue.at("MacKey").c_str(), sizeof(TThostFtdcPasswordKeyType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.TradeCode + "','" + data.BankID + "','" + data.BankBranchID + "','" + data.BrokerID + "','" + data.BrokerBranchID + "','" + data.TradeDate + "','" + data.TradeTime + "','" + data.BankSerial + "','" + data.TradingDay + "','" + std::to_string(data.PlateSerial) + "','" + (data.LastFragment == 0 ? '0' : data.LastFragment) + "','" + std::to_string(data.SessionID) + "','" + std::to_string(data.InstallID) + "','" + data.UserID + "','" + data.Digest + "','" + data.CurrencyID + "','" + data.DeviceID + "','" + data.BrokerIDByBank + "','" + data.OperNo + "','" + std::to_string(data.RequestID) + "','" + std::to_string(data.TID) + "','" + std::to_string(data.ErrorID) + "','" + gbk_to_utf8(data.ErrorMsg) + "','" + data.PinKey + "','" + data.MacKey
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.UserID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& UserID) {
return "SELECT * FROM 'CThostFtdcRspFutureSignInField' where BrokerID='" + BrokerID + "' and UserID='" + UserID + "';";
}
};
struct CThostFtdcReqFutureSignOutFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcReqFutureSignOutField data;
CThostFtdcReqFutureSignOutFieldWrapper(const CThostFtdcReqFutureSignOutField& _data = { 0 }) :data(_data) { }
CThostFtdcReqFutureSignOutFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcReqFutureSignOutField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.TradeCode, rowValue.at("TradeCode").c_str(), sizeof(TThostFtdcTradeCodeType));
strncpy(data.BankID, rowValue.at("BankID").c_str(), sizeof(TThostFtdcBankIDType));
strncpy(data.BankBranchID, rowValue.at("BankBranchID").c_str(), sizeof(TThostFtdcBankBrchIDType));
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.BrokerBranchID, rowValue.at("BrokerBranchID").c_str(), sizeof(TThostFtdcFutureBranchIDType));
strncpy(data.TradeDate, rowValue.at("TradeDate").c_str(), sizeof(TThostFtdcTradeDateType));
strncpy(data.TradeTime, rowValue.at("TradeTime").c_str(), sizeof(TThostFtdcTradeTimeType));
strncpy(data.BankSerial, rowValue.at("BankSerial").c_str(), sizeof(TThostFtdcBankSerialType));
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcTradeDateType));
data.PlateSerial = std::stoi(rowValue.at("PlateSerial"));
data.LastFragment = rowValue.at("LastFragment").empty() ? '0' : rowValue.at("LastFragment")[0];
data.SessionID = std::stoi(rowValue.at("SessionID"));
data.InstallID = std::stoi(rowValue.at("InstallID"));
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
strncpy(data.Digest, rowValue.at("Digest").c_str(), sizeof(TThostFtdcDigestType));
strncpy(data.CurrencyID, rowValue.at("CurrencyID").c_str(), sizeof(TThostFtdcCurrencyIDType));
strncpy(data.DeviceID, rowValue.at("DeviceID").c_str(), sizeof(TThostFtdcDeviceIDType));
strncpy(data.BrokerIDByBank, rowValue.at("BrokerIDByBank").c_str(), sizeof(TThostFtdcBankCodingForFutureType));
strncpy(data.OperNo, rowValue.at("OperNo").c_str(), sizeof(TThostFtdcOperNoType));
data.RequestID = std::stoi(rowValue.at("RequestID"));
data.TID = std::stoi(rowValue.at("TID"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.TradeCode + "','" + data.BankID + "','" + data.BankBranchID + "','" + data.BrokerID + "','" + data.BrokerBranchID + "','" + data.TradeDate + "','" + data.TradeTime + "','" + data.BankSerial + "','" + data.TradingDay + "','" + std::to_string(data.PlateSerial) + "','" + (data.LastFragment == 0 ? '0' : data.LastFragment) + "','" + std::to_string(data.SessionID) + "','" + std::to_string(data.InstallID) + "','" + data.UserID + "','" + data.Digest + "','" + data.CurrencyID + "','" + data.DeviceID + "','" + data.BrokerIDByBank + "','" + data.OperNo + "','" + std::to_string(data.RequestID) + "','" + std::to_string(data.TID)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.UserID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& UserID) {
return "SELECT * FROM 'CThostFtdcReqFutureSignOutField' where BrokerID='" + BrokerID + "' and UserID='" + UserID + "';";
}
};
struct CThostFtdcRspFutureSignOutFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcRspFutureSignOutField data;
CThostFtdcRspFutureSignOutFieldWrapper(const CThostFtdcRspFutureSignOutField& _data = { 0 }) :data(_data) { }
CThostFtdcRspFutureSignOutFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcRspFutureSignOutField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.TradeCode, rowValue.at("TradeCode").c_str(), sizeof(TThostFtdcTradeCodeType));
strncpy(data.BankID, rowValue.at("BankID").c_str(), sizeof(TThostFtdcBankIDType));
strncpy(data.BankBranchID, rowValue.at("BankBranchID").c_str(), sizeof(TThostFtdcBankBrchIDType));
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.BrokerBranchID, rowValue.at("BrokerBranchID").c_str(), sizeof(TThostFtdcFutureBranchIDType));
strncpy(data.TradeDate, rowValue.at("TradeDate").c_str(), sizeof(TThostFtdcTradeDateType));
strncpy(data.TradeTime, rowValue.at("TradeTime").c_str(), sizeof(TThostFtdcTradeTimeType));
strncpy(data.BankSerial, rowValue.at("BankSerial").c_str(), sizeof(TThostFtdcBankSerialType));
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcTradeDateType));
data.PlateSerial = std::stoi(rowValue.at("PlateSerial"));
data.LastFragment = rowValue.at("LastFragment").empty() ? '0' : rowValue.at("LastFragment")[0];
data.SessionID = std::stoi(rowValue.at("SessionID"));
data.InstallID = std::stoi(rowValue.at("InstallID"));
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
strncpy(data.Digest, rowValue.at("Digest").c_str(), sizeof(TThostFtdcDigestType));
strncpy(data.CurrencyID, rowValue.at("CurrencyID").c_str(), sizeof(TThostFtdcCurrencyIDType));
strncpy(data.DeviceID, rowValue.at("DeviceID").c_str(), sizeof(TThostFtdcDeviceIDType));
strncpy(data.BrokerIDByBank, rowValue.at("BrokerIDByBank").c_str(), sizeof(TThostFtdcBankCodingForFutureType));
strncpy(data.OperNo, rowValue.at("OperNo").c_str(), sizeof(TThostFtdcOperNoType));
data.RequestID = std::stoi(rowValue.at("RequestID"));
data.TID = std::stoi(rowValue.at("TID"));
data.ErrorID = std::stoi(rowValue.at("ErrorID"));
strncpy(data.ErrorMsg, utf8_to_gbk(rowValue.at("ErrorMsg")).c_str(), sizeof(TThostFtdcErrorMsgType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.TradeCode + "','" + data.BankID + "','" + data.BankBranchID + "','" + data.BrokerID + "','" + data.BrokerBranchID + "','" + data.TradeDate + "','" + data.TradeTime + "','" + data.BankSerial + "','" + data.TradingDay + "','" + std::to_string(data.PlateSerial) + "','" + (data.LastFragment == 0 ? '0' : data.LastFragment) + "','" + std::to_string(data.SessionID) + "','" + std::to_string(data.InstallID) + "','" + data.UserID + "','" + data.Digest + "','" + data.CurrencyID + "','" + data.DeviceID + "','" + data.BrokerIDByBank + "','" + data.OperNo + "','" + std::to_string(data.RequestID) + "','" + std::to_string(data.TID) + "','" + std::to_string(data.ErrorID) + "','" + gbk_to_utf8(data.ErrorMsg)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.UserID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& UserID) {
return "SELECT * FROM 'CThostFtdcRspFutureSignOutField' where BrokerID='" + BrokerID + "' and UserID='" + UserID + "';";
}
};
struct CThostFtdcReqQueryTradeResultBySerialFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcReqQueryTradeResultBySerialField data;
CThostFtdcReqQueryTradeResultBySerialFieldWrapper(const CThostFtdcReqQueryTradeResultBySerialField& _data = { 0 }) :data(_data) { }
CThostFtdcReqQueryTradeResultBySerialFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcReqQueryTradeResultBySerialField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.TradeCode, rowValue.at("TradeCode").c_str(), sizeof(TThostFtdcTradeCodeType));
strncpy(data.BankID, rowValue.at("BankID").c_str(), sizeof(TThostFtdcBankIDType));
strncpy(data.BankBranchID, rowValue.at("BankBranchID").c_str(), sizeof(TThostFtdcBankBrchIDType));
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.BrokerBranchID, rowValue.at("BrokerBranchID").c_str(), sizeof(TThostFtdcFutureBranchIDType));
strncpy(data.TradeDate, rowValue.at("TradeDate").c_str(), sizeof(TThostFtdcTradeDateType));
strncpy(data.TradeTime, rowValue.at("TradeTime").c_str(), sizeof(TThostFtdcTradeTimeType));
strncpy(data.BankSerial, rowValue.at("BankSerial").c_str(), sizeof(TThostFtdcBankSerialType));
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcTradeDateType));
data.PlateSerial = std::stoi(rowValue.at("PlateSerial"));
data.LastFragment = rowValue.at("LastFragment").empty() ? '0' : rowValue.at("LastFragment")[0];
data.SessionID = std::stoi(rowValue.at("SessionID"));
data.Reference = std::stoi(rowValue.at("Reference"));
data.RefrenceIssureType = rowValue.at("RefrenceIssureType").empty() ? '0' : rowValue.at("RefrenceIssureType")[0];
strncpy(data.RefrenceIssure, rowValue.at("RefrenceIssure").c_str(), sizeof(TThostFtdcOrganCodeType));
strncpy(data.CustomerName, rowValue.at("CustomerName").c_str(), sizeof(TThostFtdcIndividualNameType));
data.IdCardType = rowValue.at("IdCardType").empty() ? '0' : rowValue.at("IdCardType")[0];
strncpy(data.IdentifiedCardNo, rowValue.at("IdentifiedCardNo").c_str(), sizeof(TThostFtdcIdentifiedCardNoType));
data.CustType = rowValue.at("CustType").empty() ? '0' : rowValue.at("CustType")[0];
strncpy(data.BankAccount, rowValue.at("BankAccount").c_str(), sizeof(TThostFtdcBankAccountType));
strncpy(data.BankPassWord, rowValue.at("BankPassWord").c_str(), sizeof(TThostFtdcPasswordType));
strncpy(data.AccountID, rowValue.at("AccountID").c_str(), sizeof(TThostFtdcAccountIDType));
strncpy(data.Password, rowValue.at("Password").c_str(), sizeof(TThostFtdcPasswordType));
strncpy(data.CurrencyID, rowValue.at("CurrencyID").c_str(), sizeof(TThostFtdcCurrencyIDType));
data.TradeAmount = std::stod(rowValue.at("TradeAmount"));
strncpy(data.Digest, rowValue.at("Digest").c_str(), sizeof(TThostFtdcDigestType));
strncpy(data.LongCustomerName, rowValue.at("LongCustomerName").c_str(), sizeof(TThostFtdcLongIndividualNameType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.TradeCode + "','" + data.BankID + "','" + data.BankBranchID + "','" + data.BrokerID + "','" + data.BrokerBranchID + "','" + data.TradeDate + "','" + data.TradeTime + "','" + data.BankSerial + "','" + data.TradingDay + "','" + std::to_string(data.PlateSerial) + "','" + (data.LastFragment == 0 ? '0' : data.LastFragment) + "','" + std::to_string(data.SessionID) + "','" + std::to_string(data.Reference) + "','" + (data.RefrenceIssureType == 0 ? '0' : data.RefrenceIssureType) + "','" + data.RefrenceIssure + "','" + data.CustomerName + "','" + (data.IdCardType == 0 ? '0' : data.IdCardType) + "','" + data.IdentifiedCardNo + "','" + (data.CustType == 0 ? '0' : data.CustType) + "','" + data.BankAccount + "','" + data.BankPassWord + "','" + data.AccountID + "','" + data.Password + "','" + data.CurrencyID + "','" + std::to_string(data.TradeAmount) + "','" + data.Digest + "','" + data.LongCustomerName
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.AccountID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& AccountID) {
return "SELECT * FROM 'CThostFtdcReqQueryTradeResultBySerialField' where BrokerID='" + BrokerID + "' and AccountID='" + AccountID + "';";
}
};
struct CThostFtdcRspQueryTradeResultBySerialFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcRspQueryTradeResultBySerialField data;
CThostFtdcRspQueryTradeResultBySerialFieldWrapper(const CThostFtdcRspQueryTradeResultBySerialField& _data = { 0 }) :data(_data) { }
CThostFtdcRspQueryTradeResultBySerialFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcRspQueryTradeResultBySerialField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.TradeCode, rowValue.at("TradeCode").c_str(), sizeof(TThostFtdcTradeCodeType));
strncpy(data.BankID, rowValue.at("BankID").c_str(), sizeof(TThostFtdcBankIDType));
strncpy(data.BankBranchID, rowValue.at("BankBranchID").c_str(), sizeof(TThostFtdcBankBrchIDType));
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.BrokerBranchID, rowValue.at("BrokerBranchID").c_str(), sizeof(TThostFtdcFutureBranchIDType));
strncpy(data.TradeDate, rowValue.at("TradeDate").c_str(), sizeof(TThostFtdcTradeDateType));
strncpy(data.TradeTime, rowValue.at("TradeTime").c_str(), sizeof(TThostFtdcTradeTimeType));
strncpy(data.BankSerial, rowValue.at("BankSerial").c_str(), sizeof(TThostFtdcBankSerialType));
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcTradeDateType));
data.PlateSerial = std::stoi(rowValue.at("PlateSerial"));
data.LastFragment = rowValue.at("LastFragment").empty() ? '0' : rowValue.at("LastFragment")[0];
data.SessionID = std::stoi(rowValue.at("SessionID"));
data.ErrorID = std::stoi(rowValue.at("ErrorID"));
strncpy(data.ErrorMsg, utf8_to_gbk(rowValue.at("ErrorMsg")).c_str(), sizeof(TThostFtdcErrorMsgType));
data.Reference = std::stoi(rowValue.at("Reference"));
data.RefrenceIssureType = rowValue.at("RefrenceIssureType").empty() ? '0' : rowValue.at("RefrenceIssureType")[0];
strncpy(data.RefrenceIssure, rowValue.at("RefrenceIssure").c_str(), sizeof(TThostFtdcOrganCodeType));
strncpy(data.OriginReturnCode, rowValue.at("OriginReturnCode").c_str(), sizeof(TThostFtdcReturnCodeType));
strncpy(data.OriginDescrInfoForReturnCode, rowValue.at("OriginDescrInfoForReturnCode").c_str(), sizeof(TThostFtdcDescrInfoForReturnCodeType));
strncpy(data.BankAccount, rowValue.at("BankAccount").c_str(), sizeof(TThostFtdcBankAccountType));
strncpy(data.BankPassWord, rowValue.at("BankPassWord").c_str(), sizeof(TThostFtdcPasswordType));
strncpy(data.AccountID, rowValue.at("AccountID").c_str(), sizeof(TThostFtdcAccountIDType));
strncpy(data.Password, rowValue.at("Password").c_str(), sizeof(TThostFtdcPasswordType));
strncpy(data.CurrencyID, rowValue.at("CurrencyID").c_str(), sizeof(TThostFtdcCurrencyIDType));
data.TradeAmount = std::stod(rowValue.at("TradeAmount"));
strncpy(data.Digest, rowValue.at("Digest").c_str(), sizeof(TThostFtdcDigestType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.TradeCode + "','" + data.BankID + "','" + data.BankBranchID + "','" + data.BrokerID + "','" + data.BrokerBranchID + "','" + data.TradeDate + "','" + data.TradeTime + "','" + data.BankSerial + "','" + data.TradingDay + "','" + std::to_string(data.PlateSerial) + "','" + (data.LastFragment == 0 ? '0' : data.LastFragment) + "','" + std::to_string(data.SessionID) + "','" + std::to_string(data.ErrorID) + "','" + gbk_to_utf8(data.ErrorMsg) + "','" + std::to_string(data.Reference) + "','" + (data.RefrenceIssureType == 0 ? '0' : data.RefrenceIssureType) + "','" + data.RefrenceIssure + "','" + data.OriginReturnCode + "','" + data.OriginDescrInfoForReturnCode + "','" + data.BankAccount + "','" + data.BankPassWord + "','" + data.AccountID + "','" + data.Password + "','" + data.CurrencyID + "','" + std::to_string(data.TradeAmount) + "','" + data.Digest
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.AccountID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& AccountID) {
return "SELECT * FROM 'CThostFtdcRspQueryTradeResultBySerialField' where BrokerID='" + BrokerID + "' and AccountID='" + AccountID + "';";
}
};
struct CThostFtdcReqDayEndFileReadyFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcReqDayEndFileReadyField data;
CThostFtdcReqDayEndFileReadyFieldWrapper(const CThostFtdcReqDayEndFileReadyField& _data = { 0 }) :data(_data) { }
CThostFtdcReqDayEndFileReadyFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcReqDayEndFileReadyField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.TradeCode, rowValue.at("TradeCode").c_str(), sizeof(TThostFtdcTradeCodeType));
strncpy(data.BankID, rowValue.at("BankID").c_str(), sizeof(TThostFtdcBankIDType));
strncpy(data.BankBranchID, rowValue.at("BankBranchID").c_str(), sizeof(TThostFtdcBankBrchIDType));
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.BrokerBranchID, rowValue.at("BrokerBranchID").c_str(), sizeof(TThostFtdcFutureBranchIDType));
strncpy(data.TradeDate, rowValue.at("TradeDate").c_str(), sizeof(TThostFtdcTradeDateType));
strncpy(data.TradeTime, rowValue.at("TradeTime").c_str(), sizeof(TThostFtdcTradeTimeType));
strncpy(data.BankSerial, rowValue.at("BankSerial").c_str(), sizeof(TThostFtdcBankSerialType));
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcTradeDateType));
data.PlateSerial = std::stoi(rowValue.at("PlateSerial"));
data.LastFragment = rowValue.at("LastFragment").empty() ? '0' : rowValue.at("LastFragment")[0];
data.SessionID = std::stoi(rowValue.at("SessionID"));
data.FileBusinessCode = rowValue.at("FileBusinessCode").empty() ? '0' : rowValue.at("FileBusinessCode")[0];
strncpy(data.Digest, rowValue.at("Digest").c_str(), sizeof(TThostFtdcDigestType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.TradeCode + "','" + data.BankID + "','" + data.BankBranchID + "','" + data.BrokerID + "','" + data.BrokerBranchID + "','" + data.TradeDate + "','" + data.TradeTime + "','" + data.BankSerial + "','" + data.TradingDay + "','" + std::to_string(data.PlateSerial) + "','" + (data.LastFragment == 0 ? '0' : data.LastFragment) + "','" + std::to_string(data.SessionID) + "','" + (data.FileBusinessCode == 0 ? '0' : data.FileBusinessCode) + "','" + data.Digest
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcReturnResultFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcReturnResultField data;
CThostFtdcReturnResultFieldWrapper(const CThostFtdcReturnResultField& _data = { 0 }) :data(_data) { }
CThostFtdcReturnResultFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcReturnResultField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.ReturnCode, rowValue.at("ReturnCode").c_str(), sizeof(TThostFtdcReturnCodeType));
strncpy(data.DescrInfoForReturnCode, rowValue.at("DescrInfoForReturnCode").c_str(), sizeof(TThostFtdcDescrInfoForReturnCodeType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.ReturnCode + "','" + data.DescrInfoForReturnCode
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcVerifyFuturePasswordFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcVerifyFuturePasswordField data;
CThostFtdcVerifyFuturePasswordFieldWrapper(const CThostFtdcVerifyFuturePasswordField& _data = { 0 }) :data(_data) { }
CThostFtdcVerifyFuturePasswordFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcVerifyFuturePasswordField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.TradeCode, rowValue.at("TradeCode").c_str(), sizeof(TThostFtdcTradeCodeType));
strncpy(data.BankID, rowValue.at("BankID").c_str(), sizeof(TThostFtdcBankIDType));
strncpy(data.BankBranchID, rowValue.at("BankBranchID").c_str(), sizeof(TThostFtdcBankBrchIDType));
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.BrokerBranchID, rowValue.at("BrokerBranchID").c_str(), sizeof(TThostFtdcFutureBranchIDType));
strncpy(data.TradeDate, rowValue.at("TradeDate").c_str(), sizeof(TThostFtdcTradeDateType));
strncpy(data.TradeTime, rowValue.at("TradeTime").c_str(), sizeof(TThostFtdcTradeTimeType));
strncpy(data.BankSerial, rowValue.at("BankSerial").c_str(), sizeof(TThostFtdcBankSerialType));
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcTradeDateType));
data.PlateSerial = std::stoi(rowValue.at("PlateSerial"));
data.LastFragment = rowValue.at("LastFragment").empty() ? '0' : rowValue.at("LastFragment")[0];
data.SessionID = std::stoi(rowValue.at("SessionID"));
strncpy(data.AccountID, rowValue.at("AccountID").c_str(), sizeof(TThostFtdcAccountIDType));
strncpy(data.Password, rowValue.at("Password").c_str(), sizeof(TThostFtdcPasswordType));
strncpy(data.BankAccount, rowValue.at("BankAccount").c_str(), sizeof(TThostFtdcBankAccountType));
strncpy(data.BankPassWord, rowValue.at("BankPassWord").c_str(), sizeof(TThostFtdcPasswordType));
data.InstallID = std::stoi(rowValue.at("InstallID"));
data.TID = std::stoi(rowValue.at("TID"));
strncpy(data.CurrencyID, rowValue.at("CurrencyID").c_str(), sizeof(TThostFtdcCurrencyIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.TradeCode + "','" + data.BankID + "','" + data.BankBranchID + "','" + data.BrokerID + "','" + data.BrokerBranchID + "','" + data.TradeDate + "','" + data.TradeTime + "','" + data.BankSerial + "','" + data.TradingDay + "','" + std::to_string(data.PlateSerial) + "','" + (data.LastFragment == 0 ? '0' : data.LastFragment) + "','" + std::to_string(data.SessionID) + "','" + data.AccountID + "','" + data.Password + "','" + data.BankAccount + "','" + data.BankPassWord + "','" + std::to_string(data.InstallID) + "','" + std::to_string(data.TID) + "','" + data.CurrencyID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.AccountID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& AccountID) {
return "SELECT * FROM 'CThostFtdcVerifyFuturePasswordField' where BrokerID='" + BrokerID + "' and AccountID='" + AccountID + "';";
}
};
struct CThostFtdcVerifyCustInfoFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcVerifyCustInfoField data;
CThostFtdcVerifyCustInfoFieldWrapper(const CThostFtdcVerifyCustInfoField& _data = { 0 }) :data(_data) { }
CThostFtdcVerifyCustInfoFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcVerifyCustInfoField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.CustomerName, rowValue.at("CustomerName").c_str(), sizeof(TThostFtdcIndividualNameType));
data.IdCardType = rowValue.at("IdCardType").empty() ? '0' : rowValue.at("IdCardType")[0];
strncpy(data.IdentifiedCardNo, rowValue.at("IdentifiedCardNo").c_str(), sizeof(TThostFtdcIdentifiedCardNoType));
data.CustType = rowValue.at("CustType").empty() ? '0' : rowValue.at("CustType")[0];
strncpy(data.LongCustomerName, rowValue.at("LongCustomerName").c_str(), sizeof(TThostFtdcLongIndividualNameType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.CustomerName + "','" + (data.IdCardType == 0 ? '0' : data.IdCardType) + "','" + data.IdentifiedCardNo + "','" + (data.CustType == 0 ? '0' : data.CustType) + "','" + data.LongCustomerName
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcVerifyFuturePasswordAndCustInfoFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcVerifyFuturePasswordAndCustInfoField data;
CThostFtdcVerifyFuturePasswordAndCustInfoFieldWrapper(const CThostFtdcVerifyFuturePasswordAndCustInfoField& _data = { 0 }) :data(_data) { }
CThostFtdcVerifyFuturePasswordAndCustInfoFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcVerifyFuturePasswordAndCustInfoField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.CustomerName, rowValue.at("CustomerName").c_str(), sizeof(TThostFtdcIndividualNameType));
data.IdCardType = rowValue.at("IdCardType").empty() ? '0' : rowValue.at("IdCardType")[0];
strncpy(data.IdentifiedCardNo, rowValue.at("IdentifiedCardNo").c_str(), sizeof(TThostFtdcIdentifiedCardNoType));
data.CustType = rowValue.at("CustType").empty() ? '0' : rowValue.at("CustType")[0];
strncpy(data.AccountID, rowValue.at("AccountID").c_str(), sizeof(TThostFtdcAccountIDType));
strncpy(data.Password, rowValue.at("Password").c_str(), sizeof(TThostFtdcPasswordType));
strncpy(data.CurrencyID, rowValue.at("CurrencyID").c_str(), sizeof(TThostFtdcCurrencyIDType));
strncpy(data.LongCustomerName, rowValue.at("LongCustomerName").c_str(), sizeof(TThostFtdcLongIndividualNameType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.CustomerName + "','" + (data.IdCardType == 0 ? '0' : data.IdCardType) + "','" + data.IdentifiedCardNo + "','" + (data.CustType == 0 ? '0' : data.CustType) + "','" + data.AccountID + "','" + data.Password + "','" + data.CurrencyID + "','" + data.LongCustomerName
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcDepositResultInformFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcDepositResultInformField data;
CThostFtdcDepositResultInformFieldWrapper(const CThostFtdcDepositResultInformField& _data = { 0 }) :data(_data) { }
CThostFtdcDepositResultInformFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcDepositResultInformField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.DepositSeqNo, rowValue.at("DepositSeqNo").c_str(), sizeof(TThostFtdcDepositSeqNoType));
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
data.Deposit = std::stod(rowValue.at("Deposit"));
data.RequestID = std::stoi(rowValue.at("RequestID"));
strncpy(data.ReturnCode, rowValue.at("ReturnCode").c_str(), sizeof(TThostFtdcReturnCodeType));
strncpy(data.DescrInfoForReturnCode, rowValue.at("DescrInfoForReturnCode").c_str(), sizeof(TThostFtdcDescrInfoForReturnCodeType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.DepositSeqNo + "','" + data.BrokerID + "','" + data.InvestorID + "','" + std::to_string(data.Deposit) + "','" + std::to_string(data.RequestID) + "','" + data.ReturnCode + "','" + data.DescrInfoForReturnCode
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcDepositResultInformField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcReqSyncKeyFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcReqSyncKeyField data;
CThostFtdcReqSyncKeyFieldWrapper(const CThostFtdcReqSyncKeyField& _data = { 0 }) :data(_data) { }
CThostFtdcReqSyncKeyFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcReqSyncKeyField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.TradeCode, rowValue.at("TradeCode").c_str(), sizeof(TThostFtdcTradeCodeType));
strncpy(data.BankID, rowValue.at("BankID").c_str(), sizeof(TThostFtdcBankIDType));
strncpy(data.BankBranchID, rowValue.at("BankBranchID").c_str(), sizeof(TThostFtdcBankBrchIDType));
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.BrokerBranchID, rowValue.at("BrokerBranchID").c_str(), sizeof(TThostFtdcFutureBranchIDType));
strncpy(data.TradeDate, rowValue.at("TradeDate").c_str(), sizeof(TThostFtdcTradeDateType));
strncpy(data.TradeTime, rowValue.at("TradeTime").c_str(), sizeof(TThostFtdcTradeTimeType));
strncpy(data.BankSerial, rowValue.at("BankSerial").c_str(), sizeof(TThostFtdcBankSerialType));
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcTradeDateType));
data.PlateSerial = std::stoi(rowValue.at("PlateSerial"));
data.LastFragment = rowValue.at("LastFragment").empty() ? '0' : rowValue.at("LastFragment")[0];
data.SessionID = std::stoi(rowValue.at("SessionID"));
data.InstallID = std::stoi(rowValue.at("InstallID"));
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
strncpy(data.Message, rowValue.at("Message").c_str(), sizeof(TThostFtdcAddInfoType));
strncpy(data.DeviceID, rowValue.at("DeviceID").c_str(), sizeof(TThostFtdcDeviceIDType));
strncpy(data.BrokerIDByBank, rowValue.at("BrokerIDByBank").c_str(), sizeof(TThostFtdcBankCodingForFutureType));
strncpy(data.OperNo, rowValue.at("OperNo").c_str(), sizeof(TThostFtdcOperNoType));
data.RequestID = std::stoi(rowValue.at("RequestID"));
data.TID = std::stoi(rowValue.at("TID"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.TradeCode + "','" + data.BankID + "','" + data.BankBranchID + "','" + data.BrokerID + "','" + data.BrokerBranchID + "','" + data.TradeDate + "','" + data.TradeTime + "','" + data.BankSerial + "','" + data.TradingDay + "','" + std::to_string(data.PlateSerial) + "','" + (data.LastFragment == 0 ? '0' : data.LastFragment) + "','" + std::to_string(data.SessionID) + "','" + std::to_string(data.InstallID) + "','" + data.UserID + "','" + data.Message + "','" + data.DeviceID + "','" + data.BrokerIDByBank + "','" + data.OperNo + "','" + std::to_string(data.RequestID) + "','" + std::to_string(data.TID)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.UserID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& UserID) {
return "SELECT * FROM 'CThostFtdcReqSyncKeyField' where BrokerID='" + BrokerID + "' and UserID='" + UserID + "';";
}
};
struct CThostFtdcRspSyncKeyFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcRspSyncKeyField data;
CThostFtdcRspSyncKeyFieldWrapper(const CThostFtdcRspSyncKeyField& _data = { 0 }) :data(_data) { }
CThostFtdcRspSyncKeyFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcRspSyncKeyField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.TradeCode, rowValue.at("TradeCode").c_str(), sizeof(TThostFtdcTradeCodeType));
strncpy(data.BankID, rowValue.at("BankID").c_str(), sizeof(TThostFtdcBankIDType));
strncpy(data.BankBranchID, rowValue.at("BankBranchID").c_str(), sizeof(TThostFtdcBankBrchIDType));
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.BrokerBranchID, rowValue.at("BrokerBranchID").c_str(), sizeof(TThostFtdcFutureBranchIDType));
strncpy(data.TradeDate, rowValue.at("TradeDate").c_str(), sizeof(TThostFtdcTradeDateType));
strncpy(data.TradeTime, rowValue.at("TradeTime").c_str(), sizeof(TThostFtdcTradeTimeType));
strncpy(data.BankSerial, rowValue.at("BankSerial").c_str(), sizeof(TThostFtdcBankSerialType));
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcTradeDateType));
data.PlateSerial = std::stoi(rowValue.at("PlateSerial"));
data.LastFragment = rowValue.at("LastFragment").empty() ? '0' : rowValue.at("LastFragment")[0];
data.SessionID = std::stoi(rowValue.at("SessionID"));
data.InstallID = std::stoi(rowValue.at("InstallID"));
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
strncpy(data.Message, rowValue.at("Message").c_str(), sizeof(TThostFtdcAddInfoType));
strncpy(data.DeviceID, rowValue.at("DeviceID").c_str(), sizeof(TThostFtdcDeviceIDType));
strncpy(data.BrokerIDByBank, rowValue.at("BrokerIDByBank").c_str(), sizeof(TThostFtdcBankCodingForFutureType));
strncpy(data.OperNo, rowValue.at("OperNo").c_str(), sizeof(TThostFtdcOperNoType));
data.RequestID = std::stoi(rowValue.at("RequestID"));
data.TID = std::stoi(rowValue.at("TID"));
data.ErrorID = std::stoi(rowValue.at("ErrorID"));
strncpy(data.ErrorMsg, utf8_to_gbk(rowValue.at("ErrorMsg")).c_str(), sizeof(TThostFtdcErrorMsgType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.TradeCode + "','" + data.BankID + "','" + data.BankBranchID + "','" + data.BrokerID + "','" + data.BrokerBranchID + "','" + data.TradeDate + "','" + data.TradeTime + "','" + data.BankSerial + "','" + data.TradingDay + "','" + std::to_string(data.PlateSerial) + "','" + (data.LastFragment == 0 ? '0' : data.LastFragment) + "','" + std::to_string(data.SessionID) + "','" + std::to_string(data.InstallID) + "','" + data.UserID + "','" + data.Message + "','" + data.DeviceID + "','" + data.BrokerIDByBank + "','" + data.OperNo + "','" + std::to_string(data.RequestID) + "','" + std::to_string(data.TID) + "','" + std::to_string(data.ErrorID) + "','" + gbk_to_utf8(data.ErrorMsg)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.UserID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& UserID) {
return "SELECT * FROM 'CThostFtdcRspSyncKeyField' where BrokerID='" + BrokerID + "' and UserID='" + UserID + "';";
}
};
struct CThostFtdcNotifyQueryAccountFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcNotifyQueryAccountField data;
CThostFtdcNotifyQueryAccountFieldWrapper(const CThostFtdcNotifyQueryAccountField& _data = { 0 }) :data(_data) { }
CThostFtdcNotifyQueryAccountFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcNotifyQueryAccountField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.TradeCode, rowValue.at("TradeCode").c_str(), sizeof(TThostFtdcTradeCodeType));
strncpy(data.BankID, rowValue.at("BankID").c_str(), sizeof(TThostFtdcBankIDType));
strncpy(data.BankBranchID, rowValue.at("BankBranchID").c_str(), sizeof(TThostFtdcBankBrchIDType));
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.BrokerBranchID, rowValue.at("BrokerBranchID").c_str(), sizeof(TThostFtdcFutureBranchIDType));
strncpy(data.TradeDate, rowValue.at("TradeDate").c_str(), sizeof(TThostFtdcTradeDateType));
strncpy(data.TradeTime, rowValue.at("TradeTime").c_str(), sizeof(TThostFtdcTradeTimeType));
strncpy(data.BankSerial, rowValue.at("BankSerial").c_str(), sizeof(TThostFtdcBankSerialType));
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcTradeDateType));
data.PlateSerial = std::stoi(rowValue.at("PlateSerial"));
data.LastFragment = rowValue.at("LastFragment").empty() ? '0' : rowValue.at("LastFragment")[0];
data.SessionID = std::stoi(rowValue.at("SessionID"));
strncpy(data.CustomerName, rowValue.at("CustomerName").c_str(), sizeof(TThostFtdcIndividualNameType));
data.IdCardType = rowValue.at("IdCardType").empty() ? '0' : rowValue.at("IdCardType")[0];
strncpy(data.IdentifiedCardNo, rowValue.at("IdentifiedCardNo").c_str(), sizeof(TThostFtdcIdentifiedCardNoType));
data.CustType = rowValue.at("CustType").empty() ? '0' : rowValue.at("CustType")[0];
strncpy(data.BankAccount, rowValue.at("BankAccount").c_str(), sizeof(TThostFtdcBankAccountType));
strncpy(data.BankPassWord, rowValue.at("BankPassWord").c_str(), sizeof(TThostFtdcPasswordType));
strncpy(data.AccountID, rowValue.at("AccountID").c_str(), sizeof(TThostFtdcAccountIDType));
strncpy(data.Password, rowValue.at("Password").c_str(), sizeof(TThostFtdcPasswordType));
data.FutureSerial = std::stoi(rowValue.at("FutureSerial"));
data.InstallID = std::stoi(rowValue.at("InstallID"));
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
data.VerifyCertNoFlag = rowValue.at("VerifyCertNoFlag").empty() ? '0' : rowValue.at("VerifyCertNoFlag")[0];
strncpy(data.CurrencyID, rowValue.at("CurrencyID").c_str(), sizeof(TThostFtdcCurrencyIDType));
strncpy(data.Digest, rowValue.at("Digest").c_str(), sizeof(TThostFtdcDigestType));
data.BankAccType = rowValue.at("BankAccType").empty() ? '0' : rowValue.at("BankAccType")[0];
strncpy(data.DeviceID, rowValue.at("DeviceID").c_str(), sizeof(TThostFtdcDeviceIDType));
data.BankSecuAccType = rowValue.at("BankSecuAccType").empty() ? '0' : rowValue.at("BankSecuAccType")[0];
strncpy(data.BrokerIDByBank, rowValue.at("BrokerIDByBank").c_str(), sizeof(TThostFtdcBankCodingForFutureType));
strncpy(data.BankSecuAcc, rowValue.at("BankSecuAcc").c_str(), sizeof(TThostFtdcBankAccountType));
data.BankPwdFlag = rowValue.at("BankPwdFlag").empty() ? '0' : rowValue.at("BankPwdFlag")[0];
data.SecuPwdFlag = rowValue.at("SecuPwdFlag").empty() ? '0' : rowValue.at("SecuPwdFlag")[0];
strncpy(data.OperNo, rowValue.at("OperNo").c_str(), sizeof(TThostFtdcOperNoType));
data.RequestID = std::stoi(rowValue.at("RequestID"));
data.TID = std::stoi(rowValue.at("TID"));
data.BankUseAmount = std::stod(rowValue.at("BankUseAmount"));
data.BankFetchAmount = std::stod(rowValue.at("BankFetchAmount"));
data.ErrorID = std::stoi(rowValue.at("ErrorID"));
strncpy(data.ErrorMsg, utf8_to_gbk(rowValue.at("ErrorMsg")).c_str(), sizeof(TThostFtdcErrorMsgType));
strncpy(data.LongCustomerName, rowValue.at("LongCustomerName").c_str(), sizeof(TThostFtdcLongIndividualNameType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.TradeCode + "','" + data.BankID + "','" + data.BankBranchID + "','" + data.BrokerID + "','" + data.BrokerBranchID + "','" + data.TradeDate + "','" + data.TradeTime + "','" + data.BankSerial + "','" + data.TradingDay + "','" + std::to_string(data.PlateSerial) + "','" + (data.LastFragment == 0 ? '0' : data.LastFragment) + "','" + std::to_string(data.SessionID) + "','" + data.CustomerName + "','" + (data.IdCardType == 0 ? '0' : data.IdCardType) + "','" + data.IdentifiedCardNo + "','" + (data.CustType == 0 ? '0' : data.CustType) + "','" + data.BankAccount + "','" + data.BankPassWord + "','" + data.AccountID + "','" + data.Password + "','" + std::to_string(data.FutureSerial) + "','" + std::to_string(data.InstallID) + "','" + data.UserID + "','" + (data.VerifyCertNoFlag == 0 ? '0' : data.VerifyCertNoFlag) + "','" + data.CurrencyID + "','" + data.Digest + "','" + (data.BankAccType == 0 ? '0' : data.BankAccType) + "','" + data.DeviceID + "','" + (data.BankSecuAccType == 0 ? '0' : data.BankSecuAccType) + "','" + data.BrokerIDByBank + "','" + data.BankSecuAcc + "','" + (data.BankPwdFlag == 0 ? '0' : data.BankPwdFlag) + "','" + (data.SecuPwdFlag == 0 ? '0' : data.SecuPwdFlag) + "','" + data.OperNo + "','" + std::to_string(data.RequestID) + "','" + std::to_string(data.TID) + "','" + std::to_string(data.BankUseAmount) + "','" + std::to_string(data.BankFetchAmount) + "','" + std::to_string(data.ErrorID) + "','" + gbk_to_utf8(data.ErrorMsg) + "','" + data.LongCustomerName
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.AccountID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& AccountID) {
return "SELECT * FROM 'CThostFtdcNotifyQueryAccountField' where BrokerID='" + BrokerID + "' and AccountID='" + AccountID + "';";
}
};
struct CThostFtdcTransferSerialFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcTransferSerialField data;
CThostFtdcTransferSerialFieldWrapper(const CThostFtdcTransferSerialField& _data = { 0 }) :data(_data) { }
CThostFtdcTransferSerialFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcTransferSerialField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
data.PlateSerial = std::stoi(rowValue.at("PlateSerial"));
strncpy(data.TradeDate, rowValue.at("TradeDate").c_str(), sizeof(TThostFtdcTradeDateType));
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.TradeTime, rowValue.at("TradeTime").c_str(), sizeof(TThostFtdcTradeTimeType));
strncpy(data.TradeCode, rowValue.at("TradeCode").c_str(), sizeof(TThostFtdcTradeCodeType));
data.SessionID = std::stoi(rowValue.at("SessionID"));
strncpy(data.BankID, rowValue.at("BankID").c_str(), sizeof(TThostFtdcBankIDType));
strncpy(data.BankBranchID, rowValue.at("BankBranchID").c_str(), sizeof(TThostFtdcBankBrchIDType));
data.BankAccType = rowValue.at("BankAccType").empty() ? '0' : rowValue.at("BankAccType")[0];
strncpy(data.BankAccount, rowValue.at("BankAccount").c_str(), sizeof(TThostFtdcBankAccountType));
strncpy(data.BankSerial, rowValue.at("BankSerial").c_str(), sizeof(TThostFtdcBankSerialType));
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.BrokerBranchID, rowValue.at("BrokerBranchID").c_str(), sizeof(TThostFtdcFutureBranchIDType));
data.FutureAccType = rowValue.at("FutureAccType").empty() ? '0' : rowValue.at("FutureAccType")[0];
strncpy(data.AccountID, rowValue.at("AccountID").c_str(), sizeof(TThostFtdcAccountIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
data.FutureSerial = std::stoi(rowValue.at("FutureSerial"));
data.IdCardType = rowValue.at("IdCardType").empty() ? '0' : rowValue.at("IdCardType")[0];
strncpy(data.IdentifiedCardNo, rowValue.at("IdentifiedCardNo").c_str(), sizeof(TThostFtdcIdentifiedCardNoType));
strncpy(data.CurrencyID, rowValue.at("CurrencyID").c_str(), sizeof(TThostFtdcCurrencyIDType));
data.TradeAmount = std::stod(rowValue.at("TradeAmount"));
data.CustFee = std::stod(rowValue.at("CustFee"));
data.BrokerFee = std::stod(rowValue.at("BrokerFee"));
data.AvailabilityFlag = rowValue.at("AvailabilityFlag").empty() ? '0' : rowValue.at("AvailabilityFlag")[0];
strncpy(data.OperatorCode, rowValue.at("OperatorCode").c_str(), sizeof(TThostFtdcOperatorCodeType));
strncpy(data.BankNewAccount, rowValue.at("BankNewAccount").c_str(), sizeof(TThostFtdcBankAccountType));
data.ErrorID = std::stoi(rowValue.at("ErrorID"));
strncpy(data.ErrorMsg, utf8_to_gbk(rowValue.at("ErrorMsg")).c_str(), sizeof(TThostFtdcErrorMsgType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
std::to_string(data.PlateSerial) + "','" + data.TradeDate + "','" + data.TradingDay + "','" + data.TradeTime + "','" + data.TradeCode + "','" + std::to_string(data.SessionID) + "','" + data.BankID + "','" + data.BankBranchID + "','" + (data.BankAccType == 0 ? '0' : data.BankAccType) + "','" + data.BankAccount + "','" + data.BankSerial + "','" + data.BrokerID + "','" + data.BrokerBranchID + "','" + (data.FutureAccType == 0 ? '0' : data.FutureAccType) + "','" + data.AccountID + "','" + data.InvestorID + "','" + std::to_string(data.FutureSerial) + "','" + (data.IdCardType == 0 ? '0' : data.IdCardType) + "','" + data.IdentifiedCardNo + "','" + data.CurrencyID + "','" + std::to_string(data.TradeAmount) + "','" + std::to_string(data.CustFee) + "','" + std::to_string(data.BrokerFee) + "','" + (data.AvailabilityFlag == 0 ? '0' : data.AvailabilityFlag) + "','" + data.OperatorCode + "','" + data.BankNewAccount + "','" + std::to_string(data.ErrorID) + "','" + gbk_to_utf8(data.ErrorMsg)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcTransferSerialField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcQryTransferSerialFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryTransferSerialField data;
CThostFtdcQryTransferSerialFieldWrapper(const CThostFtdcQryTransferSerialField& _data = { 0 }) :data(_data) { }
CThostFtdcQryTransferSerialFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryTransferSerialField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.AccountID, rowValue.at("AccountID").c_str(), sizeof(TThostFtdcAccountIDType));
strncpy(data.BankID, rowValue.at("BankID").c_str(), sizeof(TThostFtdcBankIDType));
strncpy(data.CurrencyID, rowValue.at("CurrencyID").c_str(), sizeof(TThostFtdcCurrencyIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.AccountID + "','" + data.BankID + "','" + data.CurrencyID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.AccountID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& AccountID) {
return "SELECT * FROM 'CThostFtdcQryTransferSerialField' where BrokerID='" + BrokerID + "' and AccountID='" + AccountID + "';";
}
};
struct CThostFtdcNotifyFutureSignInFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcNotifyFutureSignInField data;
CThostFtdcNotifyFutureSignInFieldWrapper(const CThostFtdcNotifyFutureSignInField& _data = { 0 }) :data(_data) { }
CThostFtdcNotifyFutureSignInFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcNotifyFutureSignInField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.TradeCode, rowValue.at("TradeCode").c_str(), sizeof(TThostFtdcTradeCodeType));
strncpy(data.BankID, rowValue.at("BankID").c_str(), sizeof(TThostFtdcBankIDType));
strncpy(data.BankBranchID, rowValue.at("BankBranchID").c_str(), sizeof(TThostFtdcBankBrchIDType));
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.BrokerBranchID, rowValue.at("BrokerBranchID").c_str(), sizeof(TThostFtdcFutureBranchIDType));
strncpy(data.TradeDate, rowValue.at("TradeDate").c_str(), sizeof(TThostFtdcTradeDateType));
strncpy(data.TradeTime, rowValue.at("TradeTime").c_str(), sizeof(TThostFtdcTradeTimeType));
strncpy(data.BankSerial, rowValue.at("BankSerial").c_str(), sizeof(TThostFtdcBankSerialType));
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcTradeDateType));
data.PlateSerial = std::stoi(rowValue.at("PlateSerial"));
data.LastFragment = rowValue.at("LastFragment").empty() ? '0' : rowValue.at("LastFragment")[0];
data.SessionID = std::stoi(rowValue.at("SessionID"));
data.InstallID = std::stoi(rowValue.at("InstallID"));
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
strncpy(data.Digest, rowValue.at("Digest").c_str(), sizeof(TThostFtdcDigestType));
strncpy(data.CurrencyID, rowValue.at("CurrencyID").c_str(), sizeof(TThostFtdcCurrencyIDType));
strncpy(data.DeviceID, rowValue.at("DeviceID").c_str(), sizeof(TThostFtdcDeviceIDType));
strncpy(data.BrokerIDByBank, rowValue.at("BrokerIDByBank").c_str(), sizeof(TThostFtdcBankCodingForFutureType));
strncpy(data.OperNo, rowValue.at("OperNo").c_str(), sizeof(TThostFtdcOperNoType));
data.RequestID = std::stoi(rowValue.at("RequestID"));
data.TID = std::stoi(rowValue.at("TID"));
data.ErrorID = std::stoi(rowValue.at("ErrorID"));
strncpy(data.ErrorMsg, utf8_to_gbk(rowValue.at("ErrorMsg")).c_str(), sizeof(TThostFtdcErrorMsgType));
strncpy(data.PinKey, rowValue.at("PinKey").c_str(), sizeof(TThostFtdcPasswordKeyType));
strncpy(data.MacKey, rowValue.at("MacKey").c_str(), sizeof(TThostFtdcPasswordKeyType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.TradeCode + "','" + data.BankID + "','" + data.BankBranchID + "','" + data.BrokerID + "','" + data.BrokerBranchID + "','" + data.TradeDate + "','" + data.TradeTime + "','" + data.BankSerial + "','" + data.TradingDay + "','" + std::to_string(data.PlateSerial) + "','" + (data.LastFragment == 0 ? '0' : data.LastFragment) + "','" + std::to_string(data.SessionID) + "','" + std::to_string(data.InstallID) + "','" + data.UserID + "','" + data.Digest + "','" + data.CurrencyID + "','" + data.DeviceID + "','" + data.BrokerIDByBank + "','" + data.OperNo + "','" + std::to_string(data.RequestID) + "','" + std::to_string(data.TID) + "','" + std::to_string(data.ErrorID) + "','" + gbk_to_utf8(data.ErrorMsg) + "','" + data.PinKey + "','" + data.MacKey
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.UserID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& UserID) {
return "SELECT * FROM 'CThostFtdcNotifyFutureSignInField' where BrokerID='" + BrokerID + "' and UserID='" + UserID + "';";
}
};
struct CThostFtdcNotifyFutureSignOutFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcNotifyFutureSignOutField data;
CThostFtdcNotifyFutureSignOutFieldWrapper(const CThostFtdcNotifyFutureSignOutField& _data = { 0 }) :data(_data) { }
CThostFtdcNotifyFutureSignOutFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcNotifyFutureSignOutField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.TradeCode, rowValue.at("TradeCode").c_str(), sizeof(TThostFtdcTradeCodeType));
strncpy(data.BankID, rowValue.at("BankID").c_str(), sizeof(TThostFtdcBankIDType));
strncpy(data.BankBranchID, rowValue.at("BankBranchID").c_str(), sizeof(TThostFtdcBankBrchIDType));
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.BrokerBranchID, rowValue.at("BrokerBranchID").c_str(), sizeof(TThostFtdcFutureBranchIDType));
strncpy(data.TradeDate, rowValue.at("TradeDate").c_str(), sizeof(TThostFtdcTradeDateType));
strncpy(data.TradeTime, rowValue.at("TradeTime").c_str(), sizeof(TThostFtdcTradeTimeType));
strncpy(data.BankSerial, rowValue.at("BankSerial").c_str(), sizeof(TThostFtdcBankSerialType));
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcTradeDateType));
data.PlateSerial = std::stoi(rowValue.at("PlateSerial"));
data.LastFragment = rowValue.at("LastFragment").empty() ? '0' : rowValue.at("LastFragment")[0];
data.SessionID = std::stoi(rowValue.at("SessionID"));
data.InstallID = std::stoi(rowValue.at("InstallID"));
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
strncpy(data.Digest, rowValue.at("Digest").c_str(), sizeof(TThostFtdcDigestType));
strncpy(data.CurrencyID, rowValue.at("CurrencyID").c_str(), sizeof(TThostFtdcCurrencyIDType));
strncpy(data.DeviceID, rowValue.at("DeviceID").c_str(), sizeof(TThostFtdcDeviceIDType));
strncpy(data.BrokerIDByBank, rowValue.at("BrokerIDByBank").c_str(), sizeof(TThostFtdcBankCodingForFutureType));
strncpy(data.OperNo, rowValue.at("OperNo").c_str(), sizeof(TThostFtdcOperNoType));
data.RequestID = std::stoi(rowValue.at("RequestID"));
data.TID = std::stoi(rowValue.at("TID"));
data.ErrorID = std::stoi(rowValue.at("ErrorID"));
strncpy(data.ErrorMsg, utf8_to_gbk(rowValue.at("ErrorMsg")).c_str(), sizeof(TThostFtdcErrorMsgType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.TradeCode + "','" + data.BankID + "','" + data.BankBranchID + "','" + data.BrokerID + "','" + data.BrokerBranchID + "','" + data.TradeDate + "','" + data.TradeTime + "','" + data.BankSerial + "','" + data.TradingDay + "','" + std::to_string(data.PlateSerial) + "','" + (data.LastFragment == 0 ? '0' : data.LastFragment) + "','" + std::to_string(data.SessionID) + "','" + std::to_string(data.InstallID) + "','" + data.UserID + "','" + data.Digest + "','" + data.CurrencyID + "','" + data.DeviceID + "','" + data.BrokerIDByBank + "','" + data.OperNo + "','" + std::to_string(data.RequestID) + "','" + std::to_string(data.TID) + "','" + std::to_string(data.ErrorID) + "','" + gbk_to_utf8(data.ErrorMsg)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.UserID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& UserID) {
return "SELECT * FROM 'CThostFtdcNotifyFutureSignOutField' where BrokerID='" + BrokerID + "' and UserID='" + UserID + "';";
}
};
struct CThostFtdcNotifySyncKeyFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcNotifySyncKeyField data;
CThostFtdcNotifySyncKeyFieldWrapper(const CThostFtdcNotifySyncKeyField& _data = { 0 }) :data(_data) { }
CThostFtdcNotifySyncKeyFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcNotifySyncKeyField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.TradeCode, rowValue.at("TradeCode").c_str(), sizeof(TThostFtdcTradeCodeType));
strncpy(data.BankID, rowValue.at("BankID").c_str(), sizeof(TThostFtdcBankIDType));
strncpy(data.BankBranchID, rowValue.at("BankBranchID").c_str(), sizeof(TThostFtdcBankBrchIDType));
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.BrokerBranchID, rowValue.at("BrokerBranchID").c_str(), sizeof(TThostFtdcFutureBranchIDType));
strncpy(data.TradeDate, rowValue.at("TradeDate").c_str(), sizeof(TThostFtdcTradeDateType));
strncpy(data.TradeTime, rowValue.at("TradeTime").c_str(), sizeof(TThostFtdcTradeTimeType));
strncpy(data.BankSerial, rowValue.at("BankSerial").c_str(), sizeof(TThostFtdcBankSerialType));
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcTradeDateType));
data.PlateSerial = std::stoi(rowValue.at("PlateSerial"));
data.LastFragment = rowValue.at("LastFragment").empty() ? '0' : rowValue.at("LastFragment")[0];
data.SessionID = std::stoi(rowValue.at("SessionID"));
data.InstallID = std::stoi(rowValue.at("InstallID"));
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
strncpy(data.Message, rowValue.at("Message").c_str(), sizeof(TThostFtdcAddInfoType));
strncpy(data.DeviceID, rowValue.at("DeviceID").c_str(), sizeof(TThostFtdcDeviceIDType));
strncpy(data.BrokerIDByBank, rowValue.at("BrokerIDByBank").c_str(), sizeof(TThostFtdcBankCodingForFutureType));
strncpy(data.OperNo, rowValue.at("OperNo").c_str(), sizeof(TThostFtdcOperNoType));
data.RequestID = std::stoi(rowValue.at("RequestID"));
data.TID = std::stoi(rowValue.at("TID"));
data.ErrorID = std::stoi(rowValue.at("ErrorID"));
strncpy(data.ErrorMsg, utf8_to_gbk(rowValue.at("ErrorMsg")).c_str(), sizeof(TThostFtdcErrorMsgType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.TradeCode + "','" + data.BankID + "','" + data.BankBranchID + "','" + data.BrokerID + "','" + data.BrokerBranchID + "','" + data.TradeDate + "','" + data.TradeTime + "','" + data.BankSerial + "','" + data.TradingDay + "','" + std::to_string(data.PlateSerial) + "','" + (data.LastFragment == 0 ? '0' : data.LastFragment) + "','" + std::to_string(data.SessionID) + "','" + std::to_string(data.InstallID) + "','" + data.UserID + "','" + data.Message + "','" + data.DeviceID + "','" + data.BrokerIDByBank + "','" + data.OperNo + "','" + std::to_string(data.RequestID) + "','" + std::to_string(data.TID) + "','" + std::to_string(data.ErrorID) + "','" + gbk_to_utf8(data.ErrorMsg)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.UserID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& UserID) {
return "SELECT * FROM 'CThostFtdcNotifySyncKeyField' where BrokerID='" + BrokerID + "' and UserID='" + UserID + "';";
}
};
struct CThostFtdcQryAccountregisterFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryAccountregisterField data;
CThostFtdcQryAccountregisterFieldWrapper(const CThostFtdcQryAccountregisterField& _data = { 0 }) :data(_data) { }
CThostFtdcQryAccountregisterFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryAccountregisterField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.AccountID, rowValue.at("AccountID").c_str(), sizeof(TThostFtdcAccountIDType));
strncpy(data.BankID, rowValue.at("BankID").c_str(), sizeof(TThostFtdcBankIDType));
strncpy(data.BankBranchID, rowValue.at("BankBranchID").c_str(), sizeof(TThostFtdcBankBrchIDType));
strncpy(data.CurrencyID, rowValue.at("CurrencyID").c_str(), sizeof(TThostFtdcCurrencyIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.AccountID + "','" + data.BankID + "','" + data.BankBranchID + "','" + data.CurrencyID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.AccountID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& AccountID) {
return "SELECT * FROM 'CThostFtdcQryAccountregisterField' where BrokerID='" + BrokerID + "' and AccountID='" + AccountID + "';";
}
};
struct CThostFtdcAccountregisterFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcAccountregisterField data;
CThostFtdcAccountregisterFieldWrapper(const CThostFtdcAccountregisterField& _data = { 0 }) :data(_data) { }
CThostFtdcAccountregisterFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcAccountregisterField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.TradeDay, rowValue.at("TradeDay").c_str(), sizeof(TThostFtdcTradeDateType));
strncpy(data.BankID, rowValue.at("BankID").c_str(), sizeof(TThostFtdcBankIDType));
strncpy(data.BankBranchID, rowValue.at("BankBranchID").c_str(), sizeof(TThostFtdcBankBrchIDType));
strncpy(data.BankAccount, rowValue.at("BankAccount").c_str(), sizeof(TThostFtdcBankAccountType));
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.BrokerBranchID, rowValue.at("BrokerBranchID").c_str(), sizeof(TThostFtdcFutureBranchIDType));
strncpy(data.AccountID, rowValue.at("AccountID").c_str(), sizeof(TThostFtdcAccountIDType));
data.IdCardType = rowValue.at("IdCardType").empty() ? '0' : rowValue.at("IdCardType")[0];
strncpy(data.IdentifiedCardNo, rowValue.at("IdentifiedCardNo").c_str(), sizeof(TThostFtdcIdentifiedCardNoType));
strncpy(data.CustomerName, rowValue.at("CustomerName").c_str(), sizeof(TThostFtdcIndividualNameType));
strncpy(data.CurrencyID, rowValue.at("CurrencyID").c_str(), sizeof(TThostFtdcCurrencyIDType));
data.OpenOrDestroy = rowValue.at("OpenOrDestroy").empty() ? '0' : rowValue.at("OpenOrDestroy")[0];
strncpy(data.RegDate, rowValue.at("RegDate").c_str(), sizeof(TThostFtdcTradeDateType));
strncpy(data.OutDate, rowValue.at("OutDate").c_str(), sizeof(TThostFtdcTradeDateType));
data.TID = std::stoi(rowValue.at("TID"));
data.CustType = rowValue.at("CustType").empty() ? '0' : rowValue.at("CustType")[0];
data.BankAccType = rowValue.at("BankAccType").empty() ? '0' : rowValue.at("BankAccType")[0];
strncpy(data.LongCustomerName, rowValue.at("LongCustomerName").c_str(), sizeof(TThostFtdcLongIndividualNameType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.TradeDay + "','" + data.BankID + "','" + data.BankBranchID + "','" + data.BankAccount + "','" + data.BrokerID + "','" + data.BrokerBranchID + "','" + data.AccountID + "','" + (data.IdCardType == 0 ? '0' : data.IdCardType) + "','" + data.IdentifiedCardNo + "','" + data.CustomerName + "','" + data.CurrencyID + "','" + (data.OpenOrDestroy == 0 ? '0' : data.OpenOrDestroy) + "','" + data.RegDate + "','" + data.OutDate + "','" + std::to_string(data.TID) + "','" + (data.CustType == 0 ? '0' : data.CustType) + "','" + (data.BankAccType == 0 ? '0' : data.BankAccType) + "','" + data.LongCustomerName
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.AccountID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& AccountID) {
return "SELECT * FROM 'CThostFtdcAccountregisterField' where BrokerID='" + BrokerID + "' and AccountID='" + AccountID + "';";
}
};
struct CThostFtdcOpenAccountFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcOpenAccountField data;
CThostFtdcOpenAccountFieldWrapper(const CThostFtdcOpenAccountField& _data = { 0 }) :data(_data) { }
CThostFtdcOpenAccountFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcOpenAccountField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.TradeCode, rowValue.at("TradeCode").c_str(), sizeof(TThostFtdcTradeCodeType));
strncpy(data.BankID, rowValue.at("BankID").c_str(), sizeof(TThostFtdcBankIDType));
strncpy(data.BankBranchID, rowValue.at("BankBranchID").c_str(), sizeof(TThostFtdcBankBrchIDType));
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.BrokerBranchID, rowValue.at("BrokerBranchID").c_str(), sizeof(TThostFtdcFutureBranchIDType));
strncpy(data.TradeDate, rowValue.at("TradeDate").c_str(), sizeof(TThostFtdcTradeDateType));
strncpy(data.TradeTime, rowValue.at("TradeTime").c_str(), sizeof(TThostFtdcTradeTimeType));
strncpy(data.BankSerial, rowValue.at("BankSerial").c_str(), sizeof(TThostFtdcBankSerialType));
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcTradeDateType));
data.PlateSerial = std::stoi(rowValue.at("PlateSerial"));
data.LastFragment = rowValue.at("LastFragment").empty() ? '0' : rowValue.at("LastFragment")[0];
data.SessionID = std::stoi(rowValue.at("SessionID"));
strncpy(data.CustomerName, rowValue.at("CustomerName").c_str(), sizeof(TThostFtdcIndividualNameType));
data.IdCardType = rowValue.at("IdCardType").empty() ? '0' : rowValue.at("IdCardType")[0];
strncpy(data.IdentifiedCardNo, rowValue.at("IdentifiedCardNo").c_str(), sizeof(TThostFtdcIdentifiedCardNoType));
data.Gender = rowValue.at("Gender").empty() ? '0' : rowValue.at("Gender")[0];
strncpy(data.CountryCode, rowValue.at("CountryCode").c_str(), sizeof(TThostFtdcCountryCodeType));
data.CustType = rowValue.at("CustType").empty() ? '0' : rowValue.at("CustType")[0];
strncpy(data.Address, rowValue.at("Address").c_str(), sizeof(TThostFtdcAddressType));
strncpy(data.ZipCode, rowValue.at("ZipCode").c_str(), sizeof(TThostFtdcZipCodeType));
strncpy(data.Telephone, rowValue.at("Telephone").c_str(), sizeof(TThostFtdcTelephoneType));
strncpy(data.MobilePhone, rowValue.at("MobilePhone").c_str(), sizeof(TThostFtdcMobilePhoneType));
strncpy(data.Fax, rowValue.at("Fax").c_str(), sizeof(TThostFtdcFaxType));
strncpy(data.EMail, rowValue.at("EMail").c_str(), sizeof(TThostFtdcEMailType));
data.MoneyAccountStatus = rowValue.at("MoneyAccountStatus").empty() ? '0' : rowValue.at("MoneyAccountStatus")[0];
strncpy(data.BankAccount, rowValue.at("BankAccount").c_str(), sizeof(TThostFtdcBankAccountType));
strncpy(data.BankPassWord, rowValue.at("BankPassWord").c_str(), sizeof(TThostFtdcPasswordType));
strncpy(data.AccountID, rowValue.at("AccountID").c_str(), sizeof(TThostFtdcAccountIDType));
strncpy(data.Password, rowValue.at("Password").c_str(), sizeof(TThostFtdcPasswordType));
data.InstallID = std::stoi(rowValue.at("InstallID"));
data.VerifyCertNoFlag = rowValue.at("VerifyCertNoFlag").empty() ? '0' : rowValue.at("VerifyCertNoFlag")[0];
strncpy(data.CurrencyID, rowValue.at("CurrencyID").c_str(), sizeof(TThostFtdcCurrencyIDType));
data.CashExchangeCode = rowValue.at("CashExchangeCode").empty() ? '0' : rowValue.at("CashExchangeCode")[0];
strncpy(data.Digest, rowValue.at("Digest").c_str(), sizeof(TThostFtdcDigestType));
data.BankAccType = rowValue.at("BankAccType").empty() ? '0' : rowValue.at("BankAccType")[0];
strncpy(data.DeviceID, rowValue.at("DeviceID").c_str(), sizeof(TThostFtdcDeviceIDType));
data.BankSecuAccType = rowValue.at("BankSecuAccType").empty() ? '0' : rowValue.at("BankSecuAccType")[0];
strncpy(data.BrokerIDByBank, rowValue.at("BrokerIDByBank").c_str(), sizeof(TThostFtdcBankCodingForFutureType));
strncpy(data.BankSecuAcc, rowValue.at("BankSecuAcc").c_str(), sizeof(TThostFtdcBankAccountType));
data.BankPwdFlag = rowValue.at("BankPwdFlag").empty() ? '0' : rowValue.at("BankPwdFlag")[0];
data.SecuPwdFlag = rowValue.at("SecuPwdFlag").empty() ? '0' : rowValue.at("SecuPwdFlag")[0];
strncpy(data.OperNo, rowValue.at("OperNo").c_str(), sizeof(TThostFtdcOperNoType));
data.TID = std::stoi(rowValue.at("TID"));
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
data.ErrorID = std::stoi(rowValue.at("ErrorID"));
strncpy(data.ErrorMsg, utf8_to_gbk(rowValue.at("ErrorMsg")).c_str(), sizeof(TThostFtdcErrorMsgType));
strncpy(data.LongCustomerName, rowValue.at("LongCustomerName").c_str(), sizeof(TThostFtdcLongIndividualNameType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.TradeCode + "','" + data.BankID + "','" + data.BankBranchID + "','" + data.BrokerID + "','" + data.BrokerBranchID + "','" + data.TradeDate + "','" + data.TradeTime + "','" + data.BankSerial + "','" + data.TradingDay + "','" + std::to_string(data.PlateSerial) + "','" + (data.LastFragment == 0 ? '0' : data.LastFragment) + "','" + std::to_string(data.SessionID) + "','" + data.CustomerName + "','" + (data.IdCardType == 0 ? '0' : data.IdCardType) + "','" + data.IdentifiedCardNo + "','" + (data.Gender == 0 ? '0' : data.Gender) + "','" + data.CountryCode + "','" + (data.CustType == 0 ? '0' : data.CustType) + "','" + data.Address + "','" + data.ZipCode + "','" + data.Telephone + "','" + data.MobilePhone + "','" + data.Fax + "','" + data.EMail + "','" + (data.MoneyAccountStatus == 0 ? '0' : data.MoneyAccountStatus) + "','" + data.BankAccount + "','" + data.BankPassWord + "','" + data.AccountID + "','" + data.Password + "','" + std::to_string(data.InstallID) + "','" + (data.VerifyCertNoFlag == 0 ? '0' : data.VerifyCertNoFlag) + "','" + data.CurrencyID + "','" + (data.CashExchangeCode == 0 ? '0' : data.CashExchangeCode) + "','" + data.Digest + "','" + (data.BankAccType == 0 ? '0' : data.BankAccType) + "','" + data.DeviceID + "','" + (data.BankSecuAccType == 0 ? '0' : data.BankSecuAccType) + "','" + data.BrokerIDByBank + "','" + data.BankSecuAcc + "','" + (data.BankPwdFlag == 0 ? '0' : data.BankPwdFlag) + "','" + (data.SecuPwdFlag == 0 ? '0' : data.SecuPwdFlag) + "','" + data.OperNo + "','" + std::to_string(data.TID) + "','" + data.UserID + "','" + std::to_string(data.ErrorID) + "','" + gbk_to_utf8(data.ErrorMsg) + "','" + data.LongCustomerName
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.AccountID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& AccountID) {
return "SELECT * FROM 'CThostFtdcOpenAccountField' where BrokerID='" + BrokerID + "' and AccountID='" + AccountID + "';";
}
};
struct CThostFtdcCancelAccountFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcCancelAccountField data;
CThostFtdcCancelAccountFieldWrapper(const CThostFtdcCancelAccountField& _data = { 0 }) :data(_data) { }
CThostFtdcCancelAccountFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcCancelAccountField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.TradeCode, rowValue.at("TradeCode").c_str(), sizeof(TThostFtdcTradeCodeType));
strncpy(data.BankID, rowValue.at("BankID").c_str(), sizeof(TThostFtdcBankIDType));
strncpy(data.BankBranchID, rowValue.at("BankBranchID").c_str(), sizeof(TThostFtdcBankBrchIDType));
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.BrokerBranchID, rowValue.at("BrokerBranchID").c_str(), sizeof(TThostFtdcFutureBranchIDType));
strncpy(data.TradeDate, rowValue.at("TradeDate").c_str(), sizeof(TThostFtdcTradeDateType));
strncpy(data.TradeTime, rowValue.at("TradeTime").c_str(), sizeof(TThostFtdcTradeTimeType));
strncpy(data.BankSerial, rowValue.at("BankSerial").c_str(), sizeof(TThostFtdcBankSerialType));
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcTradeDateType));
data.PlateSerial = std::stoi(rowValue.at("PlateSerial"));
data.LastFragment = rowValue.at("LastFragment").empty() ? '0' : rowValue.at("LastFragment")[0];
data.SessionID = std::stoi(rowValue.at("SessionID"));
strncpy(data.CustomerName, rowValue.at("CustomerName").c_str(), sizeof(TThostFtdcIndividualNameType));
data.IdCardType = rowValue.at("IdCardType").empty() ? '0' : rowValue.at("IdCardType")[0];
strncpy(data.IdentifiedCardNo, rowValue.at("IdentifiedCardNo").c_str(), sizeof(TThostFtdcIdentifiedCardNoType));
data.Gender = rowValue.at("Gender").empty() ? '0' : rowValue.at("Gender")[0];
strncpy(data.CountryCode, rowValue.at("CountryCode").c_str(), sizeof(TThostFtdcCountryCodeType));
data.CustType = rowValue.at("CustType").empty() ? '0' : rowValue.at("CustType")[0];
strncpy(data.Address, rowValue.at("Address").c_str(), sizeof(TThostFtdcAddressType));
strncpy(data.ZipCode, rowValue.at("ZipCode").c_str(), sizeof(TThostFtdcZipCodeType));
strncpy(data.Telephone, rowValue.at("Telephone").c_str(), sizeof(TThostFtdcTelephoneType));
strncpy(data.MobilePhone, rowValue.at("MobilePhone").c_str(), sizeof(TThostFtdcMobilePhoneType));
strncpy(data.Fax, rowValue.at("Fax").c_str(), sizeof(TThostFtdcFaxType));
strncpy(data.EMail, rowValue.at("EMail").c_str(), sizeof(TThostFtdcEMailType));
data.MoneyAccountStatus = rowValue.at("MoneyAccountStatus").empty() ? '0' : rowValue.at("MoneyAccountStatus")[0];
strncpy(data.BankAccount, rowValue.at("BankAccount").c_str(), sizeof(TThostFtdcBankAccountType));
strncpy(data.BankPassWord, rowValue.at("BankPassWord").c_str(), sizeof(TThostFtdcPasswordType));
strncpy(data.AccountID, rowValue.at("AccountID").c_str(), sizeof(TThostFtdcAccountIDType));
strncpy(data.Password, rowValue.at("Password").c_str(), sizeof(TThostFtdcPasswordType));
data.InstallID = std::stoi(rowValue.at("InstallID"));
data.VerifyCertNoFlag = rowValue.at("VerifyCertNoFlag").empty() ? '0' : rowValue.at("VerifyCertNoFlag")[0];
strncpy(data.CurrencyID, rowValue.at("CurrencyID").c_str(), sizeof(TThostFtdcCurrencyIDType));
data.CashExchangeCode = rowValue.at("CashExchangeCode").empty() ? '0' : rowValue.at("CashExchangeCode")[0];
strncpy(data.Digest, rowValue.at("Digest").c_str(), sizeof(TThostFtdcDigestType));
data.BankAccType = rowValue.at("BankAccType").empty() ? '0' : rowValue.at("BankAccType")[0];
strncpy(data.DeviceID, rowValue.at("DeviceID").c_str(), sizeof(TThostFtdcDeviceIDType));
data.BankSecuAccType = rowValue.at("BankSecuAccType").empty() ? '0' : rowValue.at("BankSecuAccType")[0];
strncpy(data.BrokerIDByBank, rowValue.at("BrokerIDByBank").c_str(), sizeof(TThostFtdcBankCodingForFutureType));
strncpy(data.BankSecuAcc, rowValue.at("BankSecuAcc").c_str(), sizeof(TThostFtdcBankAccountType));
data.BankPwdFlag = rowValue.at("BankPwdFlag").empty() ? '0' : rowValue.at("BankPwdFlag")[0];
data.SecuPwdFlag = rowValue.at("SecuPwdFlag").empty() ? '0' : rowValue.at("SecuPwdFlag")[0];
strncpy(data.OperNo, rowValue.at("OperNo").c_str(), sizeof(TThostFtdcOperNoType));
data.TID = std::stoi(rowValue.at("TID"));
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
data.ErrorID = std::stoi(rowValue.at("ErrorID"));
strncpy(data.ErrorMsg, utf8_to_gbk(rowValue.at("ErrorMsg")).c_str(), sizeof(TThostFtdcErrorMsgType));
strncpy(data.LongCustomerName, rowValue.at("LongCustomerName").c_str(), sizeof(TThostFtdcLongIndividualNameType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.TradeCode + "','" + data.BankID + "','" + data.BankBranchID + "','" + data.BrokerID + "','" + data.BrokerBranchID + "','" + data.TradeDate + "','" + data.TradeTime + "','" + data.BankSerial + "','" + data.TradingDay + "','" + std::to_string(data.PlateSerial) + "','" + (data.LastFragment == 0 ? '0' : data.LastFragment) + "','" + std::to_string(data.SessionID) + "','" + data.CustomerName + "','" + (data.IdCardType == 0 ? '0' : data.IdCardType) + "','" + data.IdentifiedCardNo + "','" + (data.Gender == 0 ? '0' : data.Gender) + "','" + data.CountryCode + "','" + (data.CustType == 0 ? '0' : data.CustType) + "','" + data.Address + "','" + data.ZipCode + "','" + data.Telephone + "','" + data.MobilePhone + "','" + data.Fax + "','" + data.EMail + "','" + (data.MoneyAccountStatus == 0 ? '0' : data.MoneyAccountStatus) + "','" + data.BankAccount + "','" + data.BankPassWord + "','" + data.AccountID + "','" + data.Password + "','" + std::to_string(data.InstallID) + "','" + (data.VerifyCertNoFlag == 0 ? '0' : data.VerifyCertNoFlag) + "','" + data.CurrencyID + "','" + (data.CashExchangeCode == 0 ? '0' : data.CashExchangeCode) + "','" + data.Digest + "','" + (data.BankAccType == 0 ? '0' : data.BankAccType) + "','" + data.DeviceID + "','" + (data.BankSecuAccType == 0 ? '0' : data.BankSecuAccType) + "','" + data.BrokerIDByBank + "','" + data.BankSecuAcc + "','" + (data.BankPwdFlag == 0 ? '0' : data.BankPwdFlag) + "','" + (data.SecuPwdFlag == 0 ? '0' : data.SecuPwdFlag) + "','" + data.OperNo + "','" + std::to_string(data.TID) + "','" + data.UserID + "','" + std::to_string(data.ErrorID) + "','" + gbk_to_utf8(data.ErrorMsg) + "','" + data.LongCustomerName
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.AccountID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& AccountID) {
return "SELECT * FROM 'CThostFtdcCancelAccountField' where BrokerID='" + BrokerID + "' and AccountID='" + AccountID + "';";
}
};
struct CThostFtdcChangeAccountFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcChangeAccountField data;
CThostFtdcChangeAccountFieldWrapper(const CThostFtdcChangeAccountField& _data = { 0 }) :data(_data) { }
CThostFtdcChangeAccountFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcChangeAccountField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.TradeCode, rowValue.at("TradeCode").c_str(), sizeof(TThostFtdcTradeCodeType));
strncpy(data.BankID, rowValue.at("BankID").c_str(), sizeof(TThostFtdcBankIDType));
strncpy(data.BankBranchID, rowValue.at("BankBranchID").c_str(), sizeof(TThostFtdcBankBrchIDType));
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.BrokerBranchID, rowValue.at("BrokerBranchID").c_str(), sizeof(TThostFtdcFutureBranchIDType));
strncpy(data.TradeDate, rowValue.at("TradeDate").c_str(), sizeof(TThostFtdcTradeDateType));
strncpy(data.TradeTime, rowValue.at("TradeTime").c_str(), sizeof(TThostFtdcTradeTimeType));
strncpy(data.BankSerial, rowValue.at("BankSerial").c_str(), sizeof(TThostFtdcBankSerialType));
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcTradeDateType));
data.PlateSerial = std::stoi(rowValue.at("PlateSerial"));
data.LastFragment = rowValue.at("LastFragment").empty() ? '0' : rowValue.at("LastFragment")[0];
data.SessionID = std::stoi(rowValue.at("SessionID"));
strncpy(data.CustomerName, rowValue.at("CustomerName").c_str(), sizeof(TThostFtdcIndividualNameType));
data.IdCardType = rowValue.at("IdCardType").empty() ? '0' : rowValue.at("IdCardType")[0];
strncpy(data.IdentifiedCardNo, rowValue.at("IdentifiedCardNo").c_str(), sizeof(TThostFtdcIdentifiedCardNoType));
data.Gender = rowValue.at("Gender").empty() ? '0' : rowValue.at("Gender")[0];
strncpy(data.CountryCode, rowValue.at("CountryCode").c_str(), sizeof(TThostFtdcCountryCodeType));
data.CustType = rowValue.at("CustType").empty() ? '0' : rowValue.at("CustType")[0];
strncpy(data.Address, rowValue.at("Address").c_str(), sizeof(TThostFtdcAddressType));
strncpy(data.ZipCode, rowValue.at("ZipCode").c_str(), sizeof(TThostFtdcZipCodeType));
strncpy(data.Telephone, rowValue.at("Telephone").c_str(), sizeof(TThostFtdcTelephoneType));
strncpy(data.MobilePhone, rowValue.at("MobilePhone").c_str(), sizeof(TThostFtdcMobilePhoneType));
strncpy(data.Fax, rowValue.at("Fax").c_str(), sizeof(TThostFtdcFaxType));
strncpy(data.EMail, rowValue.at("EMail").c_str(), sizeof(TThostFtdcEMailType));
data.MoneyAccountStatus = rowValue.at("MoneyAccountStatus").empty() ? '0' : rowValue.at("MoneyAccountStatus")[0];
strncpy(data.BankAccount, rowValue.at("BankAccount").c_str(), sizeof(TThostFtdcBankAccountType));
strncpy(data.BankPassWord, rowValue.at("BankPassWord").c_str(), sizeof(TThostFtdcPasswordType));
strncpy(data.NewBankAccount, rowValue.at("NewBankAccount").c_str(), sizeof(TThostFtdcBankAccountType));
strncpy(data.NewBankPassWord, rowValue.at("NewBankPassWord").c_str(), sizeof(TThostFtdcPasswordType));
strncpy(data.AccountID, rowValue.at("AccountID").c_str(), sizeof(TThostFtdcAccountIDType));
strncpy(data.Password, rowValue.at("Password").c_str(), sizeof(TThostFtdcPasswordType));
data.BankAccType = rowValue.at("BankAccType").empty() ? '0' : rowValue.at("BankAccType")[0];
data.InstallID = std::stoi(rowValue.at("InstallID"));
data.VerifyCertNoFlag = rowValue.at("VerifyCertNoFlag").empty() ? '0' : rowValue.at("VerifyCertNoFlag")[0];
strncpy(data.CurrencyID, rowValue.at("CurrencyID").c_str(), sizeof(TThostFtdcCurrencyIDType));
strncpy(data.BrokerIDByBank, rowValue.at("BrokerIDByBank").c_str(), sizeof(TThostFtdcBankCodingForFutureType));
data.BankPwdFlag = rowValue.at("BankPwdFlag").empty() ? '0' : rowValue.at("BankPwdFlag")[0];
data.SecuPwdFlag = rowValue.at("SecuPwdFlag").empty() ? '0' : rowValue.at("SecuPwdFlag")[0];
data.TID = std::stoi(rowValue.at("TID"));
strncpy(data.Digest, rowValue.at("Digest").c_str(), sizeof(TThostFtdcDigestType));
data.ErrorID = std::stoi(rowValue.at("ErrorID"));
strncpy(data.ErrorMsg, utf8_to_gbk(rowValue.at("ErrorMsg")).c_str(), sizeof(TThostFtdcErrorMsgType));
strncpy(data.LongCustomerName, rowValue.at("LongCustomerName").c_str(), sizeof(TThostFtdcLongIndividualNameType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.TradeCode + "','" + data.BankID + "','" + data.BankBranchID + "','" + data.BrokerID + "','" + data.BrokerBranchID + "','" + data.TradeDate + "','" + data.TradeTime + "','" + data.BankSerial + "','" + data.TradingDay + "','" + std::to_string(data.PlateSerial) + "','" + (data.LastFragment == 0 ? '0' : data.LastFragment) + "','" + std::to_string(data.SessionID) + "','" + data.CustomerName + "','" + (data.IdCardType == 0 ? '0' : data.IdCardType) + "','" + data.IdentifiedCardNo + "','" + (data.Gender == 0 ? '0' : data.Gender) + "','" + data.CountryCode + "','" + (data.CustType == 0 ? '0' : data.CustType) + "','" + data.Address + "','" + data.ZipCode + "','" + data.Telephone + "','" + data.MobilePhone + "','" + data.Fax + "','" + data.EMail + "','" + (data.MoneyAccountStatus == 0 ? '0' : data.MoneyAccountStatus) + "','" + data.BankAccount + "','" + data.BankPassWord + "','" + data.NewBankAccount + "','" + data.NewBankPassWord + "','" + data.AccountID + "','" + data.Password + "','" + (data.BankAccType == 0 ? '0' : data.BankAccType) + "','" + std::to_string(data.InstallID) + "','" + (data.VerifyCertNoFlag == 0 ? '0' : data.VerifyCertNoFlag) + "','" + data.CurrencyID + "','" + data.BrokerIDByBank + "','" + (data.BankPwdFlag == 0 ? '0' : data.BankPwdFlag) + "','" + (data.SecuPwdFlag == 0 ? '0' : data.SecuPwdFlag) + "','" + std::to_string(data.TID) + "','" + data.Digest + "','" + std::to_string(data.ErrorID) + "','" + gbk_to_utf8(data.ErrorMsg) + "','" + data.LongCustomerName
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.AccountID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& AccountID) {
return "SELECT * FROM 'CThostFtdcChangeAccountField' where BrokerID='" + BrokerID + "' and AccountID='" + AccountID + "';";
}
};
struct CThostFtdcSecAgentACIDMapFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcSecAgentACIDMapField data;
CThostFtdcSecAgentACIDMapFieldWrapper(const CThostFtdcSecAgentACIDMapField& _data = { 0 }) :data(_data) { }
CThostFtdcSecAgentACIDMapFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcSecAgentACIDMapField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
strncpy(data.AccountID, rowValue.at("AccountID").c_str(), sizeof(TThostFtdcAccountIDType));
strncpy(data.CurrencyID, rowValue.at("CurrencyID").c_str(), sizeof(TThostFtdcCurrencyIDType));
strncpy(data.BrokerSecAgentID, rowValue.at("BrokerSecAgentID").c_str(), sizeof(TThostFtdcAccountIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.UserID + "','" + data.AccountID + "','" + data.CurrencyID + "','" + data.BrokerSecAgentID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.AccountID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& AccountID) {
return "SELECT * FROM 'CThostFtdcSecAgentACIDMapField' where BrokerID='" + BrokerID + "' and AccountID='" + AccountID + "';";
}
};
struct CThostFtdcQrySecAgentACIDMapFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQrySecAgentACIDMapField data;
CThostFtdcQrySecAgentACIDMapFieldWrapper(const CThostFtdcQrySecAgentACIDMapField& _data = { 0 }) :data(_data) { }
CThostFtdcQrySecAgentACIDMapFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQrySecAgentACIDMapField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
strncpy(data.AccountID, rowValue.at("AccountID").c_str(), sizeof(TThostFtdcAccountIDType));
strncpy(data.CurrencyID, rowValue.at("CurrencyID").c_str(), sizeof(TThostFtdcCurrencyIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.UserID + "','" + data.AccountID + "','" + data.CurrencyID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.AccountID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& AccountID) {
return "SELECT * FROM 'CThostFtdcQrySecAgentACIDMapField' where BrokerID='" + BrokerID + "' and AccountID='" + AccountID + "';";
}
};
struct CThostFtdcUserRightsAssignFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcUserRightsAssignField data;
CThostFtdcUserRightsAssignFieldWrapper(const CThostFtdcUserRightsAssignField& _data = { 0 }) :data(_data) { }
CThostFtdcUserRightsAssignFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcUserRightsAssignField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
data.DRIdentityID = std::stoi(rowValue.at("DRIdentityID"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.UserID + "','" + std::to_string(data.DRIdentityID)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.UserID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& UserID) {
return "SELECT * FROM 'CThostFtdcUserRightsAssignField' where BrokerID='" + BrokerID + "' and UserID='" + UserID + "';";
}
};
struct CThostFtdcBrokerUserRightAssignFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcBrokerUserRightAssignField data;
CThostFtdcBrokerUserRightAssignFieldWrapper(const CThostFtdcBrokerUserRightAssignField& _data = { 0 }) :data(_data) { }
CThostFtdcBrokerUserRightAssignFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcBrokerUserRightAssignField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
data.DRIdentityID = std::stoi(rowValue.at("DRIdentityID"));
data.Tradeable = std::stoi(rowValue.at("Tradeable"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + std::to_string(data.DRIdentityID) + "','" + std::to_string(data.Tradeable)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcDRTransferFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcDRTransferField data;
CThostFtdcDRTransferFieldWrapper(const CThostFtdcDRTransferField& _data = { 0 }) :data(_data) { }
CThostFtdcDRTransferFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcDRTransferField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
data.OrigDRIdentityID = std::stoi(rowValue.at("OrigDRIdentityID"));
data.DestDRIdentityID = std::stoi(rowValue.at("DestDRIdentityID"));
strncpy(data.OrigBrokerID, rowValue.at("OrigBrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.DestBrokerID, rowValue.at("DestBrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
std::to_string(data.OrigDRIdentityID) + "','" + std::to_string(data.DestDRIdentityID) + "','" + data.OrigBrokerID + "','" + data.DestBrokerID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcFensUserInfoFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcFensUserInfoField data;
CThostFtdcFensUserInfoFieldWrapper(const CThostFtdcFensUserInfoField& _data = { 0 }) :data(_data) { }
CThostFtdcFensUserInfoFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcFensUserInfoField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
data.LoginMode = rowValue.at("LoginMode").empty() ? '0' : rowValue.at("LoginMode")[0];
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.UserID + "','" + (data.LoginMode == 0 ? '0' : data.LoginMode)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.UserID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& UserID) {
return "SELECT * FROM 'CThostFtdcFensUserInfoField' where BrokerID='" + BrokerID + "' and UserID='" + UserID + "';";
}
};
struct CThostFtdcCurrTransferIdentityFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcCurrTransferIdentityField data;
CThostFtdcCurrTransferIdentityFieldWrapper(const CThostFtdcCurrTransferIdentityField& _data = { 0 }) :data(_data) { }
CThostFtdcCurrTransferIdentityFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcCurrTransferIdentityField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
data.IdentityID = std::stoi(rowValue.at("IdentityID"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
std::to_string(data.IdentityID)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcLoginForbiddenUserFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcLoginForbiddenUserField data;
CThostFtdcLoginForbiddenUserFieldWrapper(const CThostFtdcLoginForbiddenUserField& _data = { 0 }) :data(_data) { }
CThostFtdcLoginForbiddenUserFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcLoginForbiddenUserField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldIPAddressType));
strncpy(data.IPAddress, rowValue.at("IPAddress").c_str(), sizeof(TThostFtdcIPAddressType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.UserID + "','" + data.reserve1 + "','" + data.IPAddress
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.UserID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& UserID) {
return "SELECT * FROM 'CThostFtdcLoginForbiddenUserField' where BrokerID='" + BrokerID + "' and UserID='" + UserID + "';";
}
};
struct CThostFtdcQryLoginForbiddenUserFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryLoginForbiddenUserField data;
CThostFtdcQryLoginForbiddenUserFieldWrapper(const CThostFtdcQryLoginForbiddenUserField& _data = { 0 }) :data(_data) { }
CThostFtdcQryLoginForbiddenUserFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryLoginForbiddenUserField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.UserID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.UserID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& UserID) {
return "SELECT * FROM 'CThostFtdcQryLoginForbiddenUserField' where BrokerID='" + BrokerID + "' and UserID='" + UserID + "';";
}
};
struct CThostFtdcTradingAccountReserveFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcTradingAccountReserveField data;
CThostFtdcTradingAccountReserveFieldWrapper(const CThostFtdcTradingAccountReserveField& _data = { 0 }) :data(_data) { }
CThostFtdcTradingAccountReserveFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcTradingAccountReserveField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.AccountID, rowValue.at("AccountID").c_str(), sizeof(TThostFtdcAccountIDType));
data.Reserve = std::stod(rowValue.at("Reserve"));
strncpy(data.CurrencyID, rowValue.at("CurrencyID").c_str(), sizeof(TThostFtdcCurrencyIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.AccountID + "','" + std::to_string(data.Reserve) + "','" + data.CurrencyID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.AccountID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& AccountID) {
return "SELECT * FROM 'CThostFtdcTradingAccountReserveField' where BrokerID='" + BrokerID + "' and AccountID='" + AccountID + "';";
}
};
struct CThostFtdcQryLoginForbiddenIPFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryLoginForbiddenIPField data;
CThostFtdcQryLoginForbiddenIPFieldWrapper(const CThostFtdcQryLoginForbiddenIPField& _data = { 0 }) :data(_data) { }
CThostFtdcQryLoginForbiddenIPFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryLoginForbiddenIPField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldIPAddressType));
strncpy(data.IPAddress, rowValue.at("IPAddress").c_str(), sizeof(TThostFtdcIPAddressType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.reserve1 + "','" + data.IPAddress
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcQryIPListFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryIPListField data;
CThostFtdcQryIPListFieldWrapper(const CThostFtdcQryIPListField& _data = { 0 }) :data(_data) { }
CThostFtdcQryIPListFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryIPListField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldIPAddressType));
strncpy(data.IPAddress, rowValue.at("IPAddress").c_str(), sizeof(TThostFtdcIPAddressType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.reserve1 + "','" + data.IPAddress
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcQryUserRightsAssignFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryUserRightsAssignField data;
CThostFtdcQryUserRightsAssignFieldWrapper(const CThostFtdcQryUserRightsAssignField& _data = { 0 }) :data(_data) { }
CThostFtdcQryUserRightsAssignFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryUserRightsAssignField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.UserID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.UserID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& UserID) {
return "SELECT * FROM 'CThostFtdcQryUserRightsAssignField' where BrokerID='" + BrokerID + "' and UserID='" + UserID + "';";
}
};
struct CThostFtdcReserveOpenAccountConfirmFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcReserveOpenAccountConfirmField data;
CThostFtdcReserveOpenAccountConfirmFieldWrapper(const CThostFtdcReserveOpenAccountConfirmField& _data = { 0 }) :data(_data) { }
CThostFtdcReserveOpenAccountConfirmFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcReserveOpenAccountConfirmField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.TradeCode, rowValue.at("TradeCode").c_str(), sizeof(TThostFtdcTradeCodeType));
strncpy(data.BankID, rowValue.at("BankID").c_str(), sizeof(TThostFtdcBankIDType));
strncpy(data.BankBranchID, rowValue.at("BankBranchID").c_str(), sizeof(TThostFtdcBankBrchIDType));
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.BrokerBranchID, rowValue.at("BrokerBranchID").c_str(), sizeof(TThostFtdcFutureBranchIDType));
strncpy(data.TradeDate, rowValue.at("TradeDate").c_str(), sizeof(TThostFtdcTradeDateType));
strncpy(data.TradeTime, rowValue.at("TradeTime").c_str(), sizeof(TThostFtdcTradeTimeType));
strncpy(data.BankSerial, rowValue.at("BankSerial").c_str(), sizeof(TThostFtdcBankSerialType));
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcTradeDateType));
data.PlateSerial = std::stoi(rowValue.at("PlateSerial"));
data.LastFragment = rowValue.at("LastFragment").empty() ? '0' : rowValue.at("LastFragment")[0];
data.SessionID = std::stoi(rowValue.at("SessionID"));
strncpy(data.CustomerName, rowValue.at("CustomerName").c_str(), sizeof(TThostFtdcLongIndividualNameType));
data.IdCardType = rowValue.at("IdCardType").empty() ? '0' : rowValue.at("IdCardType")[0];
strncpy(data.IdentifiedCardNo, rowValue.at("IdentifiedCardNo").c_str(), sizeof(TThostFtdcIdentifiedCardNoType));
data.Gender = rowValue.at("Gender").empty() ? '0' : rowValue.at("Gender")[0];
strncpy(data.CountryCode, rowValue.at("CountryCode").c_str(), sizeof(TThostFtdcCountryCodeType));
data.CustType = rowValue.at("CustType").empty() ? '0' : rowValue.at("CustType")[0];
strncpy(data.Address, rowValue.at("Address").c_str(), sizeof(TThostFtdcAddressType));
strncpy(data.ZipCode, rowValue.at("ZipCode").c_str(), sizeof(TThostFtdcZipCodeType));
strncpy(data.Telephone, rowValue.at("Telephone").c_str(), sizeof(TThostFtdcTelephoneType));
strncpy(data.MobilePhone, rowValue.at("MobilePhone").c_str(), sizeof(TThostFtdcMobilePhoneType));
strncpy(data.Fax, rowValue.at("Fax").c_str(), sizeof(TThostFtdcFaxType));
strncpy(data.EMail, rowValue.at("EMail").c_str(), sizeof(TThostFtdcEMailType));
data.MoneyAccountStatus = rowValue.at("MoneyAccountStatus").empty() ? '0' : rowValue.at("MoneyAccountStatus")[0];
strncpy(data.BankAccount, rowValue.at("BankAccount").c_str(), sizeof(TThostFtdcBankAccountType));
strncpy(data.BankPassWord, rowValue.at("BankPassWord").c_str(), sizeof(TThostFtdcPasswordType));
data.InstallID = std::stoi(rowValue.at("InstallID"));
data.VerifyCertNoFlag = rowValue.at("VerifyCertNoFlag").empty() ? '0' : rowValue.at("VerifyCertNoFlag")[0];
strncpy(data.CurrencyID, rowValue.at("CurrencyID").c_str(), sizeof(TThostFtdcCurrencyIDType));
strncpy(data.Digest, rowValue.at("Digest").c_str(), sizeof(TThostFtdcDigestType));
data.BankAccType = rowValue.at("BankAccType").empty() ? '0' : rowValue.at("BankAccType")[0];
strncpy(data.BrokerIDByBank, rowValue.at("BrokerIDByBank").c_str(), sizeof(TThostFtdcBankCodingForFutureType));
data.TID = std::stoi(rowValue.at("TID"));
strncpy(data.AccountID, rowValue.at("AccountID").c_str(), sizeof(TThostFtdcAccountIDType));
strncpy(data.Password, rowValue.at("Password").c_str(), sizeof(TThostFtdcPasswordType));
strncpy(data.BankReserveOpenSeq, rowValue.at("BankReserveOpenSeq").c_str(), sizeof(TThostFtdcBankSerialType));
strncpy(data.BookDate, rowValue.at("BookDate").c_str(), sizeof(TThostFtdcTradeDateType));
strncpy(data.BookPsw, rowValue.at("BookPsw").c_str(), sizeof(TThostFtdcPasswordType));
data.ErrorID = std::stoi(rowValue.at("ErrorID"));
strncpy(data.ErrorMsg, utf8_to_gbk(rowValue.at("ErrorMsg")).c_str(), sizeof(TThostFtdcErrorMsgType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.TradeCode + "','" + data.BankID + "','" + data.BankBranchID + "','" + data.BrokerID + "','" + data.BrokerBranchID + "','" + data.TradeDate + "','" + data.TradeTime + "','" + data.BankSerial + "','" + data.TradingDay + "','" + std::to_string(data.PlateSerial) + "','" + (data.LastFragment == 0 ? '0' : data.LastFragment) + "','" + std::to_string(data.SessionID) + "','" + data.CustomerName + "','" + (data.IdCardType == 0 ? '0' : data.IdCardType) + "','" + data.IdentifiedCardNo + "','" + (data.Gender == 0 ? '0' : data.Gender) + "','" + data.CountryCode + "','" + (data.CustType == 0 ? '0' : data.CustType) + "','" + data.Address + "','" + data.ZipCode + "','" + data.Telephone + "','" + data.MobilePhone + "','" + data.Fax + "','" + data.EMail + "','" + (data.MoneyAccountStatus == 0 ? '0' : data.MoneyAccountStatus) + "','" + data.BankAccount + "','" + data.BankPassWord + "','" + std::to_string(data.InstallID) + "','" + (data.VerifyCertNoFlag == 0 ? '0' : data.VerifyCertNoFlag) + "','" + data.CurrencyID + "','" + data.Digest + "','" + (data.BankAccType == 0 ? '0' : data.BankAccType) + "','" + data.BrokerIDByBank + "','" + std::to_string(data.TID) + "','" + data.AccountID + "','" + data.Password + "','" + data.BankReserveOpenSeq + "','" + data.BookDate + "','" + data.BookPsw + "','" + std::to_string(data.ErrorID) + "','" + gbk_to_utf8(data.ErrorMsg)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.AccountID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& AccountID) {
return "SELECT * FROM 'CThostFtdcReserveOpenAccountConfirmField' where BrokerID='" + BrokerID + "' and AccountID='" + AccountID + "';";
}
};
struct CThostFtdcReserveOpenAccountFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcReserveOpenAccountField data;
CThostFtdcReserveOpenAccountFieldWrapper(const CThostFtdcReserveOpenAccountField& _data = { 0 }) :data(_data) { }
CThostFtdcReserveOpenAccountFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcReserveOpenAccountField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.TradeCode, rowValue.at("TradeCode").c_str(), sizeof(TThostFtdcTradeCodeType));
strncpy(data.BankID, rowValue.at("BankID").c_str(), sizeof(TThostFtdcBankIDType));
strncpy(data.BankBranchID, rowValue.at("BankBranchID").c_str(), sizeof(TThostFtdcBankBrchIDType));
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.BrokerBranchID, rowValue.at("BrokerBranchID").c_str(), sizeof(TThostFtdcFutureBranchIDType));
strncpy(data.TradeDate, rowValue.at("TradeDate").c_str(), sizeof(TThostFtdcTradeDateType));
strncpy(data.TradeTime, rowValue.at("TradeTime").c_str(), sizeof(TThostFtdcTradeTimeType));
strncpy(data.BankSerial, rowValue.at("BankSerial").c_str(), sizeof(TThostFtdcBankSerialType));
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcTradeDateType));
data.PlateSerial = std::stoi(rowValue.at("PlateSerial"));
data.LastFragment = rowValue.at("LastFragment").empty() ? '0' : rowValue.at("LastFragment")[0];
data.SessionID = std::stoi(rowValue.at("SessionID"));
strncpy(data.CustomerName, rowValue.at("CustomerName").c_str(), sizeof(TThostFtdcLongIndividualNameType));
data.IdCardType = rowValue.at("IdCardType").empty() ? '0' : rowValue.at("IdCardType")[0];
strncpy(data.IdentifiedCardNo, rowValue.at("IdentifiedCardNo").c_str(), sizeof(TThostFtdcIdentifiedCardNoType));
data.Gender = rowValue.at("Gender").empty() ? '0' : rowValue.at("Gender")[0];
strncpy(data.CountryCode, rowValue.at("CountryCode").c_str(), sizeof(TThostFtdcCountryCodeType));
data.CustType = rowValue.at("CustType").empty() ? '0' : rowValue.at("CustType")[0];
strncpy(data.Address, rowValue.at("Address").c_str(), sizeof(TThostFtdcAddressType));
strncpy(data.ZipCode, rowValue.at("ZipCode").c_str(), sizeof(TThostFtdcZipCodeType));
strncpy(data.Telephone, rowValue.at("Telephone").c_str(), sizeof(TThostFtdcTelephoneType));
strncpy(data.MobilePhone, rowValue.at("MobilePhone").c_str(), sizeof(TThostFtdcMobilePhoneType));
strncpy(data.Fax, rowValue.at("Fax").c_str(), sizeof(TThostFtdcFaxType));
strncpy(data.EMail, rowValue.at("EMail").c_str(), sizeof(TThostFtdcEMailType));
data.MoneyAccountStatus = rowValue.at("MoneyAccountStatus").empty() ? '0' : rowValue.at("MoneyAccountStatus")[0];
strncpy(data.BankAccount, rowValue.at("BankAccount").c_str(), sizeof(TThostFtdcBankAccountType));
strncpy(data.BankPassWord, rowValue.at("BankPassWord").c_str(), sizeof(TThostFtdcPasswordType));
data.InstallID = std::stoi(rowValue.at("InstallID"));
data.VerifyCertNoFlag = rowValue.at("VerifyCertNoFlag").empty() ? '0' : rowValue.at("VerifyCertNoFlag")[0];
strncpy(data.CurrencyID, rowValue.at("CurrencyID").c_str(), sizeof(TThostFtdcCurrencyIDType));
strncpy(data.Digest, rowValue.at("Digest").c_str(), sizeof(TThostFtdcDigestType));
data.BankAccType = rowValue.at("BankAccType").empty() ? '0' : rowValue.at("BankAccType")[0];
strncpy(data.BrokerIDByBank, rowValue.at("BrokerIDByBank").c_str(), sizeof(TThostFtdcBankCodingForFutureType));
data.TID = std::stoi(rowValue.at("TID"));
data.ReserveOpenAccStas = rowValue.at("ReserveOpenAccStas").empty() ? '0' : rowValue.at("ReserveOpenAccStas")[0];
data.ErrorID = std::stoi(rowValue.at("ErrorID"));
strncpy(data.ErrorMsg, utf8_to_gbk(rowValue.at("ErrorMsg")).c_str(), sizeof(TThostFtdcErrorMsgType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.TradeCode + "','" + data.BankID + "','" + data.BankBranchID + "','" + data.BrokerID + "','" + data.BrokerBranchID + "','" + data.TradeDate + "','" + data.TradeTime + "','" + data.BankSerial + "','" + data.TradingDay + "','" + std::to_string(data.PlateSerial) + "','" + (data.LastFragment == 0 ? '0' : data.LastFragment) + "','" + std::to_string(data.SessionID) + "','" + data.CustomerName + "','" + (data.IdCardType == 0 ? '0' : data.IdCardType) + "','" + data.IdentifiedCardNo + "','" + (data.Gender == 0 ? '0' : data.Gender) + "','" + data.CountryCode + "','" + (data.CustType == 0 ? '0' : data.CustType) + "','" + data.Address + "','" + data.ZipCode + "','" + data.Telephone + "','" + data.MobilePhone + "','" + data.Fax + "','" + data.EMail + "','" + (data.MoneyAccountStatus == 0 ? '0' : data.MoneyAccountStatus) + "','" + data.BankAccount + "','" + data.BankPassWord + "','" + std::to_string(data.InstallID) + "','" + (data.VerifyCertNoFlag == 0 ? '0' : data.VerifyCertNoFlag) + "','" + data.CurrencyID + "','" + data.Digest + "','" + (data.BankAccType == 0 ? '0' : data.BankAccType) + "','" + data.BrokerIDByBank + "','" + std::to_string(data.TID) + "','" + (data.ReserveOpenAccStas == 0 ? '0' : data.ReserveOpenAccStas) + "','" + std::to_string(data.ErrorID) + "','" + gbk_to_utf8(data.ErrorMsg)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcAccountPropertyFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcAccountPropertyField data;
CThostFtdcAccountPropertyFieldWrapper(const CThostFtdcAccountPropertyField& _data = { 0 }) :data(_data) { }
CThostFtdcAccountPropertyFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcAccountPropertyField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.AccountID, rowValue.at("AccountID").c_str(), sizeof(TThostFtdcAccountIDType));
strncpy(data.BankID, rowValue.at("BankID").c_str(), sizeof(TThostFtdcBankIDType));
strncpy(data.BankAccount, rowValue.at("BankAccount").c_str(), sizeof(TThostFtdcBankAccountType));
strncpy(data.OpenName, rowValue.at("OpenName").c_str(), sizeof(TThostFtdcInvestorFullNameType));
strncpy(data.OpenBank, rowValue.at("OpenBank").c_str(), sizeof(TThostFtdcOpenBankType));
data.IsActive = std::stoi(rowValue.at("IsActive"));
data.AccountSourceType = rowValue.at("AccountSourceType").empty() ? '0' : rowValue.at("AccountSourceType")[0];
strncpy(data.OpenDate, rowValue.at("OpenDate").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.CancelDate, rowValue.at("CancelDate").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.OperatorID, rowValue.at("OperatorID").c_str(), sizeof(TThostFtdcOperatorIDType));
strncpy(data.OperateDate, rowValue.at("OperateDate").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.OperateTime, rowValue.at("OperateTime").c_str(), sizeof(TThostFtdcTimeType));
strncpy(data.CurrencyID, rowValue.at("CurrencyID").c_str(), sizeof(TThostFtdcCurrencyIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.AccountID + "','" + data.BankID + "','" + data.BankAccount + "','" + data.OpenName + "','" + data.OpenBank + "','" + std::to_string(data.IsActive) + "','" + (data.AccountSourceType == 0 ? '0' : data.AccountSourceType) + "','" + data.OpenDate + "','" + data.CancelDate + "','" + data.OperatorID + "','" + data.OperateDate + "','" + data.OperateTime + "','" + data.CurrencyID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.AccountID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& AccountID) {
return "SELECT * FROM 'CThostFtdcAccountPropertyField' where BrokerID='" + BrokerID + "' and AccountID='" + AccountID + "';";
}
};
struct CThostFtdcQryCurrDRIdentityFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryCurrDRIdentityField data;
CThostFtdcQryCurrDRIdentityFieldWrapper(const CThostFtdcQryCurrDRIdentityField& _data = { 0 }) :data(_data) { }
CThostFtdcQryCurrDRIdentityFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryCurrDRIdentityField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
data.DRIdentityID = std::stoi(rowValue.at("DRIdentityID"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
std::to_string(data.DRIdentityID)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcCurrDRIdentityFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcCurrDRIdentityField data;
CThostFtdcCurrDRIdentityFieldWrapper(const CThostFtdcCurrDRIdentityField& _data = { 0 }) :data(_data) { }
CThostFtdcCurrDRIdentityFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcCurrDRIdentityField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
data.DRIdentityID = std::stoi(rowValue.at("DRIdentityID"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
std::to_string(data.DRIdentityID)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcQrySecAgentCheckModeFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQrySecAgentCheckModeField data;
CThostFtdcQrySecAgentCheckModeFieldWrapper(const CThostFtdcQrySecAgentCheckModeField& _data = { 0 }) :data(_data) { }
CThostFtdcQrySecAgentCheckModeFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQrySecAgentCheckModeField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcQrySecAgentCheckModeField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcQrySecAgentTradeInfoFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQrySecAgentTradeInfoField data;
CThostFtdcQrySecAgentTradeInfoFieldWrapper(const CThostFtdcQrySecAgentTradeInfoField& _data = { 0 }) :data(_data) { }
CThostFtdcQrySecAgentTradeInfoFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQrySecAgentTradeInfoField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.BrokerSecAgentID, rowValue.at("BrokerSecAgentID").c_str(), sizeof(TThostFtdcAccountIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.BrokerSecAgentID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcReqUserAuthMethodFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcReqUserAuthMethodField data;
CThostFtdcReqUserAuthMethodFieldWrapper(const CThostFtdcReqUserAuthMethodField& _data = { 0 }) :data(_data) { }
CThostFtdcReqUserAuthMethodFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcReqUserAuthMethodField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.TradingDay + "','" + data.BrokerID + "','" + data.UserID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.UserID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& UserID) {
return "SELECT * FROM 'CThostFtdcReqUserAuthMethodField' where BrokerID='" + BrokerID + "' and UserID='" + UserID + "';";
}
};
struct CThostFtdcRspUserAuthMethodFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcRspUserAuthMethodField data;
CThostFtdcRspUserAuthMethodFieldWrapper(const CThostFtdcRspUserAuthMethodField& _data = { 0 }) :data(_data) { }
CThostFtdcRspUserAuthMethodFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcRspUserAuthMethodField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
data.UsableAuthMethod = std::stoi(rowValue.at("UsableAuthMethod"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
std::to_string(data.UsableAuthMethod)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcReqGenUserCaptchaFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcReqGenUserCaptchaField data;
CThostFtdcReqGenUserCaptchaFieldWrapper(const CThostFtdcReqGenUserCaptchaField& _data = { 0 }) :data(_data) { }
CThostFtdcReqGenUserCaptchaFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcReqGenUserCaptchaField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.TradingDay + "','" + data.BrokerID + "','" + data.UserID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.UserID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& UserID) {
return "SELECT * FROM 'CThostFtdcReqGenUserCaptchaField' where BrokerID='" + BrokerID + "' and UserID='" + UserID + "';";
}
};
struct CThostFtdcRspGenUserCaptchaFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcRspGenUserCaptchaField data;
CThostFtdcRspGenUserCaptchaFieldWrapper(const CThostFtdcRspGenUserCaptchaField& _data = { 0 }) :data(_data) { }
CThostFtdcRspGenUserCaptchaFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcRspGenUserCaptchaField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
data.CaptchaInfoLen = std::stoi(rowValue.at("CaptchaInfoLen"));
strncpy(data.CaptchaInfo, rowValue.at("CaptchaInfo").c_str(), sizeof(TThostFtdcCaptchaInfoType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.UserID + "','" + std::to_string(data.CaptchaInfoLen) + "','" + data.CaptchaInfo
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.UserID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& UserID) {
return "SELECT * FROM 'CThostFtdcRspGenUserCaptchaField' where BrokerID='" + BrokerID + "' and UserID='" + UserID + "';";
}
};
struct CThostFtdcReqGenUserTextFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcReqGenUserTextField data;
CThostFtdcReqGenUserTextFieldWrapper(const CThostFtdcReqGenUserTextField& _data = { 0 }) :data(_data) { }
CThostFtdcReqGenUserTextFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcReqGenUserTextField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.TradingDay + "','" + data.BrokerID + "','" + data.UserID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.UserID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& UserID) {
return "SELECT * FROM 'CThostFtdcReqGenUserTextField' where BrokerID='" + BrokerID + "' and UserID='" + UserID + "';";
}
};
struct CThostFtdcRspGenUserTextFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcRspGenUserTextField data;
CThostFtdcRspGenUserTextFieldWrapper(const CThostFtdcRspGenUserTextField& _data = { 0 }) :data(_data) { }
CThostFtdcRspGenUserTextFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcRspGenUserTextField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
data.UserTextSeq = std::stoi(rowValue.at("UserTextSeq"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
std::to_string(data.UserTextSeq)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcReqUserLoginWithCaptchaFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcReqUserLoginWithCaptchaField data;
CThostFtdcReqUserLoginWithCaptchaFieldWrapper(const CThostFtdcReqUserLoginWithCaptchaField& _data = { 0 }) :data(_data) { }
CThostFtdcReqUserLoginWithCaptchaFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcReqUserLoginWithCaptchaField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
strncpy(data.Password, rowValue.at("Password").c_str(), sizeof(TThostFtdcPasswordType));
strncpy(data.UserProductInfo, rowValue.at("UserProductInfo").c_str(), sizeof(TThostFtdcProductInfoType));
strncpy(data.InterfaceProductInfo, rowValue.at("InterfaceProductInfo").c_str(), sizeof(TThostFtdcProductInfoType));
strncpy(data.ProtocolInfo, rowValue.at("ProtocolInfo").c_str(), sizeof(TThostFtdcProtocolInfoType));
strncpy(data.MacAddress, rowValue.at("MacAddress").c_str(), sizeof(TThostFtdcMacAddressType));
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldIPAddressType));
strncpy(data.LoginRemark, rowValue.at("LoginRemark").c_str(), sizeof(TThostFtdcLoginRemarkType));
strncpy(data.Captcha, rowValue.at("Captcha").c_str(), sizeof(TThostFtdcPasswordType));
data.ClientIPPort = std::stoi(rowValue.at("ClientIPPort"));
strncpy(data.ClientIPAddress, rowValue.at("ClientIPAddress").c_str(), sizeof(TThostFtdcIPAddressType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.TradingDay + "','" + data.BrokerID + "','" + data.UserID + "','" + data.Password + "','" + data.UserProductInfo + "','" + data.InterfaceProductInfo + "','" + data.ProtocolInfo + "','" + data.MacAddress + "','" + data.reserve1 + "','" + data.LoginRemark + "','" + data.Captcha + "','" + std::to_string(data.ClientIPPort) + "','" + data.ClientIPAddress
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.UserID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& UserID) {
return "SELECT * FROM 'CThostFtdcReqUserLoginWithCaptchaField' where BrokerID='" + BrokerID + "' and UserID='" + UserID + "';";
}
};
struct CThostFtdcReqUserLoginWithTextFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcReqUserLoginWithTextField data;
CThostFtdcReqUserLoginWithTextFieldWrapper(const CThostFtdcReqUserLoginWithTextField& _data = { 0 }) :data(_data) { }
CThostFtdcReqUserLoginWithTextFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcReqUserLoginWithTextField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
strncpy(data.Password, rowValue.at("Password").c_str(), sizeof(TThostFtdcPasswordType));
strncpy(data.UserProductInfo, rowValue.at("UserProductInfo").c_str(), sizeof(TThostFtdcProductInfoType));
strncpy(data.InterfaceProductInfo, rowValue.at("InterfaceProductInfo").c_str(), sizeof(TThostFtdcProductInfoType));
strncpy(data.ProtocolInfo, rowValue.at("ProtocolInfo").c_str(), sizeof(TThostFtdcProtocolInfoType));
strncpy(data.MacAddress, rowValue.at("MacAddress").c_str(), sizeof(TThostFtdcMacAddressType));
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldIPAddressType));
strncpy(data.LoginRemark, rowValue.at("LoginRemark").c_str(), sizeof(TThostFtdcLoginRemarkType));
strncpy(data.Text, rowValue.at("Text").c_str(), sizeof(TThostFtdcPasswordType));
data.ClientIPPort = std::stoi(rowValue.at("ClientIPPort"));
strncpy(data.ClientIPAddress, rowValue.at("ClientIPAddress").c_str(), sizeof(TThostFtdcIPAddressType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.TradingDay + "','" + data.BrokerID + "','" + data.UserID + "','" + data.Password + "','" + data.UserProductInfo + "','" + data.InterfaceProductInfo + "','" + data.ProtocolInfo + "','" + data.MacAddress + "','" + data.reserve1 + "','" + data.LoginRemark + "','" + data.Text + "','" + std::to_string(data.ClientIPPort) + "','" + data.ClientIPAddress
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.UserID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& UserID) {
return "SELECT * FROM 'CThostFtdcReqUserLoginWithTextField' where BrokerID='" + BrokerID + "' and UserID='" + UserID + "';";
}
};
struct CThostFtdcReqUserLoginWithOTPFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcReqUserLoginWithOTPField data;
CThostFtdcReqUserLoginWithOTPFieldWrapper(const CThostFtdcReqUserLoginWithOTPField& _data = { 0 }) :data(_data) { }
CThostFtdcReqUserLoginWithOTPFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcReqUserLoginWithOTPField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
strncpy(data.Password, rowValue.at("Password").c_str(), sizeof(TThostFtdcPasswordType));
strncpy(data.UserProductInfo, rowValue.at("UserProductInfo").c_str(), sizeof(TThostFtdcProductInfoType));
strncpy(data.InterfaceProductInfo, rowValue.at("InterfaceProductInfo").c_str(), sizeof(TThostFtdcProductInfoType));
strncpy(data.ProtocolInfo, rowValue.at("ProtocolInfo").c_str(), sizeof(TThostFtdcProtocolInfoType));
strncpy(data.MacAddress, rowValue.at("MacAddress").c_str(), sizeof(TThostFtdcMacAddressType));
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldIPAddressType));
strncpy(data.LoginRemark, rowValue.at("LoginRemark").c_str(), sizeof(TThostFtdcLoginRemarkType));
strncpy(data.OTPPassword, rowValue.at("OTPPassword").c_str(), sizeof(TThostFtdcPasswordType));
data.ClientIPPort = std::stoi(rowValue.at("ClientIPPort"));
strncpy(data.ClientIPAddress, rowValue.at("ClientIPAddress").c_str(), sizeof(TThostFtdcIPAddressType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.TradingDay + "','" + data.BrokerID + "','" + data.UserID + "','" + data.Password + "','" + data.UserProductInfo + "','" + data.InterfaceProductInfo + "','" + data.ProtocolInfo + "','" + data.MacAddress + "','" + data.reserve1 + "','" + data.LoginRemark + "','" + data.OTPPassword + "','" + std::to_string(data.ClientIPPort) + "','" + data.ClientIPAddress
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.UserID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& UserID) {
return "SELECT * FROM 'CThostFtdcReqUserLoginWithOTPField' where BrokerID='" + BrokerID + "' and UserID='" + UserID + "';";
}
};
struct CThostFtdcReqApiHandshakeFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcReqApiHandshakeField data;
CThostFtdcReqApiHandshakeFieldWrapper(const CThostFtdcReqApiHandshakeField& _data = { 0 }) :data(_data) { }
CThostFtdcReqApiHandshakeFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcReqApiHandshakeField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.CryptoKeyVersion, rowValue.at("CryptoKeyVersion").c_str(), sizeof(TThostFtdcCryptoKeyVersionType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.CryptoKeyVersion
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcRspApiHandshakeFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcRspApiHandshakeField data;
CThostFtdcRspApiHandshakeFieldWrapper(const CThostFtdcRspApiHandshakeField& _data = { 0 }) :data(_data) { }
CThostFtdcRspApiHandshakeFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcRspApiHandshakeField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
data.FrontHandshakeDataLen = std::stoi(rowValue.at("FrontHandshakeDataLen"));
strncpy(data.FrontHandshakeData, rowValue.at("FrontHandshakeData").c_str(), sizeof(TThostFtdcHandshakeDataType));
data.IsApiAuthEnabled = std::stoi(rowValue.at("IsApiAuthEnabled"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
std::to_string(data.FrontHandshakeDataLen) + "','" + data.FrontHandshakeData + "','" + std::to_string(data.IsApiAuthEnabled)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcReqVerifyApiKeyFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcReqVerifyApiKeyField data;
CThostFtdcReqVerifyApiKeyFieldWrapper(const CThostFtdcReqVerifyApiKeyField& _data = { 0 }) :data(_data) { }
CThostFtdcReqVerifyApiKeyFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcReqVerifyApiKeyField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
data.ApiHandshakeDataLen = std::stoi(rowValue.at("ApiHandshakeDataLen"));
strncpy(data.ApiHandshakeData, rowValue.at("ApiHandshakeData").c_str(), sizeof(TThostFtdcHandshakeDataType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
std::to_string(data.ApiHandshakeDataLen) + "','" + data.ApiHandshakeData
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcDepartmentUserFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcDepartmentUserField data;
CThostFtdcDepartmentUserFieldWrapper(const CThostFtdcDepartmentUserField& _data = { 0 }) :data(_data) { }
CThostFtdcDepartmentUserFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcDepartmentUserField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
data.InvestorRange = rowValue.at("InvestorRange").empty() ? '0' : rowValue.at("InvestorRange")[0];
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.UserID + "','" + (data.InvestorRange == 0 ? '0' : data.InvestorRange) + "','" + data.InvestorID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcDepartmentUserField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcQueryFreqFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQueryFreqField data;
CThostFtdcQueryFreqFieldWrapper(const CThostFtdcQueryFreqField& _data = { 0 }) :data(_data) { }
CThostFtdcQueryFreqFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQueryFreqField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
data.QueryFreq = std::stoi(rowValue.at("QueryFreq"));
data.FTDPkgFreq = std::stoi(rowValue.at("FTDPkgFreq"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
std::to_string(data.QueryFreq) + "','" + std::to_string(data.FTDPkgFreq)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcAuthForbiddenIPFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcAuthForbiddenIPField data;
CThostFtdcAuthForbiddenIPFieldWrapper(const CThostFtdcAuthForbiddenIPField& _data = { 0 }) :data(_data) { }
CThostFtdcAuthForbiddenIPFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcAuthForbiddenIPField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.IPAddress, rowValue.at("IPAddress").c_str(), sizeof(TThostFtdcIPAddressType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.IPAddress
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcQryAuthForbiddenIPFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryAuthForbiddenIPField data;
CThostFtdcQryAuthForbiddenIPFieldWrapper(const CThostFtdcQryAuthForbiddenIPField& _data = { 0 }) :data(_data) { }
CThostFtdcQryAuthForbiddenIPFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryAuthForbiddenIPField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.IPAddress, rowValue.at("IPAddress").c_str(), sizeof(TThostFtdcIPAddressType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.IPAddress
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcSyncDelaySwapFrozenFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcSyncDelaySwapFrozenField data;
CThostFtdcSyncDelaySwapFrozenFieldWrapper(const CThostFtdcSyncDelaySwapFrozenField& _data = { 0 }) :data(_data) { }
CThostFtdcSyncDelaySwapFrozenFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcSyncDelaySwapFrozenField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.DelaySwapSeqNo, rowValue.at("DelaySwapSeqNo").c_str(), sizeof(TThostFtdcDepositSeqNoType));
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.FromCurrencyID, rowValue.at("FromCurrencyID").c_str(), sizeof(TThostFtdcCurrencyIDType));
data.FromRemainSwap = std::stod(rowValue.at("FromRemainSwap"));
data.IsManualSwap = std::stoi(rowValue.at("IsManualSwap"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.DelaySwapSeqNo + "','" + data.BrokerID + "','" + data.InvestorID + "','" + data.FromCurrencyID + "','" + std::to_string(data.FromRemainSwap) + "','" + std::to_string(data.IsManualSwap)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcSyncDelaySwapFrozenField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcUserSystemInfoFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcUserSystemInfoField data;
CThostFtdcUserSystemInfoFieldWrapper(const CThostFtdcUserSystemInfoField& _data = { 0 }) :data(_data) { }
CThostFtdcUserSystemInfoFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcUserSystemInfoField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
data.ClientSystemInfoLen = std::stoi(rowValue.at("ClientSystemInfoLen"));
strncpy(data.ClientSystemInfo, rowValue.at("ClientSystemInfo").c_str(), sizeof(TThostFtdcClientSystemInfoType));
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldIPAddressType));
data.ClientIPPort = std::stoi(rowValue.at("ClientIPPort"));
strncpy(data.ClientLoginTime, rowValue.at("ClientLoginTime").c_str(), sizeof(TThostFtdcTimeType));
strncpy(data.ClientAppID, rowValue.at("ClientAppID").c_str(), sizeof(TThostFtdcAppIDType));
strncpy(data.ClientPublicIP, rowValue.at("ClientPublicIP").c_str(), sizeof(TThostFtdcIPAddressType));
strncpy(data.ClientLoginRemark, rowValue.at("ClientLoginRemark").c_str(), sizeof(TThostFtdcClientLoginRemarkType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.UserID + "','" + std::to_string(data.ClientSystemInfoLen) + "','" + data.ClientSystemInfo + "','" + data.reserve1 + "','" + std::to_string(data.ClientIPPort) + "','" + data.ClientLoginTime + "','" + data.ClientAppID + "','" + data.ClientPublicIP + "','" + data.ClientLoginRemark
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.UserID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& UserID) {
return "SELECT * FROM 'CThostFtdcUserSystemInfoField' where BrokerID='" + BrokerID + "' and UserID='" + UserID + "';";
}
};
struct CThostFtdcAuthUserIDFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcAuthUserIDField data;
CThostFtdcAuthUserIDFieldWrapper(const CThostFtdcAuthUserIDField& _data = { 0 }) :data(_data) { }
CThostFtdcAuthUserIDFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcAuthUserIDField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.AppID, rowValue.at("AppID").c_str(), sizeof(TThostFtdcAppIDType));
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
data.AuthType = rowValue.at("AuthType").empty() ? '0' : rowValue.at("AuthType")[0];
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.AppID + "','" + data.UserID + "','" + (data.AuthType == 0 ? '0' : data.AuthType)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.UserID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& UserID) {
return "SELECT * FROM 'CThostFtdcAuthUserIDField' where BrokerID='" + BrokerID + "' and UserID='" + UserID + "';";
}
};
struct CThostFtdcAuthIPFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcAuthIPField data;
CThostFtdcAuthIPFieldWrapper(const CThostFtdcAuthIPField& _data = { 0 }) :data(_data) { }
CThostFtdcAuthIPFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcAuthIPField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.AppID, rowValue.at("AppID").c_str(), sizeof(TThostFtdcAppIDType));
strncpy(data.IPAddress, rowValue.at("IPAddress").c_str(), sizeof(TThostFtdcIPAddressType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.AppID + "','" + data.IPAddress
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcQryClassifiedInstrumentFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryClassifiedInstrumentField data;
CThostFtdcQryClassifiedInstrumentFieldWrapper(const CThostFtdcQryClassifiedInstrumentField& _data = { 0 }) :data(_data) { }
CThostFtdcQryClassifiedInstrumentFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryClassifiedInstrumentField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.ExchangeInstID, rowValue.at("ExchangeInstID").c_str(), sizeof(TThostFtdcExchangeInstIDType));
strncpy(data.ProductID, rowValue.at("ProductID").c_str(), sizeof(TThostFtdcInstrumentIDType));
data.TradingType = rowValue.at("TradingType").empty() ? '0' : rowValue.at("TradingType")[0];
data.ClassType = rowValue.at("ClassType").empty() ? '0' : rowValue.at("ClassType")[0];
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.InstrumentID + "','" + data.ExchangeID + "','" + data.ExchangeInstID + "','" + data.ProductID + "','" + (data.TradingType == 0 ? '0' : data.TradingType) + "','" + (data.ClassType == 0 ? '0' : data.ClassType)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcQryCombPromotionParamFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryCombPromotionParamField data;
CThostFtdcQryCombPromotionParamFieldWrapper(const CThostFtdcQryCombPromotionParamField& _data = { 0 }) :data(_data) { }
CThostFtdcQryCombPromotionParamFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryCombPromotionParamField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.ExchangeID + "','" + data.InstrumentID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcCombPromotionParamFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcCombPromotionParamField data;
CThostFtdcCombPromotionParamFieldWrapper(const CThostFtdcCombPromotionParamField& _data = { 0 }) :data(_data) { }
CThostFtdcCombPromotionParamFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcCombPromotionParamField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
strncpy(data.CombHedgeFlag, rowValue.at("CombHedgeFlag").c_str(), sizeof(TThostFtdcCombHedgeFlagType));
data.Xparameter = std::stod(rowValue.at("Xparameter"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.ExchangeID + "','" + data.InstrumentID + "','" + data.CombHedgeFlag + "','" + std::to_string(data.Xparameter)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcReqUserLoginSMFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcReqUserLoginSMField data;
CThostFtdcReqUserLoginSMFieldWrapper(const CThostFtdcReqUserLoginSMField& _data = { 0 }) :data(_data) { }
CThostFtdcReqUserLoginSMFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcReqUserLoginSMField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
strncpy(data.Password, rowValue.at("Password").c_str(), sizeof(TThostFtdcPasswordType));
strncpy(data.UserProductInfo, rowValue.at("UserProductInfo").c_str(), sizeof(TThostFtdcProductInfoType));
strncpy(data.InterfaceProductInfo, rowValue.at("InterfaceProductInfo").c_str(), sizeof(TThostFtdcProductInfoType));
strncpy(data.ProtocolInfo, rowValue.at("ProtocolInfo").c_str(), sizeof(TThostFtdcProtocolInfoType));
strncpy(data.MacAddress, rowValue.at("MacAddress").c_str(), sizeof(TThostFtdcMacAddressType));
strncpy(data.OneTimePassword, rowValue.at("OneTimePassword").c_str(), sizeof(TThostFtdcPasswordType));
strncpy(data.reserve1, rowValue.at("reserve1").c_str(), sizeof(TThostFtdcOldIPAddressType));
strncpy(data.LoginRemark, rowValue.at("LoginRemark").c_str(), sizeof(TThostFtdcLoginRemarkType));
data.ClientIPPort = std::stoi(rowValue.at("ClientIPPort"));
strncpy(data.ClientIPAddress, rowValue.at("ClientIPAddress").c_str(), sizeof(TThostFtdcIPAddressType));
strncpy(data.BrokerName, rowValue.at("BrokerName").c_str(), sizeof(TThostFtdcBrokerNameType));
strncpy(data.AuthCode, rowValue.at("AuthCode").c_str(), sizeof(TThostFtdcAuthCodeType));
strncpy(data.AppID, rowValue.at("AppID").c_str(), sizeof(TThostFtdcAppIDType));
strncpy(data.PIN, rowValue.at("PIN").c_str(), sizeof(TThostFtdcPasswordType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.TradingDay + "','" + data.BrokerID + "','" + data.UserID + "','" + data.Password + "','" + data.UserProductInfo + "','" + data.InterfaceProductInfo + "','" + data.ProtocolInfo + "','" + data.MacAddress + "','" + data.OneTimePassword + "','" + data.reserve1 + "','" + data.LoginRemark + "','" + std::to_string(data.ClientIPPort) + "','" + data.ClientIPAddress + "','" + data.BrokerName + "','" + data.AuthCode + "','" + data.AppID + "','" + data.PIN
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.UserID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& UserID) {
return "SELECT * FROM 'CThostFtdcReqUserLoginSMField' where BrokerID='" + BrokerID + "' and UserID='" + UserID + "';";
}
};
struct CThostFtdcQryRiskSettleInvstPositionFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryRiskSettleInvstPositionField data;
CThostFtdcQryRiskSettleInvstPositionFieldWrapper(const CThostFtdcQryRiskSettleInvstPositionField& _data = { 0 }) :data(_data) { }
CThostFtdcQryRiskSettleInvstPositionFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryRiskSettleInvstPositionField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorID + "','" + data.InstrumentID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcQryRiskSettleInvstPositionField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcQryRiskSettleProductStatusFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryRiskSettleProductStatusField data;
CThostFtdcQryRiskSettleProductStatusFieldWrapper(const CThostFtdcQryRiskSettleProductStatusField& _data = { 0 }) :data(_data) { }
CThostFtdcQryRiskSettleProductStatusFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryRiskSettleProductStatusField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.ProductID, rowValue.at("ProductID").c_str(), sizeof(TThostFtdcInstrumentIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.ProductID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcRiskSettleInvstPositionFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcRiskSettleInvstPositionField data;
CThostFtdcRiskSettleInvstPositionFieldWrapper(const CThostFtdcRiskSettleInvstPositionField& _data = { 0 }) :data(_data) { }
CThostFtdcRiskSettleInvstPositionFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcRiskSettleInvstPositionField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
data.PosiDirection = rowValue.at("PosiDirection").empty() ? '0' : rowValue.at("PosiDirection")[0];
data.HedgeFlag = rowValue.at("HedgeFlag").empty() ? '0' : rowValue.at("HedgeFlag")[0];
data.PositionDate = rowValue.at("PositionDate").empty() ? '0' : rowValue.at("PositionDate")[0];
data.YdPosition = std::stoi(rowValue.at("YdPosition"));
data.Position = std::stoi(rowValue.at("Position"));
data.LongFrozen = std::stoi(rowValue.at("LongFrozen"));
data.ShortFrozen = std::stoi(rowValue.at("ShortFrozen"));
data.LongFrozenAmount = std::stod(rowValue.at("LongFrozenAmount"));
data.ShortFrozenAmount = std::stod(rowValue.at("ShortFrozenAmount"));
data.OpenVolume = std::stoi(rowValue.at("OpenVolume"));
data.CloseVolume = std::stoi(rowValue.at("CloseVolume"));
data.OpenAmount = std::stod(rowValue.at("OpenAmount"));
data.CloseAmount = std::stod(rowValue.at("CloseAmount"));
data.PositionCost = std::stod(rowValue.at("PositionCost"));
data.PreMargin = std::stod(rowValue.at("PreMargin"));
data.UseMargin = std::stod(rowValue.at("UseMargin"));
data.FrozenMargin = std::stod(rowValue.at("FrozenMargin"));
data.FrozenCash = std::stod(rowValue.at("FrozenCash"));
data.FrozenCommission = std::stod(rowValue.at("FrozenCommission"));
data.CashIn = std::stod(rowValue.at("CashIn"));
data.Commission = std::stod(rowValue.at("Commission"));
data.CloseProfit = std::stod(rowValue.at("CloseProfit"));
data.PositionProfit = std::stod(rowValue.at("PositionProfit"));
data.PreSettlementPrice = std::stod(rowValue.at("PreSettlementPrice"));
data.SettlementPrice = std::stod(rowValue.at("SettlementPrice"));
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcDateType));
data.SettlementID = std::stoi(rowValue.at("SettlementID"));
data.OpenCost = std::stod(rowValue.at("OpenCost"));
data.ExchangeMargin = std::stod(rowValue.at("ExchangeMargin"));
data.CombPosition = std::stoi(rowValue.at("CombPosition"));
data.CombLongFrozen = std::stoi(rowValue.at("CombLongFrozen"));
data.CombShortFrozen = std::stoi(rowValue.at("CombShortFrozen"));
data.CloseProfitByDate = std::stod(rowValue.at("CloseProfitByDate"));
data.CloseProfitByTrade = std::stod(rowValue.at("CloseProfitByTrade"));
data.TodayPosition = std::stoi(rowValue.at("TodayPosition"));
data.MarginRateByMoney = std::stod(rowValue.at("MarginRateByMoney"));
data.MarginRateByVolume = std::stod(rowValue.at("MarginRateByVolume"));
data.StrikeFrozen = std::stoi(rowValue.at("StrikeFrozen"));
data.StrikeFrozenAmount = std::stod(rowValue.at("StrikeFrozenAmount"));
data.AbandonFrozen = std::stoi(rowValue.at("AbandonFrozen"));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
data.YdStrikeFrozen = std::stoi(rowValue.at("YdStrikeFrozen"));
strncpy(data.InvestUnitID, rowValue.at("InvestUnitID").c_str(), sizeof(TThostFtdcInvestUnitIDType));
data.PositionCostOffset = std::stod(rowValue.at("PositionCostOffset"));
data.TasPosition = std::stoi(rowValue.at("TasPosition"));
data.TasPositionCost = std::stod(rowValue.at("TasPositionCost"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.InstrumentID + "','" + data.BrokerID + "','" + data.InvestorID + "','" + (data.PosiDirection == 0 ? '0' : data.PosiDirection) + "','" + (data.HedgeFlag == 0 ? '0' : data.HedgeFlag) + "','" + (data.PositionDate == 0 ? '0' : data.PositionDate) + "','" + std::to_string(data.YdPosition) + "','" + std::to_string(data.Position) + "','" + std::to_string(data.LongFrozen) + "','" + std::to_string(data.ShortFrozen) + "','" + std::to_string(data.LongFrozenAmount) + "','" + std::to_string(data.ShortFrozenAmount) + "','" + std::to_string(data.OpenVolume) + "','" + std::to_string(data.CloseVolume) + "','" + std::to_string(data.OpenAmount) + "','" + std::to_string(data.CloseAmount) + "','" + std::to_string(data.PositionCost) + "','" + std::to_string(data.PreMargin) + "','" + std::to_string(data.UseMargin) + "','" + std::to_string(data.FrozenMargin) + "','" + std::to_string(data.FrozenCash) + "','" + std::to_string(data.FrozenCommission) + "','" + std::to_string(data.CashIn) + "','" + std::to_string(data.Commission) + "','" + std::to_string(data.CloseProfit) + "','" + std::to_string(data.PositionProfit) + "','" + std::to_string(data.PreSettlementPrice) + "','" + std::to_string(data.SettlementPrice) + "','" + data.TradingDay + "','" + std::to_string(data.SettlementID) + "','" + std::to_string(data.OpenCost) + "','" + std::to_string(data.ExchangeMargin) + "','" + std::to_string(data.CombPosition) + "','" + std::to_string(data.CombLongFrozen) + "','" + std::to_string(data.CombShortFrozen) + "','" + std::to_string(data.CloseProfitByDate) + "','" + std::to_string(data.CloseProfitByTrade) + "','" + std::to_string(data.TodayPosition) + "','" + std::to_string(data.MarginRateByMoney) + "','" + std::to_string(data.MarginRateByVolume) + "','" + std::to_string(data.StrikeFrozen) + "','" + std::to_string(data.StrikeFrozenAmount) + "','" + std::to_string(data.AbandonFrozen) + "','" + data.ExchangeID + "','" + std::to_string(data.YdStrikeFrozen) + "','" + data.InvestUnitID + "','" + std::to_string(data.PositionCostOffset) + "','" + std::to_string(data.TasPosition) + "','" + std::to_string(data.TasPositionCost)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcRiskSettleInvstPositionField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcRiskSettleProductStatusFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcRiskSettleProductStatusField data;
CThostFtdcRiskSettleProductStatusFieldWrapper(const CThostFtdcRiskSettleProductStatusField& _data = { 0 }) :data(_data) { }
CThostFtdcRiskSettleProductStatusFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcRiskSettleProductStatusField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.ProductID, rowValue.at("ProductID").c_str(), sizeof(TThostFtdcInstrumentIDType));
data.ProductStatus = rowValue.at("ProductStatus").empty() ? '0' : rowValue.at("ProductStatus")[0];
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.ExchangeID + "','" + data.ProductID + "','" + (data.ProductStatus == 0 ? '0' : data.ProductStatus)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcSyncDeltaInfoFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcSyncDeltaInfoField data;
CThostFtdcSyncDeltaInfoFieldWrapper(const CThostFtdcSyncDeltaInfoField& _data = { 0 }) :data(_data) { }
CThostFtdcSyncDeltaInfoFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcSyncDeltaInfoField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
data.SyncDeltaSequenceNo = std::stoi(rowValue.at("SyncDeltaSequenceNo"));
data.SyncDeltaStatus = rowValue.at("SyncDeltaStatus").empty() ? '0' : rowValue.at("SyncDeltaStatus")[0];
strncpy(data.SyncDescription, rowValue.at("SyncDescription").c_str(), sizeof(TThostFtdcSyncDescriptionType));
data.IsOnlyTrdDelta = std::stoi(rowValue.at("IsOnlyTrdDelta"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
std::to_string(data.SyncDeltaSequenceNo) + "','" + (data.SyncDeltaStatus == 0 ? '0' : data.SyncDeltaStatus) + "','" + data.SyncDescription + "','" + std::to_string(data.IsOnlyTrdDelta)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcSyncDeltaProductStatusFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcSyncDeltaProductStatusField data;
CThostFtdcSyncDeltaProductStatusFieldWrapper(const CThostFtdcSyncDeltaProductStatusField& _data = { 0 }) :data(_data) { }
CThostFtdcSyncDeltaProductStatusFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcSyncDeltaProductStatusField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
data.SyncDeltaSequenceNo = std::stoi(rowValue.at("SyncDeltaSequenceNo"));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.ProductID, rowValue.at("ProductID").c_str(), sizeof(TThostFtdcInstrumentIDType));
data.ProductStatus = rowValue.at("ProductStatus").empty() ? '0' : rowValue.at("ProductStatus")[0];
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
std::to_string(data.SyncDeltaSequenceNo) + "','" + data.ExchangeID + "','" + data.ProductID + "','" + (data.ProductStatus == 0 ? '0' : data.ProductStatus)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcSyncDeltaInvstPosDtlFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcSyncDeltaInvstPosDtlField data;
CThostFtdcSyncDeltaInvstPosDtlFieldWrapper(const CThostFtdcSyncDeltaInvstPosDtlField& _data = { 0 }) :data(_data) { }
CThostFtdcSyncDeltaInvstPosDtlFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcSyncDeltaInvstPosDtlField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
data.HedgeFlag = rowValue.at("HedgeFlag").empty() ? '0' : rowValue.at("HedgeFlag")[0];
data.Direction = rowValue.at("Direction").empty() ? '0' : rowValue.at("Direction")[0];
strncpy(data.OpenDate, rowValue.at("OpenDate").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.TradeID, rowValue.at("TradeID").c_str(), sizeof(TThostFtdcTradeIDType));
data.Volume = std::stoi(rowValue.at("Volume"));
data.OpenPrice = std::stod(rowValue.at("OpenPrice"));
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcDateType));
data.SettlementID = std::stoi(rowValue.at("SettlementID"));
data.TradeType = rowValue.at("TradeType").empty() ? '0' : rowValue.at("TradeType")[0];
strncpy(data.CombInstrumentID, rowValue.at("CombInstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
data.CloseProfitByDate = std::stod(rowValue.at("CloseProfitByDate"));
data.CloseProfitByTrade = std::stod(rowValue.at("CloseProfitByTrade"));
data.PositionProfitByDate = std::stod(rowValue.at("PositionProfitByDate"));
data.PositionProfitByTrade = std::stod(rowValue.at("PositionProfitByTrade"));
data.Margin = std::stod(rowValue.at("Margin"));
data.ExchMargin = std::stod(rowValue.at("ExchMargin"));
data.MarginRateByMoney = std::stod(rowValue.at("MarginRateByMoney"));
data.MarginRateByVolume = std::stod(rowValue.at("MarginRateByVolume"));
data.LastSettlementPrice = std::stod(rowValue.at("LastSettlementPrice"));
data.SettlementPrice = std::stod(rowValue.at("SettlementPrice"));
data.CloseVolume = std::stoi(rowValue.at("CloseVolume"));
data.CloseAmount = std::stod(rowValue.at("CloseAmount"));
data.TimeFirstVolume = std::stoi(rowValue.at("TimeFirstVolume"));
data.SpecPosiType = rowValue.at("SpecPosiType").empty() ? '0' : rowValue.at("SpecPosiType")[0];
data.ActionDirection = rowValue.at("ActionDirection").empty() ? '0' : rowValue.at("ActionDirection")[0];
data.SyncDeltaSequenceNo = std::stoi(rowValue.at("SyncDeltaSequenceNo"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.InstrumentID + "','" + data.BrokerID + "','" + data.InvestorID + "','" + (data.HedgeFlag == 0 ? '0' : data.HedgeFlag) + "','" + (data.Direction == 0 ? '0' : data.Direction) + "','" + data.OpenDate + "','" + data.TradeID + "','" + std::to_string(data.Volume) + "','" + std::to_string(data.OpenPrice) + "','" + data.TradingDay + "','" + std::to_string(data.SettlementID) + "','" + (data.TradeType == 0 ? '0' : data.TradeType) + "','" + data.CombInstrumentID + "','" + data.ExchangeID + "','" + std::to_string(data.CloseProfitByDate) + "','" + std::to_string(data.CloseProfitByTrade) + "','" + std::to_string(data.PositionProfitByDate) + "','" + std::to_string(data.PositionProfitByTrade) + "','" + std::to_string(data.Margin) + "','" + std::to_string(data.ExchMargin) + "','" + std::to_string(data.MarginRateByMoney) + "','" + std::to_string(data.MarginRateByVolume) + "','" + std::to_string(data.LastSettlementPrice) + "','" + std::to_string(data.SettlementPrice) + "','" + std::to_string(data.CloseVolume) + "','" + std::to_string(data.CloseAmount) + "','" + std::to_string(data.TimeFirstVolume) + "','" + (data.SpecPosiType == 0 ? '0' : data.SpecPosiType) + "','" + (data.ActionDirection == 0 ? '0' : data.ActionDirection) + "','" + std::to_string(data.SyncDeltaSequenceNo)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcSyncDeltaInvstPosDtlField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcSyncDeltaInvstPosCombDtlFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcSyncDeltaInvstPosCombDtlField data;
CThostFtdcSyncDeltaInvstPosCombDtlFieldWrapper(const CThostFtdcSyncDeltaInvstPosCombDtlField& _data = { 0 }) :data(_data) { }
CThostFtdcSyncDeltaInvstPosCombDtlFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcSyncDeltaInvstPosCombDtlField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.OpenDate, rowValue.at("OpenDate").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
data.SettlementID = std::stoi(rowValue.at("SettlementID"));
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.ComTradeID, rowValue.at("ComTradeID").c_str(), sizeof(TThostFtdcTradeIDType));
strncpy(data.TradeID, rowValue.at("TradeID").c_str(), sizeof(TThostFtdcTradeIDType));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
data.HedgeFlag = rowValue.at("HedgeFlag").empty() ? '0' : rowValue.at("HedgeFlag")[0];
data.Direction = rowValue.at("Direction").empty() ? '0' : rowValue.at("Direction")[0];
data.TotalAmt = std::stoi(rowValue.at("TotalAmt"));
data.Margin = std::stod(rowValue.at("Margin"));
data.ExchMargin = std::stod(rowValue.at("ExchMargin"));
data.MarginRateByMoney = std::stod(rowValue.at("MarginRateByMoney"));
data.MarginRateByVolume = std::stod(rowValue.at("MarginRateByVolume"));
data.LegID = std::stoi(rowValue.at("LegID"));
data.LegMultiple = std::stoi(rowValue.at("LegMultiple"));
data.TradeGroupID = std::stoi(rowValue.at("TradeGroupID"));
data.ActionDirection = rowValue.at("ActionDirection").empty() ? '0' : rowValue.at("ActionDirection")[0];
data.SyncDeltaSequenceNo = std::stoi(rowValue.at("SyncDeltaSequenceNo"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.TradingDay + "','" + data.OpenDate + "','" + data.ExchangeID + "','" + std::to_string(data.SettlementID) + "','" + data.BrokerID + "','" + data.InvestorID + "','" + data.ComTradeID + "','" + data.TradeID + "','" + data.InstrumentID + "','" + (data.HedgeFlag == 0 ? '0' : data.HedgeFlag) + "','" + (data.Direction == 0 ? '0' : data.Direction) + "','" + std::to_string(data.TotalAmt) + "','" + std::to_string(data.Margin) + "','" + std::to_string(data.ExchMargin) + "','" + std::to_string(data.MarginRateByMoney) + "','" + std::to_string(data.MarginRateByVolume) + "','" + std::to_string(data.LegID) + "','" + std::to_string(data.LegMultiple) + "','" + std::to_string(data.TradeGroupID) + "','" + (data.ActionDirection == 0 ? '0' : data.ActionDirection) + "','" + std::to_string(data.SyncDeltaSequenceNo)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcSyncDeltaInvstPosCombDtlField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcSyncDeltaTradingAccountFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcSyncDeltaTradingAccountField data;
CThostFtdcSyncDeltaTradingAccountFieldWrapper(const CThostFtdcSyncDeltaTradingAccountField& _data = { 0 }) :data(_data) { }
CThostFtdcSyncDeltaTradingAccountFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcSyncDeltaTradingAccountField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.AccountID, rowValue.at("AccountID").c_str(), sizeof(TThostFtdcAccountIDType));
data.PreMortgage = std::stod(rowValue.at("PreMortgage"));
data.PreCredit = std::stod(rowValue.at("PreCredit"));
data.PreDeposit = std::stod(rowValue.at("PreDeposit"));
data.PreBalance = std::stod(rowValue.at("PreBalance"));
data.PreMargin = std::stod(rowValue.at("PreMargin"));
data.InterestBase = std::stod(rowValue.at("InterestBase"));
data.Interest = std::stod(rowValue.at("Interest"));
data.Deposit = std::stod(rowValue.at("Deposit"));
data.Withdraw = std::stod(rowValue.at("Withdraw"));
data.FrozenMargin = std::stod(rowValue.at("FrozenMargin"));
data.FrozenCash = std::stod(rowValue.at("FrozenCash"));
data.FrozenCommission = std::stod(rowValue.at("FrozenCommission"));
data.CurrMargin = std::stod(rowValue.at("CurrMargin"));
data.CashIn = std::stod(rowValue.at("CashIn"));
data.Commission = std::stod(rowValue.at("Commission"));
data.CloseProfit = std::stod(rowValue.at("CloseProfit"));
data.PositionProfit = std::stod(rowValue.at("PositionProfit"));
data.Balance = std::stod(rowValue.at("Balance"));
data.Available = std::stod(rowValue.at("Available"));
data.WithdrawQuota = std::stod(rowValue.at("WithdrawQuota"));
data.Reserve = std::stod(rowValue.at("Reserve"));
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcDateType));
data.SettlementID = std::stoi(rowValue.at("SettlementID"));
data.Credit = std::stod(rowValue.at("Credit"));
data.Mortgage = std::stod(rowValue.at("Mortgage"));
data.ExchangeMargin = std::stod(rowValue.at("ExchangeMargin"));
data.DeliveryMargin = std::stod(rowValue.at("DeliveryMargin"));
data.ExchangeDeliveryMargin = std::stod(rowValue.at("ExchangeDeliveryMargin"));
data.ReserveBalance = std::stod(rowValue.at("ReserveBalance"));
strncpy(data.CurrencyID, rowValue.at("CurrencyID").c_str(), sizeof(TThostFtdcCurrencyIDType));
data.PreFundMortgageIn = std::stod(rowValue.at("PreFundMortgageIn"));
data.PreFundMortgageOut = std::stod(rowValue.at("PreFundMortgageOut"));
data.FundMortgageIn = std::stod(rowValue.at("FundMortgageIn"));
data.FundMortgageOut = std::stod(rowValue.at("FundMortgageOut"));
data.FundMortgageAvailable = std::stod(rowValue.at("FundMortgageAvailable"));
data.MortgageableFund = std::stod(rowValue.at("MortgageableFund"));
data.SpecProductMargin = std::stod(rowValue.at("SpecProductMargin"));
data.SpecProductFrozenMargin = std::stod(rowValue.at("SpecProductFrozenMargin"));
data.SpecProductCommission = std::stod(rowValue.at("SpecProductCommission"));
data.SpecProductFrozenCommission = std::stod(rowValue.at("SpecProductFrozenCommission"));
data.SpecProductPositionProfit = std::stod(rowValue.at("SpecProductPositionProfit"));
data.SpecProductCloseProfit = std::stod(rowValue.at("SpecProductCloseProfit"));
data.SpecProductPositionProfitByAlg = std::stod(rowValue.at("SpecProductPositionProfitByAlg"));
data.SpecProductExchangeMargin = std::stod(rowValue.at("SpecProductExchangeMargin"));
data.FrozenSwap = std::stod(rowValue.at("FrozenSwap"));
data.RemainSwap = std::stod(rowValue.at("RemainSwap"));
data.OptionValue = std::stod(rowValue.at("OptionValue"));
data.SyncDeltaSequenceNo = std::stoi(rowValue.at("SyncDeltaSequenceNo"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.AccountID + "','" + std::to_string(data.PreMortgage) + "','" + std::to_string(data.PreCredit) + "','" + std::to_string(data.PreDeposit) + "','" + std::to_string(data.PreBalance) + "','" + std::to_string(data.PreMargin) + "','" + std::to_string(data.InterestBase) + "','" + std::to_string(data.Interest) + "','" + std::to_string(data.Deposit) + "','" + std::to_string(data.Withdraw) + "','" + std::to_string(data.FrozenMargin) + "','" + std::to_string(data.FrozenCash) + "','" + std::to_string(data.FrozenCommission) + "','" + std::to_string(data.CurrMargin) + "','" + std::to_string(data.CashIn) + "','" + std::to_string(data.Commission) + "','" + std::to_string(data.CloseProfit) + "','" + std::to_string(data.PositionProfit) + "','" + std::to_string(data.Balance) + "','" + std::to_string(data.Available) + "','" + std::to_string(data.WithdrawQuota) + "','" + std::to_string(data.Reserve) + "','" + data.TradingDay + "','" + std::to_string(data.SettlementID) + "','" + std::to_string(data.Credit) + "','" + std::to_string(data.Mortgage) + "','" + std::to_string(data.ExchangeMargin) + "','" + std::to_string(data.DeliveryMargin) + "','" + std::to_string(data.ExchangeDeliveryMargin) + "','" + std::to_string(data.ReserveBalance) + "','" + data.CurrencyID + "','" + std::to_string(data.PreFundMortgageIn) + "','" + std::to_string(data.PreFundMortgageOut) + "','" + std::to_string(data.FundMortgageIn) + "','" + std::to_string(data.FundMortgageOut) + "','" + std::to_string(data.FundMortgageAvailable) + "','" + std::to_string(data.MortgageableFund) + "','" + std::to_string(data.SpecProductMargin) + "','" + std::to_string(data.SpecProductFrozenMargin) + "','" + std::to_string(data.SpecProductCommission) + "','" + std::to_string(data.SpecProductFrozenCommission) + "','" + std::to_string(data.SpecProductPositionProfit) + "','" + std::to_string(data.SpecProductCloseProfit) + "','" + std::to_string(data.SpecProductPositionProfitByAlg) + "','" + std::to_string(data.SpecProductExchangeMargin) + "','" + std::to_string(data.FrozenSwap) + "','" + std::to_string(data.RemainSwap) + "','" + std::to_string(data.OptionValue) + "','" + std::to_string(data.SyncDeltaSequenceNo)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.AccountID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& AccountID) {
return "SELECT * FROM 'CThostFtdcSyncDeltaTradingAccountField' where BrokerID='" + BrokerID + "' and AccountID='" + AccountID + "';";
}
};
struct CThostFtdcSyncDeltaInitInvstMarginFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcSyncDeltaInitInvstMarginField data;
CThostFtdcSyncDeltaInitInvstMarginFieldWrapper(const CThostFtdcSyncDeltaInitInvstMarginField& _data = { 0 }) :data(_data) { }
CThostFtdcSyncDeltaInitInvstMarginFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcSyncDeltaInitInvstMarginField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
data.LastRiskTotalInvstMargin = std::stod(rowValue.at("LastRiskTotalInvstMargin"));
data.LastRiskTotalExchMargin = std::stod(rowValue.at("LastRiskTotalExchMargin"));
data.ThisSyncInvstMargin = std::stod(rowValue.at("ThisSyncInvstMargin"));
data.ThisSyncExchMargin = std::stod(rowValue.at("ThisSyncExchMargin"));
data.RemainRiskInvstMargin = std::stod(rowValue.at("RemainRiskInvstMargin"));
data.RemainRiskExchMargin = std::stod(rowValue.at("RemainRiskExchMargin"));
data.LastRiskSpecTotalInvstMargin = std::stod(rowValue.at("LastRiskSpecTotalInvstMargin"));
data.LastRiskSpecTotalExchMargin = std::stod(rowValue.at("LastRiskSpecTotalExchMargin"));
data.ThisSyncSpecInvstMargin = std::stod(rowValue.at("ThisSyncSpecInvstMargin"));
data.ThisSyncSpecExchMargin = std::stod(rowValue.at("ThisSyncSpecExchMargin"));
data.RemainRiskSpecInvstMargin = std::stod(rowValue.at("RemainRiskSpecInvstMargin"));
data.RemainRiskSpecExchMargin = std::stod(rowValue.at("RemainRiskSpecExchMargin"));
data.SyncDeltaSequenceNo = std::stoi(rowValue.at("SyncDeltaSequenceNo"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorID + "','" + std::to_string(data.LastRiskTotalInvstMargin) + "','" + std::to_string(data.LastRiskTotalExchMargin) + "','" + std::to_string(data.ThisSyncInvstMargin) + "','" + std::to_string(data.ThisSyncExchMargin) + "','" + std::to_string(data.RemainRiskInvstMargin) + "','" + std::to_string(data.RemainRiskExchMargin) + "','" + std::to_string(data.LastRiskSpecTotalInvstMargin) + "','" + std::to_string(data.LastRiskSpecTotalExchMargin) + "','" + std::to_string(data.ThisSyncSpecInvstMargin) + "','" + std::to_string(data.ThisSyncSpecExchMargin) + "','" + std::to_string(data.RemainRiskSpecInvstMargin) + "','" + std::to_string(data.RemainRiskSpecExchMargin) + "','" + std::to_string(data.SyncDeltaSequenceNo)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcSyncDeltaInitInvstMarginField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcSyncDeltaDceCombInstrumentFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcSyncDeltaDceCombInstrumentField data;
CThostFtdcSyncDeltaDceCombInstrumentFieldWrapper(const CThostFtdcSyncDeltaDceCombInstrumentField& _data = { 0 }) :data(_data) { }
CThostFtdcSyncDeltaDceCombInstrumentFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcSyncDeltaDceCombInstrumentField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.CombInstrumentID, rowValue.at("CombInstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.ExchangeInstID, rowValue.at("ExchangeInstID").c_str(), sizeof(TThostFtdcExchangeInstIDType));
data.TradeGroupID = std::stoi(rowValue.at("TradeGroupID"));
data.CombHedgeFlag = rowValue.at("CombHedgeFlag").empty() ? '0' : rowValue.at("CombHedgeFlag")[0];
data.CombinationType = rowValue.at("CombinationType").empty() ? '0' : rowValue.at("CombinationType")[0];
data.Direction = rowValue.at("Direction").empty() ? '0' : rowValue.at("Direction")[0];
strncpy(data.ProductID, rowValue.at("ProductID").c_str(), sizeof(TThostFtdcInstrumentIDType));
data.Xparameter = std::stod(rowValue.at("Xparameter"));
data.ActionDirection = rowValue.at("ActionDirection").empty() ? '0' : rowValue.at("ActionDirection")[0];
data.SyncDeltaSequenceNo = std::stoi(rowValue.at("SyncDeltaSequenceNo"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.CombInstrumentID + "','" + data.ExchangeID + "','" + data.ExchangeInstID + "','" + std::to_string(data.TradeGroupID) + "','" + (data.CombHedgeFlag == 0 ? '0' : data.CombHedgeFlag) + "','" + (data.CombinationType == 0 ? '0' : data.CombinationType) + "','" + (data.Direction == 0 ? '0' : data.Direction) + "','" + data.ProductID + "','" + std::to_string(data.Xparameter) + "','" + (data.ActionDirection == 0 ? '0' : data.ActionDirection) + "','" + std::to_string(data.SyncDeltaSequenceNo)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcSyncDeltaInvstMarginRateFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcSyncDeltaInvstMarginRateField data;
CThostFtdcSyncDeltaInvstMarginRateFieldWrapper(const CThostFtdcSyncDeltaInvstMarginRateField& _data = { 0 }) :data(_data) { }
CThostFtdcSyncDeltaInvstMarginRateFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcSyncDeltaInvstMarginRateField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
data.InvestorRange = rowValue.at("InvestorRange").empty() ? '0' : rowValue.at("InvestorRange")[0];
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
data.HedgeFlag = rowValue.at("HedgeFlag").empty() ? '0' : rowValue.at("HedgeFlag")[0];
data.LongMarginRatioByMoney = std::stod(rowValue.at("LongMarginRatioByMoney"));
data.LongMarginRatioByVolume = std::stod(rowValue.at("LongMarginRatioByVolume"));
data.ShortMarginRatioByMoney = std::stod(rowValue.at("ShortMarginRatioByMoney"));
data.ShortMarginRatioByVolume = std::stod(rowValue.at("ShortMarginRatioByVolume"));
data.IsRelative = std::stoi(rowValue.at("IsRelative"));
data.ActionDirection = rowValue.at("ActionDirection").empty() ? '0' : rowValue.at("ActionDirection")[0];
data.SyncDeltaSequenceNo = std::stoi(rowValue.at("SyncDeltaSequenceNo"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.InstrumentID + "','" + (data.InvestorRange == 0 ? '0' : data.InvestorRange) + "','" + data.BrokerID + "','" + data.InvestorID + "','" + (data.HedgeFlag == 0 ? '0' : data.HedgeFlag) + "','" + std::to_string(data.LongMarginRatioByMoney) + "','" + std::to_string(data.LongMarginRatioByVolume) + "','" + std::to_string(data.ShortMarginRatioByMoney) + "','" + std::to_string(data.ShortMarginRatioByVolume) + "','" + std::to_string(data.IsRelative) + "','" + (data.ActionDirection == 0 ? '0' : data.ActionDirection) + "','" + std::to_string(data.SyncDeltaSequenceNo)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcSyncDeltaInvstMarginRateField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcSyncDeltaExchMarginRateFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcSyncDeltaExchMarginRateField data;
CThostFtdcSyncDeltaExchMarginRateFieldWrapper(const CThostFtdcSyncDeltaExchMarginRateField& _data = { 0 }) :data(_data) { }
CThostFtdcSyncDeltaExchMarginRateFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcSyncDeltaExchMarginRateField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
data.HedgeFlag = rowValue.at("HedgeFlag").empty() ? '0' : rowValue.at("HedgeFlag")[0];
data.LongMarginRatioByMoney = std::stod(rowValue.at("LongMarginRatioByMoney"));
data.LongMarginRatioByVolume = std::stod(rowValue.at("LongMarginRatioByVolume"));
data.ShortMarginRatioByMoney = std::stod(rowValue.at("ShortMarginRatioByMoney"));
data.ShortMarginRatioByVolume = std::stod(rowValue.at("ShortMarginRatioByVolume"));
data.ActionDirection = rowValue.at("ActionDirection").empty() ? '0' : rowValue.at("ActionDirection")[0];
data.SyncDeltaSequenceNo = std::stoi(rowValue.at("SyncDeltaSequenceNo"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InstrumentID + "','" + (data.HedgeFlag == 0 ? '0' : data.HedgeFlag) + "','" + std::to_string(data.LongMarginRatioByMoney) + "','" + std::to_string(data.LongMarginRatioByVolume) + "','" + std::to_string(data.ShortMarginRatioByMoney) + "','" + std::to_string(data.ShortMarginRatioByVolume) + "','" + (data.ActionDirection == 0 ? '0' : data.ActionDirection) + "','" + std::to_string(data.SyncDeltaSequenceNo)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcSyncDeltaOptExchMarginFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcSyncDeltaOptExchMarginField data;
CThostFtdcSyncDeltaOptExchMarginFieldWrapper(const CThostFtdcSyncDeltaOptExchMarginField& _data = { 0 }) :data(_data) { }
CThostFtdcSyncDeltaOptExchMarginFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcSyncDeltaOptExchMarginField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
data.SShortMarginRatioByMoney = std::stod(rowValue.at("SShortMarginRatioByMoney"));
data.SShortMarginRatioByVolume = std::stod(rowValue.at("SShortMarginRatioByVolume"));
data.HShortMarginRatioByMoney = std::stod(rowValue.at("HShortMarginRatioByMoney"));
data.HShortMarginRatioByVolume = std::stod(rowValue.at("HShortMarginRatioByVolume"));
data.AShortMarginRatioByMoney = std::stod(rowValue.at("AShortMarginRatioByMoney"));
data.AShortMarginRatioByVolume = std::stod(rowValue.at("AShortMarginRatioByVolume"));
data.MShortMarginRatioByMoney = std::stod(rowValue.at("MShortMarginRatioByMoney"));
data.MShortMarginRatioByVolume = std::stod(rowValue.at("MShortMarginRatioByVolume"));
data.ActionDirection = rowValue.at("ActionDirection").empty() ? '0' : rowValue.at("ActionDirection")[0];
data.SyncDeltaSequenceNo = std::stoi(rowValue.at("SyncDeltaSequenceNo"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InstrumentID + "','" + std::to_string(data.SShortMarginRatioByMoney) + "','" + std::to_string(data.SShortMarginRatioByVolume) + "','" + std::to_string(data.HShortMarginRatioByMoney) + "','" + std::to_string(data.HShortMarginRatioByVolume) + "','" + std::to_string(data.AShortMarginRatioByMoney) + "','" + std::to_string(data.AShortMarginRatioByVolume) + "','" + std::to_string(data.MShortMarginRatioByMoney) + "','" + std::to_string(data.MShortMarginRatioByVolume) + "','" + (data.ActionDirection == 0 ? '0' : data.ActionDirection) + "','" + std::to_string(data.SyncDeltaSequenceNo)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcSyncDeltaOptInvstMarginFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcSyncDeltaOptInvstMarginField data;
CThostFtdcSyncDeltaOptInvstMarginFieldWrapper(const CThostFtdcSyncDeltaOptInvstMarginField& _data = { 0 }) :data(_data) { }
CThostFtdcSyncDeltaOptInvstMarginFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcSyncDeltaOptInvstMarginField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
data.InvestorRange = rowValue.at("InvestorRange").empty() ? '0' : rowValue.at("InvestorRange")[0];
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
data.SShortMarginRatioByMoney = std::stod(rowValue.at("SShortMarginRatioByMoney"));
data.SShortMarginRatioByVolume = std::stod(rowValue.at("SShortMarginRatioByVolume"));
data.HShortMarginRatioByMoney = std::stod(rowValue.at("HShortMarginRatioByMoney"));
data.HShortMarginRatioByVolume = std::stod(rowValue.at("HShortMarginRatioByVolume"));
data.AShortMarginRatioByMoney = std::stod(rowValue.at("AShortMarginRatioByMoney"));
data.AShortMarginRatioByVolume = std::stod(rowValue.at("AShortMarginRatioByVolume"));
data.IsRelative = std::stoi(rowValue.at("IsRelative"));
data.MShortMarginRatioByMoney = std::stod(rowValue.at("MShortMarginRatioByMoney"));
data.MShortMarginRatioByVolume = std::stod(rowValue.at("MShortMarginRatioByVolume"));
data.ActionDirection = rowValue.at("ActionDirection").empty() ? '0' : rowValue.at("ActionDirection")[0];
data.SyncDeltaSequenceNo = std::stoi(rowValue.at("SyncDeltaSequenceNo"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.InstrumentID + "','" + (data.InvestorRange == 0 ? '0' : data.InvestorRange) + "','" + data.BrokerID + "','" + data.InvestorID + "','" + std::to_string(data.SShortMarginRatioByMoney) + "','" + std::to_string(data.SShortMarginRatioByVolume) + "','" + std::to_string(data.HShortMarginRatioByMoney) + "','" + std::to_string(data.HShortMarginRatioByVolume) + "','" + std::to_string(data.AShortMarginRatioByMoney) + "','" + std::to_string(data.AShortMarginRatioByVolume) + "','" + std::to_string(data.IsRelative) + "','" + std::to_string(data.MShortMarginRatioByMoney) + "','" + std::to_string(data.MShortMarginRatioByVolume) + "','" + (data.ActionDirection == 0 ? '0' : data.ActionDirection) + "','" + std::to_string(data.SyncDeltaSequenceNo)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcSyncDeltaOptInvstMarginField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcSyncDeltaInvstMarginRateULFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcSyncDeltaInvstMarginRateULField data;
CThostFtdcSyncDeltaInvstMarginRateULFieldWrapper(const CThostFtdcSyncDeltaInvstMarginRateULField& _data = { 0 }) :data(_data) { }
CThostFtdcSyncDeltaInvstMarginRateULFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcSyncDeltaInvstMarginRateULField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
data.InvestorRange = rowValue.at("InvestorRange").empty() ? '0' : rowValue.at("InvestorRange")[0];
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
data.HedgeFlag = rowValue.at("HedgeFlag").empty() ? '0' : rowValue.at("HedgeFlag")[0];
data.LongMarginRatioByMoney = std::stod(rowValue.at("LongMarginRatioByMoney"));
data.LongMarginRatioByVolume = std::stod(rowValue.at("LongMarginRatioByVolume"));
data.ShortMarginRatioByMoney = std::stod(rowValue.at("ShortMarginRatioByMoney"));
data.ShortMarginRatioByVolume = std::stod(rowValue.at("ShortMarginRatioByVolume"));
data.ActionDirection = rowValue.at("ActionDirection").empty() ? '0' : rowValue.at("ActionDirection")[0];
data.SyncDeltaSequenceNo = std::stoi(rowValue.at("SyncDeltaSequenceNo"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.InstrumentID + "','" + (data.InvestorRange == 0 ? '0' : data.InvestorRange) + "','" + data.BrokerID + "','" + data.InvestorID + "','" + (data.HedgeFlag == 0 ? '0' : data.HedgeFlag) + "','" + std::to_string(data.LongMarginRatioByMoney) + "','" + std::to_string(data.LongMarginRatioByVolume) + "','" + std::to_string(data.ShortMarginRatioByMoney) + "','" + std::to_string(data.ShortMarginRatioByVolume) + "','" + (data.ActionDirection == 0 ? '0' : data.ActionDirection) + "','" + std::to_string(data.SyncDeltaSequenceNo)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcSyncDeltaInvstMarginRateULField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcSyncDeltaOptInvstCommRateFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcSyncDeltaOptInvstCommRateField data;
CThostFtdcSyncDeltaOptInvstCommRateFieldWrapper(const CThostFtdcSyncDeltaOptInvstCommRateField& _data = { 0 }) :data(_data) { }
CThostFtdcSyncDeltaOptInvstCommRateFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcSyncDeltaOptInvstCommRateField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
data.InvestorRange = rowValue.at("InvestorRange").empty() ? '0' : rowValue.at("InvestorRange")[0];
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
data.OpenRatioByMoney = std::stod(rowValue.at("OpenRatioByMoney"));
data.OpenRatioByVolume = std::stod(rowValue.at("OpenRatioByVolume"));
data.CloseRatioByMoney = std::stod(rowValue.at("CloseRatioByMoney"));
data.CloseRatioByVolume = std::stod(rowValue.at("CloseRatioByVolume"));
data.CloseTodayRatioByMoney = std::stod(rowValue.at("CloseTodayRatioByMoney"));
data.CloseTodayRatioByVolume = std::stod(rowValue.at("CloseTodayRatioByVolume"));
data.StrikeRatioByMoney = std::stod(rowValue.at("StrikeRatioByMoney"));
data.StrikeRatioByVolume = std::stod(rowValue.at("StrikeRatioByVolume"));
data.ActionDirection = rowValue.at("ActionDirection").empty() ? '0' : rowValue.at("ActionDirection")[0];
data.SyncDeltaSequenceNo = std::stoi(rowValue.at("SyncDeltaSequenceNo"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.InstrumentID + "','" + (data.InvestorRange == 0 ? '0' : data.InvestorRange) + "','" + data.BrokerID + "','" + data.InvestorID + "','" + std::to_string(data.OpenRatioByMoney) + "','" + std::to_string(data.OpenRatioByVolume) + "','" + std::to_string(data.CloseRatioByMoney) + "','" + std::to_string(data.CloseRatioByVolume) + "','" + std::to_string(data.CloseTodayRatioByMoney) + "','" + std::to_string(data.CloseTodayRatioByVolume) + "','" + std::to_string(data.StrikeRatioByMoney) + "','" + std::to_string(data.StrikeRatioByVolume) + "','" + (data.ActionDirection == 0 ? '0' : data.ActionDirection) + "','" + std::to_string(data.SyncDeltaSequenceNo)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcSyncDeltaOptInvstCommRateField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcSyncDeltaInvstCommRateFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcSyncDeltaInvstCommRateField data;
CThostFtdcSyncDeltaInvstCommRateFieldWrapper(const CThostFtdcSyncDeltaInvstCommRateField& _data = { 0 }) :data(_data) { }
CThostFtdcSyncDeltaInvstCommRateFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcSyncDeltaInvstCommRateField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
data.InvestorRange = rowValue.at("InvestorRange").empty() ? '0' : rowValue.at("InvestorRange")[0];
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
data.OpenRatioByMoney = std::stod(rowValue.at("OpenRatioByMoney"));
data.OpenRatioByVolume = std::stod(rowValue.at("OpenRatioByVolume"));
data.CloseRatioByMoney = std::stod(rowValue.at("CloseRatioByMoney"));
data.CloseRatioByVolume = std::stod(rowValue.at("CloseRatioByVolume"));
data.CloseTodayRatioByMoney = std::stod(rowValue.at("CloseTodayRatioByMoney"));
data.CloseTodayRatioByVolume = std::stod(rowValue.at("CloseTodayRatioByVolume"));
data.ActionDirection = rowValue.at("ActionDirection").empty() ? '0' : rowValue.at("ActionDirection")[0];
data.SyncDeltaSequenceNo = std::stoi(rowValue.at("SyncDeltaSequenceNo"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.InstrumentID + "','" + (data.InvestorRange == 0 ? '0' : data.InvestorRange) + "','" + data.BrokerID + "','" + data.InvestorID + "','" + std::to_string(data.OpenRatioByMoney) + "','" + std::to_string(data.OpenRatioByVolume) + "','" + std::to_string(data.CloseRatioByMoney) + "','" + std::to_string(data.CloseRatioByVolume) + "','" + std::to_string(data.CloseTodayRatioByMoney) + "','" + std::to_string(data.CloseTodayRatioByVolume) + "','" + (data.ActionDirection == 0 ? '0' : data.ActionDirection) + "','" + std::to_string(data.SyncDeltaSequenceNo)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcSyncDeltaInvstCommRateField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcSyncDeltaProductExchRateFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcSyncDeltaProductExchRateField data;
CThostFtdcSyncDeltaProductExchRateFieldWrapper(const CThostFtdcSyncDeltaProductExchRateField& _data = { 0 }) :data(_data) { }
CThostFtdcSyncDeltaProductExchRateFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcSyncDeltaProductExchRateField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.ProductID, rowValue.at("ProductID").c_str(), sizeof(TThostFtdcInstrumentIDType));
strncpy(data.QuoteCurrencyID, rowValue.at("QuoteCurrencyID").c_str(), sizeof(TThostFtdcCurrencyIDType));
data.ExchangeRate = std::stod(rowValue.at("ExchangeRate"));
data.ActionDirection = rowValue.at("ActionDirection").empty() ? '0' : rowValue.at("ActionDirection")[0];
data.SyncDeltaSequenceNo = std::stoi(rowValue.at("SyncDeltaSequenceNo"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.ProductID + "','" + data.QuoteCurrencyID + "','" + std::to_string(data.ExchangeRate) + "','" + (data.ActionDirection == 0 ? '0' : data.ActionDirection) + "','" + std::to_string(data.SyncDeltaSequenceNo)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcSyncDeltaDepthMarketDataFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcSyncDeltaDepthMarketDataField data;
CThostFtdcSyncDeltaDepthMarketDataFieldWrapper(const CThostFtdcSyncDeltaDepthMarketDataField& _data = { 0 }) :data(_data) { }
CThostFtdcSyncDeltaDepthMarketDataFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcSyncDeltaDepthMarketDataField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.ExchangeInstID, rowValue.at("ExchangeInstID").c_str(), sizeof(TThostFtdcExchangeInstIDType));
data.LastPrice = std::stod(rowValue.at("LastPrice"));
data.PreSettlementPrice = std::stod(rowValue.at("PreSettlementPrice"));
data.PreClosePrice = std::stod(rowValue.at("PreClosePrice"));
data.PreOpenInterest = std::stod(rowValue.at("PreOpenInterest"));
data.OpenPrice = std::stod(rowValue.at("OpenPrice"));
data.HighestPrice = std::stod(rowValue.at("HighestPrice"));
data.LowestPrice = std::stod(rowValue.at("LowestPrice"));
data.Volume = std::stoi(rowValue.at("Volume"));
data.Turnover = std::stod(rowValue.at("Turnover"));
data.OpenInterest = std::stod(rowValue.at("OpenInterest"));
data.ClosePrice = std::stod(rowValue.at("ClosePrice"));
data.SettlementPrice = std::stod(rowValue.at("SettlementPrice"));
data.UpperLimitPrice = std::stod(rowValue.at("UpperLimitPrice"));
data.LowerLimitPrice = std::stod(rowValue.at("LowerLimitPrice"));
data.PreDelta = std::stod(rowValue.at("PreDelta"));
data.CurrDelta = std::stod(rowValue.at("CurrDelta"));
strncpy(data.UpdateTime, rowValue.at("UpdateTime").c_str(), sizeof(TThostFtdcTimeType));
data.UpdateMillisec = std::stoi(rowValue.at("UpdateMillisec"));
data.BidPrice1 = std::stod(rowValue.at("BidPrice1"));
data.BidVolume1 = std::stoi(rowValue.at("BidVolume1"));
data.AskPrice1 = std::stod(rowValue.at("AskPrice1"));
data.AskVolume1 = std::stoi(rowValue.at("AskVolume1"));
data.BidPrice2 = std::stod(rowValue.at("BidPrice2"));
data.BidVolume2 = std::stoi(rowValue.at("BidVolume2"));
data.AskPrice2 = std::stod(rowValue.at("AskPrice2"));
data.AskVolume2 = std::stoi(rowValue.at("AskVolume2"));
data.BidPrice3 = std::stod(rowValue.at("BidPrice3"));
data.BidVolume3 = std::stoi(rowValue.at("BidVolume3"));
data.AskPrice3 = std::stod(rowValue.at("AskPrice3"));
data.AskVolume3 = std::stoi(rowValue.at("AskVolume3"));
data.BidPrice4 = std::stod(rowValue.at("BidPrice4"));
data.BidVolume4 = std::stoi(rowValue.at("BidVolume4"));
data.AskPrice4 = std::stod(rowValue.at("AskPrice4"));
data.AskVolume4 = std::stoi(rowValue.at("AskVolume4"));
data.BidPrice5 = std::stod(rowValue.at("BidPrice5"));
data.BidVolume5 = std::stoi(rowValue.at("BidVolume5"));
data.AskPrice5 = std::stod(rowValue.at("AskPrice5"));
data.AskVolume5 = std::stoi(rowValue.at("AskVolume5"));
data.AveragePrice = std::stod(rowValue.at("AveragePrice"));
strncpy(data.ActionDay, rowValue.at("ActionDay").c_str(), sizeof(TThostFtdcDateType));
data.BandingUpperPrice = std::stod(rowValue.at("BandingUpperPrice"));
data.BandingLowerPrice = std::stod(rowValue.at("BandingLowerPrice"));
data.ActionDirection = rowValue.at("ActionDirection").empty() ? '0' : rowValue.at("ActionDirection")[0];
data.SyncDeltaSequenceNo = std::stoi(rowValue.at("SyncDeltaSequenceNo"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.TradingDay + "','" + data.InstrumentID + "','" + data.ExchangeID + "','" + data.ExchangeInstID + "','" + std::to_string(data.LastPrice) + "','" + std::to_string(data.PreSettlementPrice) + "','" + std::to_string(data.PreClosePrice) + "','" + std::to_string(data.PreOpenInterest) + "','" + std::to_string(data.OpenPrice) + "','" + std::to_string(data.HighestPrice) + "','" + std::to_string(data.LowestPrice) + "','" + std::to_string(data.Volume) + "','" + std::to_string(data.Turnover) + "','" + std::to_string(data.OpenInterest) + "','" + std::to_string(data.ClosePrice) + "','" + std::to_string(data.SettlementPrice) + "','" + std::to_string(data.UpperLimitPrice) + "','" + std::to_string(data.LowerLimitPrice) + "','" + std::to_string(data.PreDelta) + "','" + std::to_string(data.CurrDelta) + "','" + data.UpdateTime + "','" + std::to_string(data.UpdateMillisec) + "','" + std::to_string(data.BidPrice1) + "','" + std::to_string(data.BidVolume1) + "','" + std::to_string(data.AskPrice1) + "','" + std::to_string(data.AskVolume1) + "','" + std::to_string(data.BidPrice2) + "','" + std::to_string(data.BidVolume2) + "','" + std::to_string(data.AskPrice2) + "','" + std::to_string(data.AskVolume2) + "','" + std::to_string(data.BidPrice3) + "','" + std::to_string(data.BidVolume3) + "','" + std::to_string(data.AskPrice3) + "','" + std::to_string(data.AskVolume3) + "','" + std::to_string(data.BidPrice4) + "','" + std::to_string(data.BidVolume4) + "','" + std::to_string(data.AskPrice4) + "','" + std::to_string(data.AskVolume4) + "','" + std::to_string(data.BidPrice5) + "','" + std::to_string(data.BidVolume5) + "','" + std::to_string(data.AskPrice5) + "','" + std::to_string(data.AskVolume5) + "','" + std::to_string(data.AveragePrice) + "','" + data.ActionDay + "','" + std::to_string(data.BandingUpperPrice) + "','" + std::to_string(data.BandingLowerPrice) + "','" + (data.ActionDirection == 0 ? '0' : data.ActionDirection) + "','" + std::to_string(data.SyncDeltaSequenceNo)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcSyncDeltaIndexPriceFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcSyncDeltaIndexPriceField data;
CThostFtdcSyncDeltaIndexPriceFieldWrapper(const CThostFtdcSyncDeltaIndexPriceField& _data = { 0 }) :data(_data) { }
CThostFtdcSyncDeltaIndexPriceFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcSyncDeltaIndexPriceField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
data.ClosePrice = std::stod(rowValue.at("ClosePrice"));
data.ActionDirection = rowValue.at("ActionDirection").empty() ? '0' : rowValue.at("ActionDirection")[0];
data.SyncDeltaSequenceNo = std::stoi(rowValue.at("SyncDeltaSequenceNo"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InstrumentID + "','" + std::to_string(data.ClosePrice) + "','" + (data.ActionDirection == 0 ? '0' : data.ActionDirection) + "','" + std::to_string(data.SyncDeltaSequenceNo)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcSyncDeltaEWarrantOffsetFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcSyncDeltaEWarrantOffsetField data;
CThostFtdcSyncDeltaEWarrantOffsetFieldWrapper(const CThostFtdcSyncDeltaEWarrantOffsetField& _data = { 0 }) :data(_data) { }
CThostFtdcSyncDeltaEWarrantOffsetFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcSyncDeltaEWarrantOffsetField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcTradeDateType));
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
data.Direction = rowValue.at("Direction").empty() ? '0' : rowValue.at("Direction")[0];
data.HedgeFlag = rowValue.at("HedgeFlag").empty() ? '0' : rowValue.at("HedgeFlag")[0];
data.Volume = std::stoi(rowValue.at("Volume"));
data.ActionDirection = rowValue.at("ActionDirection").empty() ? '0' : rowValue.at("ActionDirection")[0];
data.SyncDeltaSequenceNo = std::stoi(rowValue.at("SyncDeltaSequenceNo"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.TradingDay + "','" + data.BrokerID + "','" + data.InvestorID + "','" + data.ExchangeID + "','" + data.InstrumentID + "','" + (data.Direction == 0 ? '0' : data.Direction) + "','" + (data.HedgeFlag == 0 ? '0' : data.HedgeFlag) + "','" + std::to_string(data.Volume) + "','" + (data.ActionDirection == 0 ? '0' : data.ActionDirection) + "','" + std::to_string(data.SyncDeltaSequenceNo)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcSyncDeltaEWarrantOffsetField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcSPBMFutureParameterFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcSPBMFutureParameterField data;
CThostFtdcSPBMFutureParameterFieldWrapper(const CThostFtdcSPBMFutureParameterField& _data = { 0 }) :data(_data) { }
CThostFtdcSPBMFutureParameterFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcSPBMFutureParameterField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
strncpy(data.ProdFamilyCode, rowValue.at("ProdFamilyCode").c_str(), sizeof(TThostFtdcInstrumentIDType));
data.Cvf = std::stoi(rowValue.at("Cvf"));
data.TimeRange = rowValue.at("TimeRange").empty() ? '0' : rowValue.at("TimeRange")[0];
data.MarginRate = std::stod(rowValue.at("MarginRate"));
data.LockRateX = std::stod(rowValue.at("LockRateX"));
data.AddOnRate = std::stod(rowValue.at("AddOnRate"));
data.PreSettlementPrice = std::stod(rowValue.at("PreSettlementPrice"));
data.AddOnLockRateX2 = std::stod(rowValue.at("AddOnLockRateX2"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.TradingDay + "','" + data.ExchangeID + "','" + data.InstrumentID + "','" + data.ProdFamilyCode + "','" + std::to_string(data.Cvf) + "','" + (data.TimeRange == 0 ? '0' : data.TimeRange) + "','" + std::to_string(data.MarginRate) + "','" + std::to_string(data.LockRateX) + "','" + std::to_string(data.AddOnRate) + "','" + std::to_string(data.PreSettlementPrice) + "','" + std::to_string(data.AddOnLockRateX2)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcSPBMOptionParameterFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcSPBMOptionParameterField data;
CThostFtdcSPBMOptionParameterFieldWrapper(const CThostFtdcSPBMOptionParameterField& _data = { 0 }) :data(_data) { }
CThostFtdcSPBMOptionParameterFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcSPBMOptionParameterField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
strncpy(data.ProdFamilyCode, rowValue.at("ProdFamilyCode").c_str(), sizeof(TThostFtdcInstrumentIDType));
data.Cvf = std::stoi(rowValue.at("Cvf"));
data.DownPrice = std::stod(rowValue.at("DownPrice"));
data.Delta = std::stod(rowValue.at("Delta"));
data.SlimiDelta = std::stod(rowValue.at("SlimiDelta"));
data.PreSettlementPrice = std::stod(rowValue.at("PreSettlementPrice"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.TradingDay + "','" + data.ExchangeID + "','" + data.InstrumentID + "','" + data.ProdFamilyCode + "','" + std::to_string(data.Cvf) + "','" + std::to_string(data.DownPrice) + "','" + std::to_string(data.Delta) + "','" + std::to_string(data.SlimiDelta) + "','" + std::to_string(data.PreSettlementPrice)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcSPBMIntraParameterFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcSPBMIntraParameterField data;
CThostFtdcSPBMIntraParameterFieldWrapper(const CThostFtdcSPBMIntraParameterField& _data = { 0 }) :data(_data) { }
CThostFtdcSPBMIntraParameterFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcSPBMIntraParameterField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.ProdFamilyCode, rowValue.at("ProdFamilyCode").c_str(), sizeof(TThostFtdcInstrumentIDType));
data.IntraRateY = std::stod(rowValue.at("IntraRateY"));
data.AddOnIntraRateY2 = std::stod(rowValue.at("AddOnIntraRateY2"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.TradingDay + "','" + data.ExchangeID + "','" + data.ProdFamilyCode + "','" + std::to_string(data.IntraRateY) + "','" + std::to_string(data.AddOnIntraRateY2)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcSPBMInterParameterFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcSPBMInterParameterField data;
CThostFtdcSPBMInterParameterFieldWrapper(const CThostFtdcSPBMInterParameterField& _data = { 0 }) :data(_data) { }
CThostFtdcSPBMInterParameterFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcSPBMInterParameterField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
data.SpreadId = std::stoi(rowValue.at("SpreadId"));
data.InterRateZ = std::stod(rowValue.at("InterRateZ"));
strncpy(data.Leg1ProdFamilyCode, rowValue.at("Leg1ProdFamilyCode").c_str(), sizeof(TThostFtdcInstrumentIDType));
strncpy(data.Leg2ProdFamilyCode, rowValue.at("Leg2ProdFamilyCode").c_str(), sizeof(TThostFtdcInstrumentIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.TradingDay + "','" + data.ExchangeID + "','" + std::to_string(data.SpreadId) + "','" + std::to_string(data.InterRateZ) + "','" + data.Leg1ProdFamilyCode + "','" + data.Leg2ProdFamilyCode
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcSyncSPBMParameterEndFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcSyncSPBMParameterEndField data;
CThostFtdcSyncSPBMParameterEndFieldWrapper(const CThostFtdcSyncSPBMParameterEndField& _data = { 0 }) :data(_data) { }
CThostFtdcSyncSPBMParameterEndFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcSyncSPBMParameterEndField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcDateType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.TradingDay
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcQrySPBMFutureParameterFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQrySPBMFutureParameterField data;
CThostFtdcQrySPBMFutureParameterFieldWrapper(const CThostFtdcQrySPBMFutureParameterField& _data = { 0 }) :data(_data) { }
CThostFtdcQrySPBMFutureParameterFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQrySPBMFutureParameterField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
strncpy(data.ProdFamilyCode, rowValue.at("ProdFamilyCode").c_str(), sizeof(TThostFtdcInstrumentIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.ExchangeID + "','" + data.InstrumentID + "','" + data.ProdFamilyCode
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcQrySPBMOptionParameterFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQrySPBMOptionParameterField data;
CThostFtdcQrySPBMOptionParameterFieldWrapper(const CThostFtdcQrySPBMOptionParameterField& _data = { 0 }) :data(_data) { }
CThostFtdcQrySPBMOptionParameterFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQrySPBMOptionParameterField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
strncpy(data.ProdFamilyCode, rowValue.at("ProdFamilyCode").c_str(), sizeof(TThostFtdcInstrumentIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.ExchangeID + "','" + data.InstrumentID + "','" + data.ProdFamilyCode
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcQrySPBMIntraParameterFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQrySPBMIntraParameterField data;
CThostFtdcQrySPBMIntraParameterFieldWrapper(const CThostFtdcQrySPBMIntraParameterField& _data = { 0 }) :data(_data) { }
CThostFtdcQrySPBMIntraParameterFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQrySPBMIntraParameterField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.ProdFamilyCode, rowValue.at("ProdFamilyCode").c_str(), sizeof(TThostFtdcInstrumentIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.ExchangeID + "','" + data.ProdFamilyCode
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcQrySPBMInterParameterFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQrySPBMInterParameterField data;
CThostFtdcQrySPBMInterParameterFieldWrapper(const CThostFtdcQrySPBMInterParameterField& _data = { 0 }) :data(_data) { }
CThostFtdcQrySPBMInterParameterFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQrySPBMInterParameterField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.Leg1ProdFamilyCode, rowValue.at("Leg1ProdFamilyCode").c_str(), sizeof(TThostFtdcInstrumentIDType));
strncpy(data.Leg2ProdFamilyCode, rowValue.at("Leg2ProdFamilyCode").c_str(), sizeof(TThostFtdcInstrumentIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.ExchangeID + "','" + data.Leg1ProdFamilyCode + "','" + data.Leg2ProdFamilyCode
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcSPBMPortfDefinitionFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcSPBMPortfDefinitionField data;
CThostFtdcSPBMPortfDefinitionFieldWrapper(const CThostFtdcSPBMPortfDefinitionField& _data = { 0 }) :data(_data) { }
CThostFtdcSPBMPortfDefinitionFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcSPBMPortfDefinitionField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
data.PortfolioDefID = std::stoi(rowValue.at("PortfolioDefID"));
strncpy(data.ProdFamilyCode, rowValue.at("ProdFamilyCode").c_str(), sizeof(TThostFtdcInstrumentIDType));
data.IsSPBM = std::stoi(rowValue.at("IsSPBM"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.ExchangeID + "','" + std::to_string(data.PortfolioDefID) + "','" + data.ProdFamilyCode + "','" + std::to_string(data.IsSPBM)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcSPBMInvestorPortfDefFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcSPBMInvestorPortfDefField data;
CThostFtdcSPBMInvestorPortfDefFieldWrapper(const CThostFtdcSPBMInvestorPortfDefField& _data = { 0 }) :data(_data) { }
CThostFtdcSPBMInvestorPortfDefFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcSPBMInvestorPortfDefField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
data.PortfolioDefID = std::stoi(rowValue.at("PortfolioDefID"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.ExchangeID + "','" + data.BrokerID + "','" + data.InvestorID + "','" + std::to_string(data.PortfolioDefID)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcSPBMInvestorPortfDefField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcInvestorPortfMarginRatioFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcInvestorPortfMarginRatioField data;
CThostFtdcInvestorPortfMarginRatioFieldWrapper(const CThostFtdcInvestorPortfMarginRatioField& _data = { 0 }) :data(_data) { }
CThostFtdcInvestorPortfMarginRatioFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcInvestorPortfMarginRatioField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
data.InvestorRange = rowValue.at("InvestorRange").empty() ? '0' : rowValue.at("InvestorRange")[0];
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
data.MarginRatio = std::stod(rowValue.at("MarginRatio"));
strncpy(data.ProductGroupID, rowValue.at("ProductGroupID").c_str(), sizeof(TThostFtdcProductIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
(data.InvestorRange == 0 ? '0' : data.InvestorRange) + "','" + data.BrokerID + "','" + data.InvestorID + "','" + data.ExchangeID + "','" + std::to_string(data.MarginRatio) + "','" + data.ProductGroupID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcInvestorPortfMarginRatioField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcQrySPBMPortfDefinitionFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQrySPBMPortfDefinitionField data;
CThostFtdcQrySPBMPortfDefinitionFieldWrapper(const CThostFtdcQrySPBMPortfDefinitionField& _data = { 0 }) :data(_data) { }
CThostFtdcQrySPBMPortfDefinitionFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQrySPBMPortfDefinitionField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
data.PortfolioDefID = std::stoi(rowValue.at("PortfolioDefID"));
strncpy(data.ProdFamilyCode, rowValue.at("ProdFamilyCode").c_str(), sizeof(TThostFtdcInstrumentIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.ExchangeID + "','" + std::to_string(data.PortfolioDefID) + "','" + data.ProdFamilyCode
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcQrySPBMInvestorPortfDefFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQrySPBMInvestorPortfDefField data;
CThostFtdcQrySPBMInvestorPortfDefFieldWrapper(const CThostFtdcQrySPBMInvestorPortfDefField& _data = { 0 }) :data(_data) { }
CThostFtdcQrySPBMInvestorPortfDefFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQrySPBMInvestorPortfDefField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.ExchangeID + "','" + data.BrokerID + "','" + data.InvestorID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcQrySPBMInvestorPortfDefField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcQryInvestorPortfMarginRatioFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryInvestorPortfMarginRatioField data;
CThostFtdcQryInvestorPortfMarginRatioFieldWrapper(const CThostFtdcQryInvestorPortfMarginRatioField& _data = { 0 }) :data(_data) { }
CThostFtdcQryInvestorPortfMarginRatioFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryInvestorPortfMarginRatioField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.ProductGroupID, rowValue.at("ProductGroupID").c_str(), sizeof(TThostFtdcProductIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorID + "','" + data.ExchangeID + "','" + data.ProductGroupID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcQryInvestorPortfMarginRatioField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcInvestorProdSPBMDetailFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcInvestorProdSPBMDetailField data;
CThostFtdcInvestorProdSPBMDetailFieldWrapper(const CThostFtdcInvestorProdSPBMDetailField& _data = { 0 }) :data(_data) { }
CThostFtdcInvestorProdSPBMDetailFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcInvestorProdSPBMDetailField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.ProdFamilyCode, rowValue.at("ProdFamilyCode").c_str(), sizeof(TThostFtdcInstrumentIDType));
data.IntraInstrMargin = std::stod(rowValue.at("IntraInstrMargin"));
data.BCollectingMargin = std::stod(rowValue.at("BCollectingMargin"));
data.SCollectingMargin = std::stod(rowValue.at("SCollectingMargin"));
data.IntraProdMargin = std::stod(rowValue.at("IntraProdMargin"));
data.NetMargin = std::stod(rowValue.at("NetMargin"));
data.InterProdMargin = std::stod(rowValue.at("InterProdMargin"));
data.SingleMargin = std::stod(rowValue.at("SingleMargin"));
data.AddOnMargin = std::stod(rowValue.at("AddOnMargin"));
data.DeliveryMargin = std::stod(rowValue.at("DeliveryMargin"));
data.CallOptionMinRisk = std::stod(rowValue.at("CallOptionMinRisk"));
data.PutOptionMinRisk = std::stod(rowValue.at("PutOptionMinRisk"));
data.OptionMinRisk = std::stod(rowValue.at("OptionMinRisk"));
data.OptionValueOffset = std::stod(rowValue.at("OptionValueOffset"));
data.OptionRoyalty = std::stod(rowValue.at("OptionRoyalty"));
data.RealOptionValueOffset = std::stod(rowValue.at("RealOptionValueOffset"));
data.Margin = std::stod(rowValue.at("Margin"));
data.ExchMargin = std::stod(rowValue.at("ExchMargin"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.ExchangeID + "','" + data.BrokerID + "','" + data.InvestorID + "','" + data.ProdFamilyCode + "','" + std::to_string(data.IntraInstrMargin) + "','" + std::to_string(data.BCollectingMargin) + "','" + std::to_string(data.SCollectingMargin) + "','" + std::to_string(data.IntraProdMargin) + "','" + std::to_string(data.NetMargin) + "','" + std::to_string(data.InterProdMargin) + "','" + std::to_string(data.SingleMargin) + "','" + std::to_string(data.AddOnMargin) + "','" + std::to_string(data.DeliveryMargin) + "','" + std::to_string(data.CallOptionMinRisk) + "','" + std::to_string(data.PutOptionMinRisk) + "','" + std::to_string(data.OptionMinRisk) + "','" + std::to_string(data.OptionValueOffset) + "','" + std::to_string(data.OptionRoyalty) + "','" + std::to_string(data.RealOptionValueOffset) + "','" + std::to_string(data.Margin) + "','" + std::to_string(data.ExchMargin)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcInvestorProdSPBMDetailField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcQryInvestorProdSPBMDetailFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryInvestorProdSPBMDetailField data;
CThostFtdcQryInvestorProdSPBMDetailFieldWrapper(const CThostFtdcQryInvestorProdSPBMDetailField& _data = { 0 }) :data(_data) { }
CThostFtdcQryInvestorProdSPBMDetailFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryInvestorProdSPBMDetailField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.ProdFamilyCode, rowValue.at("ProdFamilyCode").c_str(), sizeof(TThostFtdcInstrumentIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.ExchangeID + "','" + data.BrokerID + "','" + data.InvestorID + "','" + data.ProdFamilyCode
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcQryInvestorProdSPBMDetailField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcPortfTradeParamSettingFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcPortfTradeParamSettingField data;
CThostFtdcPortfTradeParamSettingFieldWrapper(const CThostFtdcPortfTradeParamSettingField& _data = { 0 }) :data(_data) { }
CThostFtdcPortfTradeParamSettingFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcPortfTradeParamSettingField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
data.Portfolio = rowValue.at("Portfolio").empty() ? '0' : rowValue.at("Portfolio")[0];
data.IsActionVerify = std::stoi(rowValue.at("IsActionVerify"));
data.IsCloseVerify = std::stoi(rowValue.at("IsCloseVerify"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.ExchangeID + "','" + data.BrokerID + "','" + data.InvestorID + "','" + (data.Portfolio == 0 ? '0' : data.Portfolio) + "','" + std::to_string(data.IsActionVerify) + "','" + std::to_string(data.IsCloseVerify)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcPortfTradeParamSettingField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcInvestorTradingRightFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcInvestorTradingRightField data;
CThostFtdcInvestorTradingRightFieldWrapper(const CThostFtdcInvestorTradingRightField& _data = { 0 }) :data(_data) { }
CThostFtdcInvestorTradingRightFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcInvestorTradingRightField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
data.InvstTradingRight = rowValue.at("InvstTradingRight").empty() ? '0' : rowValue.at("InvstTradingRight")[0];
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorID + "','" + (data.InvstTradingRight == 0 ? '0' : data.InvstTradingRight)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcInvestorTradingRightField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcMortgageParamFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcMortgageParamField data;
CThostFtdcMortgageParamFieldWrapper(const CThostFtdcMortgageParamField& _data = { 0 }) :data(_data) { }
CThostFtdcMortgageParamFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcMortgageParamField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.AccountID, rowValue.at("AccountID").c_str(), sizeof(TThostFtdcAccountIDType));
data.MortgageBalance = std::stod(rowValue.at("MortgageBalance"));
data.CheckMortgageRatio = std::stoi(rowValue.at("CheckMortgageRatio"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.AccountID + "','" + std::to_string(data.MortgageBalance) + "','" + std::to_string(data.CheckMortgageRatio)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.AccountID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& AccountID) {
return "SELECT * FROM 'CThostFtdcMortgageParamField' where BrokerID='" + BrokerID + "' and AccountID='" + AccountID + "';";
}
};
struct CThostFtdcWithDrawParamFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcWithDrawParamField data;
CThostFtdcWithDrawParamFieldWrapper(const CThostFtdcWithDrawParamField& _data = { 0 }) :data(_data) { }
CThostFtdcWithDrawParamFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcWithDrawParamField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.AccountID, rowValue.at("AccountID").c_str(), sizeof(TThostFtdcAccountIDType));
data.WithDrawParamID = rowValue.at("WithDrawParamID").empty() ? '0' : rowValue.at("WithDrawParamID")[0];
strncpy(data.WithDrawParamValue, rowValue.at("WithDrawParamValue").c_str(), sizeof(TThostFtdcWithDrawParamValueType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.AccountID + "','" + (data.WithDrawParamID == 0 ? '0' : data.WithDrawParamID) + "','" + data.WithDrawParamValue
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.AccountID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& AccountID) {
return "SELECT * FROM 'CThostFtdcWithDrawParamField' where BrokerID='" + BrokerID + "' and AccountID='" + AccountID + "';";
}
};
struct CThostFtdcThostUserFunctionFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcThostUserFunctionField data;
CThostFtdcThostUserFunctionFieldWrapper(const CThostFtdcThostUserFunctionField& _data = { 0 }) :data(_data) { }
CThostFtdcThostUserFunctionFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcThostUserFunctionField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
data.ThostFunctionCode = std::stoi(rowValue.at("ThostFunctionCode"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.UserID + "','" + std::to_string(data.ThostFunctionCode)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.UserID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& UserID) {
return "SELECT * FROM 'CThostFtdcThostUserFunctionField' where BrokerID='" + BrokerID + "' and UserID='" + UserID + "';";
}
};
struct CThostFtdcQryThostUserFunctionFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryThostUserFunctionField data;
CThostFtdcQryThostUserFunctionFieldWrapper(const CThostFtdcQryThostUserFunctionField& _data = { 0 }) :data(_data) { }
CThostFtdcQryThostUserFunctionFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryThostUserFunctionField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.UserID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.UserID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& UserID) {
return "SELECT * FROM 'CThostFtdcQryThostUserFunctionField' where BrokerID='" + BrokerID + "' and UserID='" + UserID + "';";
}
};
struct CThostFtdcSPBMAddOnInterParameterFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcSPBMAddOnInterParameterField data;
CThostFtdcSPBMAddOnInterParameterFieldWrapper(const CThostFtdcSPBMAddOnInterParameterField& _data = { 0 }) :data(_data) { }
CThostFtdcSPBMAddOnInterParameterFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcSPBMAddOnInterParameterField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
data.SpreadId = std::stoi(rowValue.at("SpreadId"));
data.AddOnInterRateZ2 = std::stod(rowValue.at("AddOnInterRateZ2"));
strncpy(data.Leg1ProdFamilyCode, rowValue.at("Leg1ProdFamilyCode").c_str(), sizeof(TThostFtdcInstrumentIDType));
strncpy(data.Leg2ProdFamilyCode, rowValue.at("Leg2ProdFamilyCode").c_str(), sizeof(TThostFtdcInstrumentIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.TradingDay + "','" + data.ExchangeID + "','" + std::to_string(data.SpreadId) + "','" + std::to_string(data.AddOnInterRateZ2) + "','" + data.Leg1ProdFamilyCode + "','" + data.Leg2ProdFamilyCode
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcQrySPBMAddOnInterParameterFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQrySPBMAddOnInterParameterField data;
CThostFtdcQrySPBMAddOnInterParameterFieldWrapper(const CThostFtdcQrySPBMAddOnInterParameterField& _data = { 0 }) :data(_data) { }
CThostFtdcQrySPBMAddOnInterParameterFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQrySPBMAddOnInterParameterField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.Leg1ProdFamilyCode, rowValue.at("Leg1ProdFamilyCode").c_str(), sizeof(TThostFtdcInstrumentIDType));
strncpy(data.Leg2ProdFamilyCode, rowValue.at("Leg2ProdFamilyCode").c_str(), sizeof(TThostFtdcInstrumentIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.ExchangeID + "','" + data.Leg1ProdFamilyCode + "','" + data.Leg2ProdFamilyCode
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcQryInvestorCommoditySPMMMarginFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryInvestorCommoditySPMMMarginField data;
CThostFtdcQryInvestorCommoditySPMMMarginFieldWrapper(const CThostFtdcQryInvestorCommoditySPMMMarginField& _data = { 0 }) :data(_data) { }
CThostFtdcQryInvestorCommoditySPMMMarginFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryInvestorCommoditySPMMMarginField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.CommodityID, rowValue.at("CommodityID").c_str(), sizeof(TThostFtdcSPMMProductIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorID + "','" + data.CommodityID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcQryInvestorCommoditySPMMMarginField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcQryInvestorCommodityGroupSPMMMarginFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryInvestorCommodityGroupSPMMMarginField data;
CThostFtdcQryInvestorCommodityGroupSPMMMarginFieldWrapper(const CThostFtdcQryInvestorCommodityGroupSPMMMarginField& _data = { 0 }) :data(_data) { }
CThostFtdcQryInvestorCommodityGroupSPMMMarginFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryInvestorCommodityGroupSPMMMarginField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.CommodityGroupID, rowValue.at("CommodityGroupID").c_str(), sizeof(TThostFtdcSPMMProductIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorID + "','" + data.CommodityGroupID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcQryInvestorCommodityGroupSPMMMarginField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcQrySPMMInstParamFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQrySPMMInstParamField data;
CThostFtdcQrySPMMInstParamFieldWrapper(const CThostFtdcQrySPMMInstParamField& _data = { 0 }) :data(_data) { }
CThostFtdcQrySPMMInstParamFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQrySPMMInstParamField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.InstrumentID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcQrySPMMProductParamFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQrySPMMProductParamField data;
CThostFtdcQrySPMMProductParamFieldWrapper(const CThostFtdcQrySPMMProductParamField& _data = { 0 }) :data(_data) { }
CThostFtdcQrySPMMProductParamFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQrySPMMProductParamField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.ProductID, rowValue.at("ProductID").c_str(), sizeof(TThostFtdcSPMMProductIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.ProductID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcInvestorCommoditySPMMMarginFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcInvestorCommoditySPMMMarginField data;
CThostFtdcInvestorCommoditySPMMMarginFieldWrapper(const CThostFtdcInvestorCommoditySPMMMarginField& _data = { 0 }) :data(_data) { }
CThostFtdcInvestorCommoditySPMMMarginFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcInvestorCommoditySPMMMarginField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.CommodityID, rowValue.at("CommodityID").c_str(), sizeof(TThostFtdcSPMMProductIDType));
data.MarginBeforeDiscount = std::stod(rowValue.at("MarginBeforeDiscount"));
data.MarginNoDiscount = std::stod(rowValue.at("MarginNoDiscount"));
data.LongPosRisk = std::stod(rowValue.at("LongPosRisk"));
data.LongOpenFrozenRisk = std::stod(rowValue.at("LongOpenFrozenRisk"));
data.LongCloseFrozenRisk = std::stod(rowValue.at("LongCloseFrozenRisk"));
data.ShortPosRisk = std::stod(rowValue.at("ShortPosRisk"));
data.ShortOpenFrozenRisk = std::stod(rowValue.at("ShortOpenFrozenRisk"));
data.ShortCloseFrozenRisk = std::stod(rowValue.at("ShortCloseFrozenRisk"));
data.IntraCommodityRate = std::stod(rowValue.at("IntraCommodityRate"));
data.OptionDiscountRate = std::stod(rowValue.at("OptionDiscountRate"));
data.PosDiscount = std::stod(rowValue.at("PosDiscount"));
data.OpenFrozenDiscount = std::stod(rowValue.at("OpenFrozenDiscount"));
data.NetRisk = std::stod(rowValue.at("NetRisk"));
data.CloseFrozenMargin = std::stod(rowValue.at("CloseFrozenMargin"));
data.FrozenCommission = std::stod(rowValue.at("FrozenCommission"));
data.Commission = std::stod(rowValue.at("Commission"));
data.FrozenCash = std::stod(rowValue.at("FrozenCash"));
data.CashIn = std::stod(rowValue.at("CashIn"));
data.StrikeFrozenMargin = std::stod(rowValue.at("StrikeFrozenMargin"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.ExchangeID + "','" + data.BrokerID + "','" + data.InvestorID + "','" + data.CommodityID + "','" + std::to_string(data.MarginBeforeDiscount) + "','" + std::to_string(data.MarginNoDiscount) + "','" + std::to_string(data.LongPosRisk) + "','" + std::to_string(data.LongOpenFrozenRisk) + "','" + std::to_string(data.LongCloseFrozenRisk) + "','" + std::to_string(data.ShortPosRisk) + "','" + std::to_string(data.ShortOpenFrozenRisk) + "','" + std::to_string(data.ShortCloseFrozenRisk) + "','" + std::to_string(data.IntraCommodityRate) + "','" + std::to_string(data.OptionDiscountRate) + "','" + std::to_string(data.PosDiscount) + "','" + std::to_string(data.OpenFrozenDiscount) + "','" + std::to_string(data.NetRisk) + "','" + std::to_string(data.CloseFrozenMargin) + "','" + std::to_string(data.FrozenCommission) + "','" + std::to_string(data.Commission) + "','" + std::to_string(data.FrozenCash) + "','" + std::to_string(data.CashIn) + "','" + std::to_string(data.StrikeFrozenMargin)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcInvestorCommoditySPMMMarginField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcInvestorCommodityGroupSPMMMarginFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcInvestorCommodityGroupSPMMMarginField data;
CThostFtdcInvestorCommodityGroupSPMMMarginFieldWrapper(const CThostFtdcInvestorCommodityGroupSPMMMarginField& _data = { 0 }) :data(_data) { }
CThostFtdcInvestorCommodityGroupSPMMMarginFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcInvestorCommodityGroupSPMMMarginField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.CommodityGroupID, rowValue.at("CommodityGroupID").c_str(), sizeof(TThostFtdcSPMMProductIDType));
data.MarginBeforeDiscount = std::stod(rowValue.at("MarginBeforeDiscount"));
data.MarginNoDiscount = std::stod(rowValue.at("MarginNoDiscount"));
data.LongRisk = std::stod(rowValue.at("LongRisk"));
data.ShortRisk = std::stod(rowValue.at("ShortRisk"));
data.CloseFrozenMargin = std::stod(rowValue.at("CloseFrozenMargin"));
data.InterCommodityRate = std::stod(rowValue.at("InterCommodityRate"));
data.MiniMarginRatio = std::stod(rowValue.at("MiniMarginRatio"));
data.AdjustRatio = std::stod(rowValue.at("AdjustRatio"));
data.IntraCommodityDiscount = std::stod(rowValue.at("IntraCommodityDiscount"));
data.InterCommodityDiscount = std::stod(rowValue.at("InterCommodityDiscount"));
data.ExchMargin = std::stod(rowValue.at("ExchMargin"));
data.InvestorMargin = std::stod(rowValue.at("InvestorMargin"));
data.FrozenCommission = std::stod(rowValue.at("FrozenCommission"));
data.Commission = std::stod(rowValue.at("Commission"));
data.FrozenCash = std::stod(rowValue.at("FrozenCash"));
data.CashIn = std::stod(rowValue.at("CashIn"));
data.StrikeFrozenMargin = std::stod(rowValue.at("StrikeFrozenMargin"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.ExchangeID + "','" + data.BrokerID + "','" + data.InvestorID + "','" + data.CommodityGroupID + "','" + std::to_string(data.MarginBeforeDiscount) + "','" + std::to_string(data.MarginNoDiscount) + "','" + std::to_string(data.LongRisk) + "','" + std::to_string(data.ShortRisk) + "','" + std::to_string(data.CloseFrozenMargin) + "','" + std::to_string(data.InterCommodityRate) + "','" + std::to_string(data.MiniMarginRatio) + "','" + std::to_string(data.AdjustRatio) + "','" + std::to_string(data.IntraCommodityDiscount) + "','" + std::to_string(data.InterCommodityDiscount) + "','" + std::to_string(data.ExchMargin) + "','" + std::to_string(data.InvestorMargin) + "','" + std::to_string(data.FrozenCommission) + "','" + std::to_string(data.Commission) + "','" + std::to_string(data.FrozenCash) + "','" + std::to_string(data.CashIn) + "','" + std::to_string(data.StrikeFrozenMargin)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcInvestorCommodityGroupSPMMMarginField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcSPMMInstParamFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcSPMMInstParamField data;
CThostFtdcSPMMInstParamFieldWrapper(const CThostFtdcSPMMInstParamField& _data = { 0 }) :data(_data) { }
CThostFtdcSPMMInstParamFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcSPMMInstParamField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
data.InstMarginCalID = rowValue.at("InstMarginCalID").empty() ? '0' : rowValue.at("InstMarginCalID")[0];
strncpy(data.CommodityID, rowValue.at("CommodityID").c_str(), sizeof(TThostFtdcSPMMProductIDType));
strncpy(data.CommodityGroupID, rowValue.at("CommodityGroupID").c_str(), sizeof(TThostFtdcSPMMProductIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.ExchangeID + "','" + data.InstrumentID + "','" + (data.InstMarginCalID == 0 ? '0' : data.InstMarginCalID) + "','" + data.CommodityID + "','" + data.CommodityGroupID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcSPMMProductParamFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcSPMMProductParamField data;
CThostFtdcSPMMProductParamFieldWrapper(const CThostFtdcSPMMProductParamField& _data = { 0 }) :data(_data) { }
CThostFtdcSPMMProductParamFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcSPMMProductParamField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.ProductID, rowValue.at("ProductID").c_str(), sizeof(TThostFtdcSPMMProductIDType));
strncpy(data.CommodityID, rowValue.at("CommodityID").c_str(), sizeof(TThostFtdcSPMMProductIDType));
strncpy(data.CommodityGroupID, rowValue.at("CommodityGroupID").c_str(), sizeof(TThostFtdcSPMMProductIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.ExchangeID + "','" + data.ProductID + "','" + data.CommodityID + "','" + data.CommodityGroupID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcQryTraderAssignFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryTraderAssignField data;
CThostFtdcQryTraderAssignFieldWrapper(const CThostFtdcQryTraderAssignField& _data = { 0 }) :data(_data) { }
CThostFtdcQryTraderAssignFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryTraderAssignField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.TraderID, rowValue.at("TraderID").c_str(), sizeof(TThostFtdcTraderIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.TraderID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcTraderAssignFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcTraderAssignField data;
CThostFtdcTraderAssignFieldWrapper(const CThostFtdcTraderAssignField& _data = { 0 }) :data(_data) { }
CThostFtdcTraderAssignFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcTraderAssignField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.TraderID, rowValue.at("TraderID").c_str(), sizeof(TThostFtdcTraderIDType));
strncpy(data.ParticipantID, rowValue.at("ParticipantID").c_str(), sizeof(TThostFtdcParticipantIDType));
data.DRIdentityID = std::stoi(rowValue.at("DRIdentityID"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.ExchangeID + "','" + data.TraderID + "','" + data.ParticipantID + "','" + std::to_string(data.DRIdentityID)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcInvestorInfoCntSettingFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcInvestorInfoCntSettingField data;
CThostFtdcInvestorInfoCntSettingFieldWrapper(const CThostFtdcInvestorInfoCntSettingField& _data = { 0 }) :data(_data) { }
CThostFtdcInvestorInfoCntSettingFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcInvestorInfoCntSettingField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.ProductID, rowValue.at("ProductID").c_str(), sizeof(TThostFtdcProductIDType));
data.IsCalInfoComm = std::stoi(rowValue.at("IsCalInfoComm"));
data.IsLimitInfoMax = std::stoi(rowValue.at("IsLimitInfoMax"));
data.InfoMaxLimit = std::stoi(rowValue.at("InfoMaxLimit"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.ExchangeID + "','" + data.BrokerID + "','" + data.InvestorID + "','" + data.ProductID + "','" + std::to_string(data.IsCalInfoComm) + "','" + std::to_string(data.IsLimitInfoMax) + "','" + std::to_string(data.InfoMaxLimit)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcInvestorInfoCntSettingField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcRCAMSCombProductInfoFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcRCAMSCombProductInfoField data;
CThostFtdcRCAMSCombProductInfoFieldWrapper(const CThostFtdcRCAMSCombProductInfoField& _data = { 0 }) :data(_data) { }
CThostFtdcRCAMSCombProductInfoFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcRCAMSCombProductInfoField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.ProductID, rowValue.at("ProductID").c_str(), sizeof(TThostFtdcProductIDType));
strncpy(data.CombProductID, rowValue.at("CombProductID").c_str(), sizeof(TThostFtdcProductIDType));
strncpy(data.ProductGroupID, rowValue.at("ProductGroupID").c_str(), sizeof(TThostFtdcProductIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.TradingDay + "','" + data.ExchangeID + "','" + data.ProductID + "','" + data.CombProductID + "','" + data.ProductGroupID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcRCAMSInstrParameterFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcRCAMSInstrParameterField data;
CThostFtdcRCAMSInstrParameterFieldWrapper(const CThostFtdcRCAMSInstrParameterField& _data = { 0 }) :data(_data) { }
CThostFtdcRCAMSInstrParameterFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcRCAMSInstrParameterField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.ProductID, rowValue.at("ProductID").c_str(), sizeof(TThostFtdcProductIDType));
data.HedgeRate = std::stod(rowValue.at("HedgeRate"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.TradingDay + "','" + data.ExchangeID + "','" + data.ProductID + "','" + std::to_string(data.HedgeRate)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcRCAMSIntraParameterFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcRCAMSIntraParameterField data;
CThostFtdcRCAMSIntraParameterFieldWrapper(const CThostFtdcRCAMSIntraParameterField& _data = { 0 }) :data(_data) { }
CThostFtdcRCAMSIntraParameterFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcRCAMSIntraParameterField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.CombProductID, rowValue.at("CombProductID").c_str(), sizeof(TThostFtdcProductIDType));
data.HedgeRate = std::stod(rowValue.at("HedgeRate"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.TradingDay + "','" + data.ExchangeID + "','" + data.CombProductID + "','" + std::to_string(data.HedgeRate)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcRCAMSInterParameterFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcRCAMSInterParameterField data;
CThostFtdcRCAMSInterParameterFieldWrapper(const CThostFtdcRCAMSInterParameterField& _data = { 0 }) :data(_data) { }
CThostFtdcRCAMSInterParameterFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcRCAMSInterParameterField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.ProductGroupID, rowValue.at("ProductGroupID").c_str(), sizeof(TThostFtdcProductIDType));
data.Priority = std::stoi(rowValue.at("Priority"));
data.CreditRate = std::stod(rowValue.at("CreditRate"));
strncpy(data.CombProduct1, rowValue.at("CombProduct1").c_str(), sizeof(TThostFtdcProductIDType));
strncpy(data.CombProduct2, rowValue.at("CombProduct2").c_str(), sizeof(TThostFtdcProductIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.TradingDay + "','" + data.ExchangeID + "','" + data.ProductGroupID + "','" + std::to_string(data.Priority) + "','" + std::to_string(data.CreditRate) + "','" + data.CombProduct1 + "','" + data.CombProduct2
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcRCAMSShortOptAdjustParamFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcRCAMSShortOptAdjustParamField data;
CThostFtdcRCAMSShortOptAdjustParamFieldWrapper(const CThostFtdcRCAMSShortOptAdjustParamField& _data = { 0 }) :data(_data) { }
CThostFtdcRCAMSShortOptAdjustParamFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcRCAMSShortOptAdjustParamField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.CombProductID, rowValue.at("CombProductID").c_str(), sizeof(TThostFtdcProductIDType));
data.HedgeFlag = rowValue.at("HedgeFlag").empty() ? '0' : rowValue.at("HedgeFlag")[0];
data.AdjustValue = std::stod(rowValue.at("AdjustValue"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.TradingDay + "','" + data.ExchangeID + "','" + data.CombProductID + "','" + (data.HedgeFlag == 0 ? '0' : data.HedgeFlag) + "','" + std::to_string(data.AdjustValue)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcRCAMSInvestorCombPositionFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcRCAMSInvestorCombPositionField data;
CThostFtdcRCAMSInvestorCombPositionFieldWrapper(const CThostFtdcRCAMSInvestorCombPositionField& _data = { 0 }) :data(_data) { }
CThostFtdcRCAMSInvestorCombPositionFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcRCAMSInvestorCombPositionField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
data.HedgeFlag = rowValue.at("HedgeFlag").empty() ? '0' : rowValue.at("HedgeFlag")[0];
data.PosiDirection = rowValue.at("PosiDirection").empty() ? '0' : rowValue.at("PosiDirection")[0];
strncpy(data.CombInstrumentID, rowValue.at("CombInstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
data.LegID = std::stoi(rowValue.at("LegID"));
strncpy(data.ExchangeInstID, rowValue.at("ExchangeInstID").c_str(), sizeof(TThostFtdcExchangeInstIDType));
data.TotalAmt = std::stoi(rowValue.at("TotalAmt"));
data.ExchMargin = std::stod(rowValue.at("ExchMargin"));
data.Margin = std::stod(rowValue.at("Margin"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.ExchangeID + "','" + data.BrokerID + "','" + data.InvestorID + "','" + data.InstrumentID + "','" + (data.HedgeFlag == 0 ? '0' : data.HedgeFlag) + "','" + (data.PosiDirection == 0 ? '0' : data.PosiDirection) + "','" + data.CombInstrumentID + "','" + std::to_string(data.LegID) + "','" + data.ExchangeInstID + "','" + std::to_string(data.TotalAmt) + "','" + std::to_string(data.ExchMargin) + "','" + std::to_string(data.Margin)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcRCAMSInvestorCombPositionField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcInvestorProdRCAMSMarginFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcInvestorProdRCAMSMarginField data;
CThostFtdcInvestorProdRCAMSMarginFieldWrapper(const CThostFtdcInvestorProdRCAMSMarginField& _data = { 0 }) :data(_data) { }
CThostFtdcInvestorProdRCAMSMarginFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcInvestorProdRCAMSMarginField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.CombProductID, rowValue.at("CombProductID").c_str(), sizeof(TThostFtdcProductIDType));
data.HedgeFlag = rowValue.at("HedgeFlag").empty() ? '0' : rowValue.at("HedgeFlag")[0];
strncpy(data.ProductGroupID, rowValue.at("ProductGroupID").c_str(), sizeof(TThostFtdcProductIDType));
data.RiskBeforeDiscount = std::stod(rowValue.at("RiskBeforeDiscount"));
data.IntraInstrRisk = std::stod(rowValue.at("IntraInstrRisk"));
data.BPosRisk = std::stod(rowValue.at("BPosRisk"));
data.SPosRisk = std::stod(rowValue.at("SPosRisk"));
data.IntraProdRisk = std::stod(rowValue.at("IntraProdRisk"));
data.NetRisk = std::stod(rowValue.at("NetRisk"));
data.InterProdRisk = std::stod(rowValue.at("InterProdRisk"));
data.ShortOptRiskAdj = std::stod(rowValue.at("ShortOptRiskAdj"));
data.OptionRoyalty = std::stod(rowValue.at("OptionRoyalty"));
data.MMSACloseFrozenMargin = std::stod(rowValue.at("MMSACloseFrozenMargin"));
data.CloseCombFrozenMargin = std::stod(rowValue.at("CloseCombFrozenMargin"));
data.CloseFrozenMargin = std::stod(rowValue.at("CloseFrozenMargin"));
data.MMSAOpenFrozenMargin = std::stod(rowValue.at("MMSAOpenFrozenMargin"));
data.DeliveryOpenFrozenMargin = std::stod(rowValue.at("DeliveryOpenFrozenMargin"));
data.OpenFrozenMargin = std::stod(rowValue.at("OpenFrozenMargin"));
data.UseFrozenMargin = std::stod(rowValue.at("UseFrozenMargin"));
data.MMSAExchMargin = std::stod(rowValue.at("MMSAExchMargin"));
data.DeliveryExchMargin = std::stod(rowValue.at("DeliveryExchMargin"));
data.CombExchMargin = std::stod(rowValue.at("CombExchMargin"));
data.ExchMargin = std::stod(rowValue.at("ExchMargin"));
data.UseMargin = std::stod(rowValue.at("UseMargin"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.ExchangeID + "','" + data.BrokerID + "','" + data.InvestorID + "','" + data.CombProductID + "','" + (data.HedgeFlag == 0 ? '0' : data.HedgeFlag) + "','" + data.ProductGroupID + "','" + std::to_string(data.RiskBeforeDiscount) + "','" + std::to_string(data.IntraInstrRisk) + "','" + std::to_string(data.BPosRisk) + "','" + std::to_string(data.SPosRisk) + "','" + std::to_string(data.IntraProdRisk) + "','" + std::to_string(data.NetRisk) + "','" + std::to_string(data.InterProdRisk) + "','" + std::to_string(data.ShortOptRiskAdj) + "','" + std::to_string(data.OptionRoyalty) + "','" + std::to_string(data.MMSACloseFrozenMargin) + "','" + std::to_string(data.CloseCombFrozenMargin) + "','" + std::to_string(data.CloseFrozenMargin) + "','" + std::to_string(data.MMSAOpenFrozenMargin) + "','" + std::to_string(data.DeliveryOpenFrozenMargin) + "','" + std::to_string(data.OpenFrozenMargin) + "','" + std::to_string(data.UseFrozenMargin) + "','" + std::to_string(data.MMSAExchMargin) + "','" + std::to_string(data.DeliveryExchMargin) + "','" + std::to_string(data.CombExchMargin) + "','" + std::to_string(data.ExchMargin) + "','" + std::to_string(data.UseMargin)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcInvestorProdRCAMSMarginField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcQryRCAMSCombProductInfoFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryRCAMSCombProductInfoField data;
CThostFtdcQryRCAMSCombProductInfoFieldWrapper(const CThostFtdcQryRCAMSCombProductInfoField& _data = { 0 }) :data(_data) { }
CThostFtdcQryRCAMSCombProductInfoFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryRCAMSCombProductInfoField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.ProductID, rowValue.at("ProductID").c_str(), sizeof(TThostFtdcProductIDType));
strncpy(data.CombProductID, rowValue.at("CombProductID").c_str(), sizeof(TThostFtdcProductIDType));
strncpy(data.ProductGroupID, rowValue.at("ProductGroupID").c_str(), sizeof(TThostFtdcProductIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.ProductID + "','" + data.CombProductID + "','" + data.ProductGroupID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcQryRCAMSInstrParameterFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryRCAMSInstrParameterField data;
CThostFtdcQryRCAMSInstrParameterFieldWrapper(const CThostFtdcQryRCAMSInstrParameterField& _data = { 0 }) :data(_data) { }
CThostFtdcQryRCAMSInstrParameterFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryRCAMSInstrParameterField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.ProductID, rowValue.at("ProductID").c_str(), sizeof(TThostFtdcProductIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.ProductID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcQryRCAMSIntraParameterFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryRCAMSIntraParameterField data;
CThostFtdcQryRCAMSIntraParameterFieldWrapper(const CThostFtdcQryRCAMSIntraParameterField& _data = { 0 }) :data(_data) { }
CThostFtdcQryRCAMSIntraParameterFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryRCAMSIntraParameterField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.CombProductID, rowValue.at("CombProductID").c_str(), sizeof(TThostFtdcProductIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.CombProductID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcQryRCAMSInterParameterFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryRCAMSInterParameterField data;
CThostFtdcQryRCAMSInterParameterFieldWrapper(const CThostFtdcQryRCAMSInterParameterField& _data = { 0 }) :data(_data) { }
CThostFtdcQryRCAMSInterParameterFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryRCAMSInterParameterField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.ProductGroupID, rowValue.at("ProductGroupID").c_str(), sizeof(TThostFtdcProductIDType));
strncpy(data.CombProduct1, rowValue.at("CombProduct1").c_str(), sizeof(TThostFtdcProductIDType));
strncpy(data.CombProduct2, rowValue.at("CombProduct2").c_str(), sizeof(TThostFtdcProductIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.ProductGroupID + "','" + data.CombProduct1 + "','" + data.CombProduct2
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcQryRCAMSShortOptAdjustParamFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryRCAMSShortOptAdjustParamField data;
CThostFtdcQryRCAMSShortOptAdjustParamFieldWrapper(const CThostFtdcQryRCAMSShortOptAdjustParamField& _data = { 0 }) :data(_data) { }
CThostFtdcQryRCAMSShortOptAdjustParamFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryRCAMSShortOptAdjustParamField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.CombProductID, rowValue.at("CombProductID").c_str(), sizeof(TThostFtdcProductIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.CombProductID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcQryRCAMSInvestorCombPositionFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryRCAMSInvestorCombPositionField data;
CThostFtdcQryRCAMSInvestorCombPositionFieldWrapper(const CThostFtdcQryRCAMSInvestorCombPositionField& _data = { 0 }) :data(_data) { }
CThostFtdcQryRCAMSInvestorCombPositionFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryRCAMSInvestorCombPositionField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
strncpy(data.CombInstrumentID, rowValue.at("CombInstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorID + "','" + data.InstrumentID + "','" + data.CombInstrumentID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcQryRCAMSInvestorCombPositionField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcQryInvestorProdRCAMSMarginFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryInvestorProdRCAMSMarginField data;
CThostFtdcQryInvestorProdRCAMSMarginFieldWrapper(const CThostFtdcQryInvestorProdRCAMSMarginField& _data = { 0 }) :data(_data) { }
CThostFtdcQryInvestorProdRCAMSMarginFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryInvestorProdRCAMSMarginField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.CombProductID, rowValue.at("CombProductID").c_str(), sizeof(TThostFtdcProductIDType));
strncpy(data.ProductGroupID, rowValue.at("ProductGroupID").c_str(), sizeof(TThostFtdcProductIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorID + "','" + data.CombProductID + "','" + data.ProductGroupID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcQryInvestorProdRCAMSMarginField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcRULEInstrParameterFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcRULEInstrParameterField data;
CThostFtdcRULEInstrParameterFieldWrapper(const CThostFtdcRULEInstrParameterField& _data = { 0 }) :data(_data) { }
CThostFtdcRULEInstrParameterFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcRULEInstrParameterField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
data.InstrumentClass = rowValue.at("InstrumentClass").empty() ? '0' : rowValue.at("InstrumentClass")[0];
strncpy(data.StdInstrumentID, rowValue.at("StdInstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
data.BSpecRatio = std::stod(rowValue.at("BSpecRatio"));
data.SSpecRatio = std::stod(rowValue.at("SSpecRatio"));
data.BHedgeRatio = std::stod(rowValue.at("BHedgeRatio"));
data.SHedgeRatio = std::stod(rowValue.at("SHedgeRatio"));
data.BAddOnMargin = std::stod(rowValue.at("BAddOnMargin"));
data.SAddOnMargin = std::stod(rowValue.at("SAddOnMargin"));
data.CommodityGroupID = std::stoi(rowValue.at("CommodityGroupID"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.TradingDay + "','" + data.ExchangeID + "','" + data.InstrumentID + "','" + (data.InstrumentClass == 0 ? '0' : data.InstrumentClass) + "','" + data.StdInstrumentID + "','" + std::to_string(data.BSpecRatio) + "','" + std::to_string(data.SSpecRatio) + "','" + std::to_string(data.BHedgeRatio) + "','" + std::to_string(data.SHedgeRatio) + "','" + std::to_string(data.BAddOnMargin) + "','" + std::to_string(data.SAddOnMargin) + "','" + std::to_string(data.CommodityGroupID)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcRULEIntraParameterFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcRULEIntraParameterField data;
CThostFtdcRULEIntraParameterFieldWrapper(const CThostFtdcRULEIntraParameterField& _data = { 0 }) :data(_data) { }
CThostFtdcRULEIntraParameterFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcRULEIntraParameterField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.ProdFamilyCode, rowValue.at("ProdFamilyCode").c_str(), sizeof(TThostFtdcInstrumentIDType));
strncpy(data.StdInstrumentID, rowValue.at("StdInstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
data.StdInstrMargin = std::stod(rowValue.at("StdInstrMargin"));
data.UsualIntraRate = std::stod(rowValue.at("UsualIntraRate"));
data.DeliveryIntraRate = std::stod(rowValue.at("DeliveryIntraRate"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.TradingDay + "','" + data.ExchangeID + "','" + data.ProdFamilyCode + "','" + data.StdInstrumentID + "','" + std::to_string(data.StdInstrMargin) + "','" + std::to_string(data.UsualIntraRate) + "','" + std::to_string(data.DeliveryIntraRate)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcRULEInterParameterFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcRULEInterParameterField data;
CThostFtdcRULEInterParameterFieldWrapper(const CThostFtdcRULEInterParameterField& _data = { 0 }) :data(_data) { }
CThostFtdcRULEInterParameterFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcRULEInterParameterField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
data.SpreadId = std::stoi(rowValue.at("SpreadId"));
data.InterRate = std::stod(rowValue.at("InterRate"));
strncpy(data.Leg1ProdFamilyCode, rowValue.at("Leg1ProdFamilyCode").c_str(), sizeof(TThostFtdcInstrumentIDType));
strncpy(data.Leg2ProdFamilyCode, rowValue.at("Leg2ProdFamilyCode").c_str(), sizeof(TThostFtdcInstrumentIDType));
data.Leg1PropFactor = std::stoi(rowValue.at("Leg1PropFactor"));
data.Leg2PropFactor = std::stoi(rowValue.at("Leg2PropFactor"));
data.CommodityGroupID = std::stoi(rowValue.at("CommodityGroupID"));
strncpy(data.CommodityGroupName, rowValue.at("CommodityGroupName").c_str(), sizeof(TThostFtdcInstrumentNameType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.TradingDay + "','" + data.ExchangeID + "','" + std::to_string(data.SpreadId) + "','" + std::to_string(data.InterRate) + "','" + data.Leg1ProdFamilyCode + "','" + data.Leg2ProdFamilyCode + "','" + std::to_string(data.Leg1PropFactor) + "','" + std::to_string(data.Leg2PropFactor) + "','" + std::to_string(data.CommodityGroupID) + "','" + data.CommodityGroupName
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcQryRULEInstrParameterFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryRULEInstrParameterField data;
CThostFtdcQryRULEInstrParameterFieldWrapper(const CThostFtdcQryRULEInstrParameterField& _data = { 0 }) :data(_data) { }
CThostFtdcQryRULEInstrParameterFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryRULEInstrParameterField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.ExchangeID + "','" + data.InstrumentID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcQryRULEIntraParameterFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryRULEIntraParameterField data;
CThostFtdcQryRULEIntraParameterFieldWrapper(const CThostFtdcQryRULEIntraParameterField& _data = { 0 }) :data(_data) { }
CThostFtdcQryRULEIntraParameterFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryRULEIntraParameterField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.ProdFamilyCode, rowValue.at("ProdFamilyCode").c_str(), sizeof(TThostFtdcInstrumentIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.ExchangeID + "','" + data.ProdFamilyCode
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcQryRULEInterParameterFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryRULEInterParameterField data;
CThostFtdcQryRULEInterParameterFieldWrapper(const CThostFtdcQryRULEInterParameterField& _data = { 0 }) :data(_data) { }
CThostFtdcQryRULEInterParameterFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryRULEInterParameterField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.Leg1ProdFamilyCode, rowValue.at("Leg1ProdFamilyCode").c_str(), sizeof(TThostFtdcInstrumentIDType));
strncpy(data.Leg2ProdFamilyCode, rowValue.at("Leg2ProdFamilyCode").c_str(), sizeof(TThostFtdcInstrumentIDType));
data.CommodityGroupID = std::stoi(rowValue.at("CommodityGroupID"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.ExchangeID + "','" + data.Leg1ProdFamilyCode + "','" + data.Leg2ProdFamilyCode + "','" + std::to_string(data.CommodityGroupID)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcInvestorProdRULEMarginFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcInvestorProdRULEMarginField data;
CThostFtdcInvestorProdRULEMarginFieldWrapper(const CThostFtdcInvestorProdRULEMarginField& _data = { 0 }) :data(_data) { }
CThostFtdcInvestorProdRULEMarginFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcInvestorProdRULEMarginField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.ProdFamilyCode, rowValue.at("ProdFamilyCode").c_str(), sizeof(TThostFtdcInstrumentIDType));
data.InstrumentClass = rowValue.at("InstrumentClass").empty() ? '0' : rowValue.at("InstrumentClass")[0];
data.CommodityGroupID = std::stoi(rowValue.at("CommodityGroupID"));
data.BStdPosition = std::stod(rowValue.at("BStdPosition"));
data.SStdPosition = std::stod(rowValue.at("SStdPosition"));
data.BStdOpenFrozen = std::stod(rowValue.at("BStdOpenFrozen"));
data.SStdOpenFrozen = std::stod(rowValue.at("SStdOpenFrozen"));
data.BStdCloseFrozen = std::stod(rowValue.at("BStdCloseFrozen"));
data.SStdCloseFrozen = std::stod(rowValue.at("SStdCloseFrozen"));
data.IntraProdStdPosition = std::stod(rowValue.at("IntraProdStdPosition"));
data.NetStdPosition = std::stod(rowValue.at("NetStdPosition"));
data.InterProdStdPosition = std::stod(rowValue.at("InterProdStdPosition"));
data.SingleStdPosition = std::stod(rowValue.at("SingleStdPosition"));
data.IntraProdMargin = std::stod(rowValue.at("IntraProdMargin"));
data.InterProdMargin = std::stod(rowValue.at("InterProdMargin"));
data.SingleMargin = std::stod(rowValue.at("SingleMargin"));
data.NonCombMargin = std::stod(rowValue.at("NonCombMargin"));
data.AddOnMargin = std::stod(rowValue.at("AddOnMargin"));
data.ExchMargin = std::stod(rowValue.at("ExchMargin"));
data.AddOnFrozenMargin = std::stod(rowValue.at("AddOnFrozenMargin"));
data.OpenFrozenMargin = std::stod(rowValue.at("OpenFrozenMargin"));
data.CloseFrozenMargin = std::stod(rowValue.at("CloseFrozenMargin"));
data.Margin = std::stod(rowValue.at("Margin"));
data.FrozenMargin = std::stod(rowValue.at("FrozenMargin"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.ExchangeID + "','" + data.BrokerID + "','" + data.InvestorID + "','" + data.ProdFamilyCode + "','" + (data.InstrumentClass == 0 ? '0' : data.InstrumentClass) + "','" + std::to_string(data.CommodityGroupID) + "','" + std::to_string(data.BStdPosition) + "','" + std::to_string(data.SStdPosition) + "','" + std::to_string(data.BStdOpenFrozen) + "','" + std::to_string(data.SStdOpenFrozen) + "','" + std::to_string(data.BStdCloseFrozen) + "','" + std::to_string(data.SStdCloseFrozen) + "','" + std::to_string(data.IntraProdStdPosition) + "','" + std::to_string(data.NetStdPosition) + "','" + std::to_string(data.InterProdStdPosition) + "','" + std::to_string(data.SingleStdPosition) + "','" + std::to_string(data.IntraProdMargin) + "','" + std::to_string(data.InterProdMargin) + "','" + std::to_string(data.SingleMargin) + "','" + std::to_string(data.NonCombMargin) + "','" + std::to_string(data.AddOnMargin) + "','" + std::to_string(data.ExchMargin) + "','" + std::to_string(data.AddOnFrozenMargin) + "','" + std::to_string(data.OpenFrozenMargin) + "','" + std::to_string(data.CloseFrozenMargin) + "','" + std::to_string(data.Margin) + "','" + std::to_string(data.FrozenMargin)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcInvestorProdRULEMarginField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcQryInvestorProdRULEMarginFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryInvestorProdRULEMarginField data;
CThostFtdcQryInvestorProdRULEMarginFieldWrapper(const CThostFtdcQryInvestorProdRULEMarginField& _data = { 0 }) :data(_data) { }
CThostFtdcQryInvestorProdRULEMarginFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryInvestorProdRULEMarginField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.ProdFamilyCode, rowValue.at("ProdFamilyCode").c_str(), sizeof(TThostFtdcInstrumentIDType));
data.CommodityGroupID = std::stoi(rowValue.at("CommodityGroupID"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.ExchangeID + "','" + data.BrokerID + "','" + data.InvestorID + "','" + data.ProdFamilyCode + "','" + std::to_string(data.CommodityGroupID)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcQryInvestorProdRULEMarginField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcSyncDeltaSPBMPortfDefinitionFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcSyncDeltaSPBMPortfDefinitionField data;
CThostFtdcSyncDeltaSPBMPortfDefinitionFieldWrapper(const CThostFtdcSyncDeltaSPBMPortfDefinitionField& _data = { 0 }) :data(_data) { }
CThostFtdcSyncDeltaSPBMPortfDefinitionFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcSyncDeltaSPBMPortfDefinitionField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
data.PortfolioDefID = std::stoi(rowValue.at("PortfolioDefID"));
strncpy(data.ProdFamilyCode, rowValue.at("ProdFamilyCode").c_str(), sizeof(TThostFtdcInstrumentIDType));
data.IsSPBM = std::stoi(rowValue.at("IsSPBM"));
data.ActionDirection = rowValue.at("ActionDirection").empty() ? '0' : rowValue.at("ActionDirection")[0];
data.SyncDeltaSequenceNo = std::stoi(rowValue.at("SyncDeltaSequenceNo"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.ExchangeID + "','" + std::to_string(data.PortfolioDefID) + "','" + data.ProdFamilyCode + "','" + std::to_string(data.IsSPBM) + "','" + (data.ActionDirection == 0 ? '0' : data.ActionDirection) + "','" + std::to_string(data.SyncDeltaSequenceNo)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcSyncDeltaSPBMInvstPortfDefFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcSyncDeltaSPBMInvstPortfDefField data;
CThostFtdcSyncDeltaSPBMInvstPortfDefFieldWrapper(const CThostFtdcSyncDeltaSPBMInvstPortfDefField& _data = { 0 }) :data(_data) { }
CThostFtdcSyncDeltaSPBMInvstPortfDefFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcSyncDeltaSPBMInvstPortfDefField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
data.PortfolioDefID = std::stoi(rowValue.at("PortfolioDefID"));
data.ActionDirection = rowValue.at("ActionDirection").empty() ? '0' : rowValue.at("ActionDirection")[0];
data.SyncDeltaSequenceNo = std::stoi(rowValue.at("SyncDeltaSequenceNo"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.ExchangeID + "','" + data.BrokerID + "','" + data.InvestorID + "','" + std::to_string(data.PortfolioDefID) + "','" + (data.ActionDirection == 0 ? '0' : data.ActionDirection) + "','" + std::to_string(data.SyncDeltaSequenceNo)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcSyncDeltaSPBMInvstPortfDefField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcSyncDeltaSPBMFutureParameterFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcSyncDeltaSPBMFutureParameterField data;
CThostFtdcSyncDeltaSPBMFutureParameterFieldWrapper(const CThostFtdcSyncDeltaSPBMFutureParameterField& _data = { 0 }) :data(_data) { }
CThostFtdcSyncDeltaSPBMFutureParameterFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcSyncDeltaSPBMFutureParameterField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
strncpy(data.ProdFamilyCode, rowValue.at("ProdFamilyCode").c_str(), sizeof(TThostFtdcInstrumentIDType));
data.Cvf = std::stoi(rowValue.at("Cvf"));
data.TimeRange = rowValue.at("TimeRange").empty() ? '0' : rowValue.at("TimeRange")[0];
data.MarginRate = std::stod(rowValue.at("MarginRate"));
data.LockRateX = std::stod(rowValue.at("LockRateX"));
data.AddOnRate = std::stod(rowValue.at("AddOnRate"));
data.PreSettlementPrice = std::stod(rowValue.at("PreSettlementPrice"));
data.AddOnLockRateX2 = std::stod(rowValue.at("AddOnLockRateX2"));
data.ActionDirection = rowValue.at("ActionDirection").empty() ? '0' : rowValue.at("ActionDirection")[0];
data.SyncDeltaSequenceNo = std::stoi(rowValue.at("SyncDeltaSequenceNo"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.TradingDay + "','" + data.ExchangeID + "','" + data.InstrumentID + "','" + data.ProdFamilyCode + "','" + std::to_string(data.Cvf) + "','" + (data.TimeRange == 0 ? '0' : data.TimeRange) + "','" + std::to_string(data.MarginRate) + "','" + std::to_string(data.LockRateX) + "','" + std::to_string(data.AddOnRate) + "','" + std::to_string(data.PreSettlementPrice) + "','" + std::to_string(data.AddOnLockRateX2) + "','" + (data.ActionDirection == 0 ? '0' : data.ActionDirection) + "','" + std::to_string(data.SyncDeltaSequenceNo)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcSyncDeltaSPBMOptionParameterFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcSyncDeltaSPBMOptionParameterField data;
CThostFtdcSyncDeltaSPBMOptionParameterFieldWrapper(const CThostFtdcSyncDeltaSPBMOptionParameterField& _data = { 0 }) :data(_data) { }
CThostFtdcSyncDeltaSPBMOptionParameterFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcSyncDeltaSPBMOptionParameterField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
strncpy(data.ProdFamilyCode, rowValue.at("ProdFamilyCode").c_str(), sizeof(TThostFtdcInstrumentIDType));
data.Cvf = std::stoi(rowValue.at("Cvf"));
data.DownPrice = std::stod(rowValue.at("DownPrice"));
data.Delta = std::stod(rowValue.at("Delta"));
data.SlimiDelta = std::stod(rowValue.at("SlimiDelta"));
data.PreSettlementPrice = std::stod(rowValue.at("PreSettlementPrice"));
data.ActionDirection = rowValue.at("ActionDirection").empty() ? '0' : rowValue.at("ActionDirection")[0];
data.SyncDeltaSequenceNo = std::stoi(rowValue.at("SyncDeltaSequenceNo"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.TradingDay + "','" + data.ExchangeID + "','" + data.InstrumentID + "','" + data.ProdFamilyCode + "','" + std::to_string(data.Cvf) + "','" + std::to_string(data.DownPrice) + "','" + std::to_string(data.Delta) + "','" + std::to_string(data.SlimiDelta) + "','" + std::to_string(data.PreSettlementPrice) + "','" + (data.ActionDirection == 0 ? '0' : data.ActionDirection) + "','" + std::to_string(data.SyncDeltaSequenceNo)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcSyncDeltaSPBMIntraParameterFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcSyncDeltaSPBMIntraParameterField data;
CThostFtdcSyncDeltaSPBMIntraParameterFieldWrapper(const CThostFtdcSyncDeltaSPBMIntraParameterField& _data = { 0 }) :data(_data) { }
CThostFtdcSyncDeltaSPBMIntraParameterFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcSyncDeltaSPBMIntraParameterField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.ProdFamilyCode, rowValue.at("ProdFamilyCode").c_str(), sizeof(TThostFtdcInstrumentIDType));
data.IntraRateY = std::stod(rowValue.at("IntraRateY"));
data.AddOnIntraRateY2 = std::stod(rowValue.at("AddOnIntraRateY2"));
data.ActionDirection = rowValue.at("ActionDirection").empty() ? '0' : rowValue.at("ActionDirection")[0];
data.SyncDeltaSequenceNo = std::stoi(rowValue.at("SyncDeltaSequenceNo"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.TradingDay + "','" + data.ExchangeID + "','" + data.ProdFamilyCode + "','" + std::to_string(data.IntraRateY) + "','" + std::to_string(data.AddOnIntraRateY2) + "','" + (data.ActionDirection == 0 ? '0' : data.ActionDirection) + "','" + std::to_string(data.SyncDeltaSequenceNo)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcSyncDeltaSPBMInterParameterFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcSyncDeltaSPBMInterParameterField data;
CThostFtdcSyncDeltaSPBMInterParameterFieldWrapper(const CThostFtdcSyncDeltaSPBMInterParameterField& _data = { 0 }) :data(_data) { }
CThostFtdcSyncDeltaSPBMInterParameterFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcSyncDeltaSPBMInterParameterField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
data.SpreadId = std::stoi(rowValue.at("SpreadId"));
data.InterRateZ = std::stod(rowValue.at("InterRateZ"));
strncpy(data.Leg1ProdFamilyCode, rowValue.at("Leg1ProdFamilyCode").c_str(), sizeof(TThostFtdcInstrumentIDType));
strncpy(data.Leg2ProdFamilyCode, rowValue.at("Leg2ProdFamilyCode").c_str(), sizeof(TThostFtdcInstrumentIDType));
data.ActionDirection = rowValue.at("ActionDirection").empty() ? '0' : rowValue.at("ActionDirection")[0];
data.SyncDeltaSequenceNo = std::stoi(rowValue.at("SyncDeltaSequenceNo"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.TradingDay + "','" + data.ExchangeID + "','" + std::to_string(data.SpreadId) + "','" + std::to_string(data.InterRateZ) + "','" + data.Leg1ProdFamilyCode + "','" + data.Leg2ProdFamilyCode + "','" + (data.ActionDirection == 0 ? '0' : data.ActionDirection) + "','" + std::to_string(data.SyncDeltaSequenceNo)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcSyncDeltaSPBMAddOnInterParamFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcSyncDeltaSPBMAddOnInterParamField data;
CThostFtdcSyncDeltaSPBMAddOnInterParamFieldWrapper(const CThostFtdcSyncDeltaSPBMAddOnInterParamField& _data = { 0 }) :data(_data) { }
CThostFtdcSyncDeltaSPBMAddOnInterParamFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcSyncDeltaSPBMAddOnInterParamField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
data.SpreadId = std::stoi(rowValue.at("SpreadId"));
data.AddOnInterRateZ2 = std::stod(rowValue.at("AddOnInterRateZ2"));
strncpy(data.Leg1ProdFamilyCode, rowValue.at("Leg1ProdFamilyCode").c_str(), sizeof(TThostFtdcInstrumentIDType));
strncpy(data.Leg2ProdFamilyCode, rowValue.at("Leg2ProdFamilyCode").c_str(), sizeof(TThostFtdcInstrumentIDType));
data.ActionDirection = rowValue.at("ActionDirection").empty() ? '0' : rowValue.at("ActionDirection")[0];
data.SyncDeltaSequenceNo = std::stoi(rowValue.at("SyncDeltaSequenceNo"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.TradingDay + "','" + data.ExchangeID + "','" + std::to_string(data.SpreadId) + "','" + std::to_string(data.AddOnInterRateZ2) + "','" + data.Leg1ProdFamilyCode + "','" + data.Leg2ProdFamilyCode + "','" + (data.ActionDirection == 0 ? '0' : data.ActionDirection) + "','" + std::to_string(data.SyncDeltaSequenceNo)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcSyncDeltaSPMMInstParamFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcSyncDeltaSPMMInstParamField data;
CThostFtdcSyncDeltaSPMMInstParamFieldWrapper(const CThostFtdcSyncDeltaSPMMInstParamField& _data = { 0 }) :data(_data) { }
CThostFtdcSyncDeltaSPMMInstParamFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcSyncDeltaSPMMInstParamField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
data.InstMarginCalID = rowValue.at("InstMarginCalID").empty() ? '0' : rowValue.at("InstMarginCalID")[0];
strncpy(data.CommodityID, rowValue.at("CommodityID").c_str(), sizeof(TThostFtdcSPMMProductIDType));
strncpy(data.CommodityGroupID, rowValue.at("CommodityGroupID").c_str(), sizeof(TThostFtdcSPMMProductIDType));
data.ActionDirection = rowValue.at("ActionDirection").empty() ? '0' : rowValue.at("ActionDirection")[0];
data.SyncDeltaSequenceNo = std::stoi(rowValue.at("SyncDeltaSequenceNo"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.ExchangeID + "','" + data.InstrumentID + "','" + (data.InstMarginCalID == 0 ? '0' : data.InstMarginCalID) + "','" + data.CommodityID + "','" + data.CommodityGroupID + "','" + (data.ActionDirection == 0 ? '0' : data.ActionDirection) + "','" + std::to_string(data.SyncDeltaSequenceNo)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcSyncDeltaSPMMProductParamFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcSyncDeltaSPMMProductParamField data;
CThostFtdcSyncDeltaSPMMProductParamFieldWrapper(const CThostFtdcSyncDeltaSPMMProductParamField& _data = { 0 }) :data(_data) { }
CThostFtdcSyncDeltaSPMMProductParamFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcSyncDeltaSPMMProductParamField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.ProductID, rowValue.at("ProductID").c_str(), sizeof(TThostFtdcSPMMProductIDType));
strncpy(data.CommodityID, rowValue.at("CommodityID").c_str(), sizeof(TThostFtdcSPMMProductIDType));
strncpy(data.CommodityGroupID, rowValue.at("CommodityGroupID").c_str(), sizeof(TThostFtdcSPMMProductIDType));
data.ActionDirection = rowValue.at("ActionDirection").empty() ? '0' : rowValue.at("ActionDirection")[0];
data.SyncDeltaSequenceNo = std::stoi(rowValue.at("SyncDeltaSequenceNo"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.ExchangeID + "','" + data.ProductID + "','" + data.CommodityID + "','" + data.CommodityGroupID + "','" + (data.ActionDirection == 0 ? '0' : data.ActionDirection) + "','" + std::to_string(data.SyncDeltaSequenceNo)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcSyncDeltaInvestorSPMMModelFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcSyncDeltaInvestorSPMMModelField data;
CThostFtdcSyncDeltaInvestorSPMMModelFieldWrapper(const CThostFtdcSyncDeltaInvestorSPMMModelField& _data = { 0 }) :data(_data) { }
CThostFtdcSyncDeltaInvestorSPMMModelFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcSyncDeltaInvestorSPMMModelField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.SPMMModelID, rowValue.at("SPMMModelID").c_str(), sizeof(TThostFtdcSPMMModelIDType));
data.ActionDirection = rowValue.at("ActionDirection").empty() ? '0' : rowValue.at("ActionDirection")[0];
data.SyncDeltaSequenceNo = std::stoi(rowValue.at("SyncDeltaSequenceNo"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.ExchangeID + "','" + data.BrokerID + "','" + data.InvestorID + "','" + data.SPMMModelID + "','" + (data.ActionDirection == 0 ? '0' : data.ActionDirection) + "','" + std::to_string(data.SyncDeltaSequenceNo)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcSyncDeltaInvestorSPMMModelField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcSyncDeltaSPMMModelParamFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcSyncDeltaSPMMModelParamField data;
CThostFtdcSyncDeltaSPMMModelParamFieldWrapper(const CThostFtdcSyncDeltaSPMMModelParamField& _data = { 0 }) :data(_data) { }
CThostFtdcSyncDeltaSPMMModelParamFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcSyncDeltaSPMMModelParamField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.SPMMModelID, rowValue.at("SPMMModelID").c_str(), sizeof(TThostFtdcSPMMModelIDType));
strncpy(data.CommodityGroupID, rowValue.at("CommodityGroupID").c_str(), sizeof(TThostFtdcSPMMProductIDType));
data.IntraCommodityRate = std::stod(rowValue.at("IntraCommodityRate"));
data.InterCommodityRate = std::stod(rowValue.at("InterCommodityRate"));
data.OptionDiscountRate = std::stod(rowValue.at("OptionDiscountRate"));
data.MiniMarginRatio = std::stod(rowValue.at("MiniMarginRatio"));
data.ActionDirection = rowValue.at("ActionDirection").empty() ? '0' : rowValue.at("ActionDirection")[0];
data.SyncDeltaSequenceNo = std::stoi(rowValue.at("SyncDeltaSequenceNo"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.ExchangeID + "','" + data.SPMMModelID + "','" + data.CommodityGroupID + "','" + std::to_string(data.IntraCommodityRate) + "','" + std::to_string(data.InterCommodityRate) + "','" + std::to_string(data.OptionDiscountRate) + "','" + std::to_string(data.MiniMarginRatio) + "','" + (data.ActionDirection == 0 ? '0' : data.ActionDirection) + "','" + std::to_string(data.SyncDeltaSequenceNo)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcSyncDeltaRCAMSCombProdInfoFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcSyncDeltaRCAMSCombProdInfoField data;
CThostFtdcSyncDeltaRCAMSCombProdInfoFieldWrapper(const CThostFtdcSyncDeltaRCAMSCombProdInfoField& _data = { 0 }) :data(_data) { }
CThostFtdcSyncDeltaRCAMSCombProdInfoFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcSyncDeltaRCAMSCombProdInfoField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.ProductID, rowValue.at("ProductID").c_str(), sizeof(TThostFtdcProductIDType));
strncpy(data.CombProductID, rowValue.at("CombProductID").c_str(), sizeof(TThostFtdcProductIDType));
strncpy(data.ProductGroupID, rowValue.at("ProductGroupID").c_str(), sizeof(TThostFtdcProductIDType));
data.ActionDirection = rowValue.at("ActionDirection").empty() ? '0' : rowValue.at("ActionDirection")[0];
data.SyncDeltaSequenceNo = std::stoi(rowValue.at("SyncDeltaSequenceNo"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.TradingDay + "','" + data.ExchangeID + "','" + data.ProductID + "','" + data.CombProductID + "','" + data.ProductGroupID + "','" + (data.ActionDirection == 0 ? '0' : data.ActionDirection) + "','" + std::to_string(data.SyncDeltaSequenceNo)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcSyncDeltaRCAMSInstrParameterFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcSyncDeltaRCAMSInstrParameterField data;
CThostFtdcSyncDeltaRCAMSInstrParameterFieldWrapper(const CThostFtdcSyncDeltaRCAMSInstrParameterField& _data = { 0 }) :data(_data) { }
CThostFtdcSyncDeltaRCAMSInstrParameterFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcSyncDeltaRCAMSInstrParameterField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.ProductID, rowValue.at("ProductID").c_str(), sizeof(TThostFtdcProductIDType));
data.HedgeRate = std::stod(rowValue.at("HedgeRate"));
data.ActionDirection = rowValue.at("ActionDirection").empty() ? '0' : rowValue.at("ActionDirection")[0];
data.SyncDeltaSequenceNo = std::stoi(rowValue.at("SyncDeltaSequenceNo"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.TradingDay + "','" + data.ExchangeID + "','" + data.ProductID + "','" + std::to_string(data.HedgeRate) + "','" + (data.ActionDirection == 0 ? '0' : data.ActionDirection) + "','" + std::to_string(data.SyncDeltaSequenceNo)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcSyncDeltaRCAMSIntraParameterFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcSyncDeltaRCAMSIntraParameterField data;
CThostFtdcSyncDeltaRCAMSIntraParameterFieldWrapper(const CThostFtdcSyncDeltaRCAMSIntraParameterField& _data = { 0 }) :data(_data) { }
CThostFtdcSyncDeltaRCAMSIntraParameterFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcSyncDeltaRCAMSIntraParameterField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.CombProductID, rowValue.at("CombProductID").c_str(), sizeof(TThostFtdcProductIDType));
data.HedgeRate = std::stod(rowValue.at("HedgeRate"));
data.ActionDirection = rowValue.at("ActionDirection").empty() ? '0' : rowValue.at("ActionDirection")[0];
data.SyncDeltaSequenceNo = std::stoi(rowValue.at("SyncDeltaSequenceNo"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.TradingDay + "','" + data.ExchangeID + "','" + data.CombProductID + "','" + std::to_string(data.HedgeRate) + "','" + (data.ActionDirection == 0 ? '0' : data.ActionDirection) + "','" + std::to_string(data.SyncDeltaSequenceNo)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcSyncDeltaRCAMSInterParameterFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcSyncDeltaRCAMSInterParameterField data;
CThostFtdcSyncDeltaRCAMSInterParameterFieldWrapper(const CThostFtdcSyncDeltaRCAMSInterParameterField& _data = { 0 }) :data(_data) { }
CThostFtdcSyncDeltaRCAMSInterParameterFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcSyncDeltaRCAMSInterParameterField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.ProductGroupID, rowValue.at("ProductGroupID").c_str(), sizeof(TThostFtdcProductIDType));
data.Priority = std::stoi(rowValue.at("Priority"));
data.CreditRate = std::stod(rowValue.at("CreditRate"));
strncpy(data.CombProduct1, rowValue.at("CombProduct1").c_str(), sizeof(TThostFtdcProductIDType));
strncpy(data.CombProduct2, rowValue.at("CombProduct2").c_str(), sizeof(TThostFtdcProductIDType));
data.ActionDirection = rowValue.at("ActionDirection").empty() ? '0' : rowValue.at("ActionDirection")[0];
data.SyncDeltaSequenceNo = std::stoi(rowValue.at("SyncDeltaSequenceNo"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.TradingDay + "','" + data.ExchangeID + "','" + data.ProductGroupID + "','" + std::to_string(data.Priority) + "','" + std::to_string(data.CreditRate) + "','" + data.CombProduct1 + "','" + data.CombProduct2 + "','" + (data.ActionDirection == 0 ? '0' : data.ActionDirection) + "','" + std::to_string(data.SyncDeltaSequenceNo)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcSyncDeltaRCAMSSOptAdjParamFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcSyncDeltaRCAMSSOptAdjParamField data;
CThostFtdcSyncDeltaRCAMSSOptAdjParamFieldWrapper(const CThostFtdcSyncDeltaRCAMSSOptAdjParamField& _data = { 0 }) :data(_data) { }
CThostFtdcSyncDeltaRCAMSSOptAdjParamFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcSyncDeltaRCAMSSOptAdjParamField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.CombProductID, rowValue.at("CombProductID").c_str(), sizeof(TThostFtdcProductIDType));
data.HedgeFlag = rowValue.at("HedgeFlag").empty() ? '0' : rowValue.at("HedgeFlag")[0];
data.AdjustValue = std::stod(rowValue.at("AdjustValue"));
data.ActionDirection = rowValue.at("ActionDirection").empty() ? '0' : rowValue.at("ActionDirection")[0];
data.SyncDeltaSequenceNo = std::stoi(rowValue.at("SyncDeltaSequenceNo"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.TradingDay + "','" + data.ExchangeID + "','" + data.CombProductID + "','" + (data.HedgeFlag == 0 ? '0' : data.HedgeFlag) + "','" + std::to_string(data.AdjustValue) + "','" + (data.ActionDirection == 0 ? '0' : data.ActionDirection) + "','" + std::to_string(data.SyncDeltaSequenceNo)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcSyncDeltaRCAMSCombRuleDtlFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcSyncDeltaRCAMSCombRuleDtlField data;
CThostFtdcSyncDeltaRCAMSCombRuleDtlFieldWrapper(const CThostFtdcSyncDeltaRCAMSCombRuleDtlField& _data = { 0 }) :data(_data) { }
CThostFtdcSyncDeltaRCAMSCombRuleDtlFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcSyncDeltaRCAMSCombRuleDtlField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.ProdGroup, rowValue.at("ProdGroup").c_str(), sizeof(TThostFtdcProductIDType));
strncpy(data.RuleId, rowValue.at("RuleId").c_str(), sizeof(TThostFtdcRuleIdType));
data.Priority = std::stoi(rowValue.at("Priority"));
data.HedgeFlag = rowValue.at("HedgeFlag").empty() ? '0' : rowValue.at("HedgeFlag")[0];
data.CombMargin = std::stod(rowValue.at("CombMargin"));
strncpy(data.ExchangeInstID, rowValue.at("ExchangeInstID").c_str(), sizeof(TThostFtdcExchangeInstIDType));
data.LegID = std::stoi(rowValue.at("LegID"));
strncpy(data.LegInstrumentID, rowValue.at("LegInstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
data.Direction = rowValue.at("Direction").empty() ? '0' : rowValue.at("Direction")[0];
data.LegMultiple = std::stoi(rowValue.at("LegMultiple"));
data.ActionDirection = rowValue.at("ActionDirection").empty() ? '0' : rowValue.at("ActionDirection")[0];
data.SyncDeltaSequenceNo = std::stoi(rowValue.at("SyncDeltaSequenceNo"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.TradingDay + "','" + data.ExchangeID + "','" + data.ProdGroup + "','" + data.RuleId + "','" + std::to_string(data.Priority) + "','" + (data.HedgeFlag == 0 ? '0' : data.HedgeFlag) + "','" + std::to_string(data.CombMargin) + "','" + data.ExchangeInstID + "','" + std::to_string(data.LegID) + "','" + data.LegInstrumentID + "','" + (data.Direction == 0 ? '0' : data.Direction) + "','" + std::to_string(data.LegMultiple) + "','" + (data.ActionDirection == 0 ? '0' : data.ActionDirection) + "','" + std::to_string(data.SyncDeltaSequenceNo)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcSyncDeltaRCAMSInvstCombPosFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcSyncDeltaRCAMSInvstCombPosField data;
CThostFtdcSyncDeltaRCAMSInvstCombPosFieldWrapper(const CThostFtdcSyncDeltaRCAMSInvstCombPosField& _data = { 0 }) :data(_data) { }
CThostFtdcSyncDeltaRCAMSInvstCombPosFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcSyncDeltaRCAMSInvstCombPosField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
data.HedgeFlag = rowValue.at("HedgeFlag").empty() ? '0' : rowValue.at("HedgeFlag")[0];
data.PosiDirection = rowValue.at("PosiDirection").empty() ? '0' : rowValue.at("PosiDirection")[0];
strncpy(data.CombInstrumentID, rowValue.at("CombInstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
data.LegID = std::stoi(rowValue.at("LegID"));
strncpy(data.ExchangeInstID, rowValue.at("ExchangeInstID").c_str(), sizeof(TThostFtdcExchangeInstIDType));
data.TotalAmt = std::stoi(rowValue.at("TotalAmt"));
data.ExchMargin = std::stod(rowValue.at("ExchMargin"));
data.Margin = std::stod(rowValue.at("Margin"));
data.ActionDirection = rowValue.at("ActionDirection").empty() ? '0' : rowValue.at("ActionDirection")[0];
data.SyncDeltaSequenceNo = std::stoi(rowValue.at("SyncDeltaSequenceNo"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.ExchangeID + "','" + data.BrokerID + "','" + data.InvestorID + "','" + data.InstrumentID + "','" + (data.HedgeFlag == 0 ? '0' : data.HedgeFlag) + "','" + (data.PosiDirection == 0 ? '0' : data.PosiDirection) + "','" + data.CombInstrumentID + "','" + std::to_string(data.LegID) + "','" + data.ExchangeInstID + "','" + std::to_string(data.TotalAmt) + "','" + std::to_string(data.ExchMargin) + "','" + std::to_string(data.Margin) + "','" + (data.ActionDirection == 0 ? '0' : data.ActionDirection) + "','" + std::to_string(data.SyncDeltaSequenceNo)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcSyncDeltaRCAMSInvstCombPosField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcSyncDeltaRULEInstrParameterFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcSyncDeltaRULEInstrParameterField data;
CThostFtdcSyncDeltaRULEInstrParameterFieldWrapper(const CThostFtdcSyncDeltaRULEInstrParameterField& _data = { 0 }) :data(_data) { }
CThostFtdcSyncDeltaRULEInstrParameterFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcSyncDeltaRULEInstrParameterField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
data.InstrumentClass = rowValue.at("InstrumentClass").empty() ? '0' : rowValue.at("InstrumentClass")[0];
strncpy(data.StdInstrumentID, rowValue.at("StdInstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
data.BSpecRatio = std::stod(rowValue.at("BSpecRatio"));
data.SSpecRatio = std::stod(rowValue.at("SSpecRatio"));
data.BHedgeRatio = std::stod(rowValue.at("BHedgeRatio"));
data.SHedgeRatio = std::stod(rowValue.at("SHedgeRatio"));
data.BAddOnMargin = std::stod(rowValue.at("BAddOnMargin"));
data.SAddOnMargin = std::stod(rowValue.at("SAddOnMargin"));
data.CommodityGroupID = std::stoi(rowValue.at("CommodityGroupID"));
data.ActionDirection = rowValue.at("ActionDirection").empty() ? '0' : rowValue.at("ActionDirection")[0];
data.SyncDeltaSequenceNo = std::stoi(rowValue.at("SyncDeltaSequenceNo"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.TradingDay + "','" + data.ExchangeID + "','" + data.InstrumentID + "','" + (data.InstrumentClass == 0 ? '0' : data.InstrumentClass) + "','" + data.StdInstrumentID + "','" + std::to_string(data.BSpecRatio) + "','" + std::to_string(data.SSpecRatio) + "','" + std::to_string(data.BHedgeRatio) + "','" + std::to_string(data.SHedgeRatio) + "','" + std::to_string(data.BAddOnMargin) + "','" + std::to_string(data.SAddOnMargin) + "','" + std::to_string(data.CommodityGroupID) + "','" + (data.ActionDirection == 0 ? '0' : data.ActionDirection) + "','" + std::to_string(data.SyncDeltaSequenceNo)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcSyncDeltaRULEIntraParameterFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcSyncDeltaRULEIntraParameterField data;
CThostFtdcSyncDeltaRULEIntraParameterFieldWrapper(const CThostFtdcSyncDeltaRULEIntraParameterField& _data = { 0 }) :data(_data) { }
CThostFtdcSyncDeltaRULEIntraParameterFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcSyncDeltaRULEIntraParameterField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.ProdFamilyCode, rowValue.at("ProdFamilyCode").c_str(), sizeof(TThostFtdcInstrumentIDType));
strncpy(data.StdInstrumentID, rowValue.at("StdInstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
data.StdInstrMargin = std::stod(rowValue.at("StdInstrMargin"));
data.UsualIntraRate = std::stod(rowValue.at("UsualIntraRate"));
data.DeliveryIntraRate = std::stod(rowValue.at("DeliveryIntraRate"));
data.ActionDirection = rowValue.at("ActionDirection").empty() ? '0' : rowValue.at("ActionDirection")[0];
data.SyncDeltaSequenceNo = std::stoi(rowValue.at("SyncDeltaSequenceNo"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.TradingDay + "','" + data.ExchangeID + "','" + data.ProdFamilyCode + "','" + data.StdInstrumentID + "','" + std::to_string(data.StdInstrMargin) + "','" + std::to_string(data.UsualIntraRate) + "','" + std::to_string(data.DeliveryIntraRate) + "','" + (data.ActionDirection == 0 ? '0' : data.ActionDirection) + "','" + std::to_string(data.SyncDeltaSequenceNo)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcSyncDeltaRULEInterParameterFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcSyncDeltaRULEInterParameterField data;
CThostFtdcSyncDeltaRULEInterParameterFieldWrapper(const CThostFtdcSyncDeltaRULEInterParameterField& _data = { 0 }) :data(_data) { }
CThostFtdcSyncDeltaRULEInterParameterFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcSyncDeltaRULEInterParameterField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
data.SpreadId = std::stoi(rowValue.at("SpreadId"));
data.InterRate = std::stod(rowValue.at("InterRate"));
strncpy(data.Leg1ProdFamilyCode, rowValue.at("Leg1ProdFamilyCode").c_str(), sizeof(TThostFtdcInstrumentIDType));
strncpy(data.Leg2ProdFamilyCode, rowValue.at("Leg2ProdFamilyCode").c_str(), sizeof(TThostFtdcInstrumentIDType));
data.Leg1PropFactor = std::stoi(rowValue.at("Leg1PropFactor"));
data.Leg2PropFactor = std::stoi(rowValue.at("Leg2PropFactor"));
data.CommodityGroupID = std::stoi(rowValue.at("CommodityGroupID"));
strncpy(data.CommodityGroupName, rowValue.at("CommodityGroupName").c_str(), sizeof(TThostFtdcInstrumentNameType));
data.ActionDirection = rowValue.at("ActionDirection").empty() ? '0' : rowValue.at("ActionDirection")[0];
data.SyncDeltaSequenceNo = std::stoi(rowValue.at("SyncDeltaSequenceNo"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.TradingDay + "','" + data.ExchangeID + "','" + std::to_string(data.SpreadId) + "','" + std::to_string(data.InterRate) + "','" + data.Leg1ProdFamilyCode + "','" + data.Leg2ProdFamilyCode + "','" + std::to_string(data.Leg1PropFactor) + "','" + std::to_string(data.Leg2PropFactor) + "','" + std::to_string(data.CommodityGroupID) + "','" + data.CommodityGroupName + "','" + (data.ActionDirection == 0 ? '0' : data.ActionDirection) + "','" + std::to_string(data.SyncDeltaSequenceNo)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcIpAddrParamFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcIpAddrParamField data;
CThostFtdcIpAddrParamFieldWrapper(const CThostFtdcIpAddrParamField& _data = { 0 }) :data(_data) { }
CThostFtdcIpAddrParamFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcIpAddrParamField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.Address, rowValue.at("Address").c_str(), sizeof(TThostFtdcIpAddrType));
data.DRIdentityID = std::stoi(rowValue.at("DRIdentityID"));
strncpy(data.DRIdentityName, rowValue.at("DRIdentityName").c_str(), sizeof(TThostFtdcDRIdentityNameType));
data.AddrSrvMode = rowValue.at("AddrSrvMode").empty() ? '0' : rowValue.at("AddrSrvMode")[0];
data.AddrVer = rowValue.at("AddrVer").empty() ? '0' : rowValue.at("AddrVer")[0];
data.AddrNo = std::stoi(rowValue.at("AddrNo"));
strncpy(data.AddrName, rowValue.at("AddrName").c_str(), sizeof(TThostFtdcAddrNameType));
data.IsSM = std::stoi(rowValue.at("IsSM"));
data.IsLocalAddr = std::stoi(rowValue.at("IsLocalAddr"));
strncpy(data.Remark, rowValue.at("Remark").c_str(), sizeof(TThostFtdcAddrRemarkType));
strncpy(data.Site, rowValue.at("Site").c_str(), sizeof(TThostFtdcSiteType));
strncpy(data.NetOperator, rowValue.at("NetOperator").c_str(), sizeof(TThostFtdcNetOperatorType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.Address + "','" + std::to_string(data.DRIdentityID) + "','" + data.DRIdentityName + "','" + (data.AddrSrvMode == 0 ? '0' : data.AddrSrvMode) + "','" + (data.AddrVer == 0 ? '0' : data.AddrVer) + "','" + std::to_string(data.AddrNo) + "','" + data.AddrName + "','" + std::to_string(data.IsSM) + "','" + std::to_string(data.IsLocalAddr) + "','" + data.Remark + "','" + data.Site + "','" + data.NetOperator
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcQryIpAddrParamFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryIpAddrParamField data;
CThostFtdcQryIpAddrParamFieldWrapper(const CThostFtdcQryIpAddrParamField& _data = { 0 }) :data(_data) { }
CThostFtdcQryIpAddrParamFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryIpAddrParamField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcTGIpAddrParamFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcTGIpAddrParamField data;
CThostFtdcTGIpAddrParamFieldWrapper(const CThostFtdcTGIpAddrParamField& _data = { 0 }) :data(_data) { }
CThostFtdcTGIpAddrParamFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcTGIpAddrParamField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
strncpy(data.Address, rowValue.at("Address").c_str(), sizeof(TThostFtdcIpAddrType));
data.DRIdentityID = std::stoi(rowValue.at("DRIdentityID"));
strncpy(data.DRIdentityName, rowValue.at("DRIdentityName").c_str(), sizeof(TThostFtdcDRIdentityNameType));
data.AddrSrvMode = rowValue.at("AddrSrvMode").empty() ? '0' : rowValue.at("AddrSrvMode")[0];
data.AddrVer = rowValue.at("AddrVer").empty() ? '0' : rowValue.at("AddrVer")[0];
data.AddrNo = std::stoi(rowValue.at("AddrNo"));
strncpy(data.AddrName, rowValue.at("AddrName").c_str(), sizeof(TThostFtdcAddrNameType));
data.IsSM = std::stoi(rowValue.at("IsSM"));
data.IsLocalAddr = std::stoi(rowValue.at("IsLocalAddr"));
strncpy(data.Remark, rowValue.at("Remark").c_str(), sizeof(TThostFtdcAddrRemarkType));
strncpy(data.Site, rowValue.at("Site").c_str(), sizeof(TThostFtdcSiteType));
strncpy(data.NetOperator, rowValue.at("NetOperator").c_str(), sizeof(TThostFtdcNetOperatorType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.UserID + "','" + data.Address + "','" + std::to_string(data.DRIdentityID) + "','" + data.DRIdentityName + "','" + (data.AddrSrvMode == 0 ? '0' : data.AddrSrvMode) + "','" + (data.AddrVer == 0 ? '0' : data.AddrVer) + "','" + std::to_string(data.AddrNo) + "','" + data.AddrName + "','" + std::to_string(data.IsSM) + "','" + std::to_string(data.IsLocalAddr) + "','" + data.Remark + "','" + data.Site + "','" + data.NetOperator
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.UserID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& UserID) {
return "SELECT * FROM 'CThostFtdcTGIpAddrParamField' where BrokerID='" + BrokerID + "' and UserID='" + UserID + "';";
}
};
struct CThostFtdcQryTGIpAddrParamFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryTGIpAddrParamField data;
CThostFtdcQryTGIpAddrParamFieldWrapper(const CThostFtdcQryTGIpAddrParamField& _data = { 0 }) :data(_data) { }
CThostFtdcQryTGIpAddrParamFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryTGIpAddrParamField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
strncpy(data.AppID, rowValue.at("AppID").c_str(), sizeof(TThostFtdcAppIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.UserID + "','" + data.AppID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.UserID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& UserID) {
return "SELECT * FROM 'CThostFtdcQryTGIpAddrParamField' where BrokerID='" + BrokerID + "' and UserID='" + UserID + "';";
}
};
struct CThostFtdcTGSessionQryStatusFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcTGSessionQryStatusField data;
CThostFtdcTGSessionQryStatusFieldWrapper(const CThostFtdcTGSessionQryStatusField& _data = { 0 }) :data(_data) { }
CThostFtdcTGSessionQryStatusFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcTGSessionQryStatusField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
data.LastQryFreq = std::stoi(rowValue.at("LastQryFreq"));
data.QryStatus = rowValue.at("QryStatus").empty() ? '0' : rowValue.at("QryStatus")[0];
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
std::to_string(data.LastQryFreq) + "','" + (data.QryStatus == 0 ? '0' : data.QryStatus)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcLocalAddrConfigFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcLocalAddrConfigField data;
CThostFtdcLocalAddrConfigFieldWrapper(const CThostFtdcLocalAddrConfigField& _data = { 0 }) :data(_data) { }
CThostFtdcLocalAddrConfigFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcLocalAddrConfigField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.PeerAddr, rowValue.at("PeerAddr").c_str(), sizeof(TThostFtdcIpAddrType));
strncpy(data.NetMask, rowValue.at("NetMask").c_str(), sizeof(TThostFtdcIpAddrType));
data.DRIdentityID = std::stoi(rowValue.at("DRIdentityID"));
strncpy(data.LocalAddress, rowValue.at("LocalAddress").c_str(), sizeof(TThostFtdcIpAddrType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.PeerAddr + "','" + data.NetMask + "','" + std::to_string(data.DRIdentityID) + "','" + data.LocalAddress
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcQryLocalAddrConfigFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryLocalAddrConfigField data;
CThostFtdcQryLocalAddrConfigFieldWrapper(const CThostFtdcQryLocalAddrConfigField& _data = { 0 }) :data(_data) { }
CThostFtdcQryLocalAddrConfigFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryLocalAddrConfigField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcReqQueryBankAccountBySecFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcReqQueryBankAccountBySecField data;
CThostFtdcReqQueryBankAccountBySecFieldWrapper(const CThostFtdcReqQueryBankAccountBySecField& _data = { 0 }) :data(_data) { }
CThostFtdcReqQueryBankAccountBySecFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcReqQueryBankAccountBySecField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.TradeCode, rowValue.at("TradeCode").c_str(), sizeof(TThostFtdcTradeCodeType));
strncpy(data.BankID, rowValue.at("BankID").c_str(), sizeof(TThostFtdcBankIDType));
strncpy(data.BankBranchID, rowValue.at("BankBranchID").c_str(), sizeof(TThostFtdcBankBrchIDType));
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.BrokerBranchID, rowValue.at("BrokerBranchID").c_str(), sizeof(TThostFtdcFutureBranchIDType));
strncpy(data.TradeDate, rowValue.at("TradeDate").c_str(), sizeof(TThostFtdcTradeDateType));
strncpy(data.TradeTime, rowValue.at("TradeTime").c_str(), sizeof(TThostFtdcTradeTimeType));
strncpy(data.BankSerial, rowValue.at("BankSerial").c_str(), sizeof(TThostFtdcBankSerialType));
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcTradeDateType));
data.PlateSerial = std::stoi(rowValue.at("PlateSerial"));
data.LastFragment = rowValue.at("LastFragment").empty() ? '0' : rowValue.at("LastFragment")[0];
data.SessionID = std::stoi(rowValue.at("SessionID"));
strncpy(data.CustomerName, rowValue.at("CustomerName").c_str(), sizeof(TThostFtdcIndividualNameType));
data.IdCardType = rowValue.at("IdCardType").empty() ? '0' : rowValue.at("IdCardType")[0];
strncpy(data.IdentifiedCardNo, rowValue.at("IdentifiedCardNo").c_str(), sizeof(TThostFtdcIdentifiedCardNoType));
data.CustType = rowValue.at("CustType").empty() ? '0' : rowValue.at("CustType")[0];
strncpy(data.BankAccount, rowValue.at("BankAccount").c_str(), sizeof(TThostFtdcBankAccountType));
strncpy(data.BankPassWord, rowValue.at("BankPassWord").c_str(), sizeof(TThostFtdcPasswordType));
strncpy(data.AccountID, rowValue.at("AccountID").c_str(), sizeof(TThostFtdcAccountIDType));
strncpy(data.Password, rowValue.at("Password").c_str(), sizeof(TThostFtdcPasswordType));
data.FutureSerial = std::stoi(rowValue.at("FutureSerial"));
data.InstallID = std::stoi(rowValue.at("InstallID"));
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
data.VerifyCertNoFlag = rowValue.at("VerifyCertNoFlag").empty() ? '0' : rowValue.at("VerifyCertNoFlag")[0];
strncpy(data.CurrencyID, rowValue.at("CurrencyID").c_str(), sizeof(TThostFtdcCurrencyIDType));
strncpy(data.Digest, rowValue.at("Digest").c_str(), sizeof(TThostFtdcDigestType));
data.BankAccType = rowValue.at("BankAccType").empty() ? '0' : rowValue.at("BankAccType")[0];
strncpy(data.DeviceID, rowValue.at("DeviceID").c_str(), sizeof(TThostFtdcDeviceIDType));
data.BankSecuAccType = rowValue.at("BankSecuAccType").empty() ? '0' : rowValue.at("BankSecuAccType")[0];
strncpy(data.BrokerIDByBank, rowValue.at("BrokerIDByBank").c_str(), sizeof(TThostFtdcBankCodingForFutureType));
strncpy(data.BankSecuAcc, rowValue.at("BankSecuAcc").c_str(), sizeof(TThostFtdcBankAccountType));
data.BankPwdFlag = rowValue.at("BankPwdFlag").empty() ? '0' : rowValue.at("BankPwdFlag")[0];
data.SecuPwdFlag = rowValue.at("SecuPwdFlag").empty() ? '0' : rowValue.at("SecuPwdFlag")[0];
strncpy(data.OperNo, rowValue.at("OperNo").c_str(), sizeof(TThostFtdcOperNoType));
data.RequestID = std::stoi(rowValue.at("RequestID"));
data.TID = std::stoi(rowValue.at("TID"));
strncpy(data.LongCustomerName, rowValue.at("LongCustomerName").c_str(), sizeof(TThostFtdcLongIndividualNameType));
data.DRIdentityID = std::stoi(rowValue.at("DRIdentityID"));
data.SecFutureSerial = std::stoi(rowValue.at("SecFutureSerial"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.TradeCode + "','" + data.BankID + "','" + data.BankBranchID + "','" + data.BrokerID + "','" + data.BrokerBranchID + "','" + data.TradeDate + "','" + data.TradeTime + "','" + data.BankSerial + "','" + data.TradingDay + "','" + std::to_string(data.PlateSerial) + "','" + (data.LastFragment == 0 ? '0' : data.LastFragment) + "','" + std::to_string(data.SessionID) + "','" + data.CustomerName + "','" + (data.IdCardType == 0 ? '0' : data.IdCardType) + "','" + data.IdentifiedCardNo + "','" + (data.CustType == 0 ? '0' : data.CustType) + "','" + data.BankAccount + "','" + data.BankPassWord + "','" + data.AccountID + "','" + data.Password + "','" + std::to_string(data.FutureSerial) + "','" + std::to_string(data.InstallID) + "','" + data.UserID + "','" + (data.VerifyCertNoFlag == 0 ? '0' : data.VerifyCertNoFlag) + "','" + data.CurrencyID + "','" + data.Digest + "','" + (data.BankAccType == 0 ? '0' : data.BankAccType) + "','" + data.DeviceID + "','" + (data.BankSecuAccType == 0 ? '0' : data.BankSecuAccType) + "','" + data.BrokerIDByBank + "','" + data.BankSecuAcc + "','" + (data.BankPwdFlag == 0 ? '0' : data.BankPwdFlag) + "','" + (data.SecuPwdFlag == 0 ? '0' : data.SecuPwdFlag) + "','" + data.OperNo + "','" + std::to_string(data.RequestID) + "','" + std::to_string(data.TID) + "','" + data.LongCustomerName + "','" + std::to_string(data.DRIdentityID) + "','" + std::to_string(data.SecFutureSerial)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.AccountID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& AccountID) {
return "SELECT * FROM 'CThostFtdcReqQueryBankAccountBySecField' where BrokerID='" + BrokerID + "' and AccountID='" + AccountID + "';";
}
};
struct CThostFtdcRspQueryBankAccountBySecFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcRspQueryBankAccountBySecField data;
CThostFtdcRspQueryBankAccountBySecFieldWrapper(const CThostFtdcRspQueryBankAccountBySecField& _data = { 0 }) :data(_data) { }
CThostFtdcRspQueryBankAccountBySecFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcRspQueryBankAccountBySecField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.TradeCode, rowValue.at("TradeCode").c_str(), sizeof(TThostFtdcTradeCodeType));
strncpy(data.BankID, rowValue.at("BankID").c_str(), sizeof(TThostFtdcBankIDType));
strncpy(data.BankBranchID, rowValue.at("BankBranchID").c_str(), sizeof(TThostFtdcBankBrchIDType));
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.BrokerBranchID, rowValue.at("BrokerBranchID").c_str(), sizeof(TThostFtdcFutureBranchIDType));
strncpy(data.TradeDate, rowValue.at("TradeDate").c_str(), sizeof(TThostFtdcTradeDateType));
strncpy(data.TradeTime, rowValue.at("TradeTime").c_str(), sizeof(TThostFtdcTradeTimeType));
strncpy(data.BankSerial, rowValue.at("BankSerial").c_str(), sizeof(TThostFtdcBankSerialType));
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcTradeDateType));
data.PlateSerial = std::stoi(rowValue.at("PlateSerial"));
data.LastFragment = rowValue.at("LastFragment").empty() ? '0' : rowValue.at("LastFragment")[0];
data.SessionID = std::stoi(rowValue.at("SessionID"));
strncpy(data.CustomerName, rowValue.at("CustomerName").c_str(), sizeof(TThostFtdcIndividualNameType));
data.IdCardType = rowValue.at("IdCardType").empty() ? '0' : rowValue.at("IdCardType")[0];
strncpy(data.IdentifiedCardNo, rowValue.at("IdentifiedCardNo").c_str(), sizeof(TThostFtdcIdentifiedCardNoType));
data.CustType = rowValue.at("CustType").empty() ? '0' : rowValue.at("CustType")[0];
strncpy(data.BankAccount, rowValue.at("BankAccount").c_str(), sizeof(TThostFtdcBankAccountType));
strncpy(data.BankPassWord, rowValue.at("BankPassWord").c_str(), sizeof(TThostFtdcPasswordType));
strncpy(data.AccountID, rowValue.at("AccountID").c_str(), sizeof(TThostFtdcAccountIDType));
strncpy(data.Password, rowValue.at("Password").c_str(), sizeof(TThostFtdcPasswordType));
data.FutureSerial = std::stoi(rowValue.at("FutureSerial"));
data.InstallID = std::stoi(rowValue.at("InstallID"));
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
data.VerifyCertNoFlag = rowValue.at("VerifyCertNoFlag").empty() ? '0' : rowValue.at("VerifyCertNoFlag")[0];
strncpy(data.CurrencyID, rowValue.at("CurrencyID").c_str(), sizeof(TThostFtdcCurrencyIDType));
strncpy(data.Digest, rowValue.at("Digest").c_str(), sizeof(TThostFtdcDigestType));
data.BankAccType = rowValue.at("BankAccType").empty() ? '0' : rowValue.at("BankAccType")[0];
strncpy(data.DeviceID, rowValue.at("DeviceID").c_str(), sizeof(TThostFtdcDeviceIDType));
data.BankSecuAccType = rowValue.at("BankSecuAccType").empty() ? '0' : rowValue.at("BankSecuAccType")[0];
strncpy(data.BrokerIDByBank, rowValue.at("BrokerIDByBank").c_str(), sizeof(TThostFtdcBankCodingForFutureType));
strncpy(data.BankSecuAcc, rowValue.at("BankSecuAcc").c_str(), sizeof(TThostFtdcBankAccountType));
data.BankPwdFlag = rowValue.at("BankPwdFlag").empty() ? '0' : rowValue.at("BankPwdFlag")[0];
data.SecuPwdFlag = rowValue.at("SecuPwdFlag").empty() ? '0' : rowValue.at("SecuPwdFlag")[0];
strncpy(data.OperNo, rowValue.at("OperNo").c_str(), sizeof(TThostFtdcOperNoType));
data.RequestID = std::stoi(rowValue.at("RequestID"));
data.TID = std::stoi(rowValue.at("TID"));
data.BankUseAmount = std::stod(rowValue.at("BankUseAmount"));
data.BankFetchAmount = std::stod(rowValue.at("BankFetchAmount"));
strncpy(data.LongCustomerName, rowValue.at("LongCustomerName").c_str(), sizeof(TThostFtdcLongIndividualNameType));
data.DRIdentityID = std::stoi(rowValue.at("DRIdentityID"));
data.SecFutureSerial = std::stoi(rowValue.at("SecFutureSerial"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.TradeCode + "','" + data.BankID + "','" + data.BankBranchID + "','" + data.BrokerID + "','" + data.BrokerBranchID + "','" + data.TradeDate + "','" + data.TradeTime + "','" + data.BankSerial + "','" + data.TradingDay + "','" + std::to_string(data.PlateSerial) + "','" + (data.LastFragment == 0 ? '0' : data.LastFragment) + "','" + std::to_string(data.SessionID) + "','" + data.CustomerName + "','" + (data.IdCardType == 0 ? '0' : data.IdCardType) + "','" + data.IdentifiedCardNo + "','" + (data.CustType == 0 ? '0' : data.CustType) + "','" + data.BankAccount + "','" + data.BankPassWord + "','" + data.AccountID + "','" + data.Password + "','" + std::to_string(data.FutureSerial) + "','" + std::to_string(data.InstallID) + "','" + data.UserID + "','" + (data.VerifyCertNoFlag == 0 ? '0' : data.VerifyCertNoFlag) + "','" + data.CurrencyID + "','" + data.Digest + "','" + (data.BankAccType == 0 ? '0' : data.BankAccType) + "','" + data.DeviceID + "','" + (data.BankSecuAccType == 0 ? '0' : data.BankSecuAccType) + "','" + data.BrokerIDByBank + "','" + data.BankSecuAcc + "','" + (data.BankPwdFlag == 0 ? '0' : data.BankPwdFlag) + "','" + (data.SecuPwdFlag == 0 ? '0' : data.SecuPwdFlag) + "','" + data.OperNo + "','" + std::to_string(data.RequestID) + "','" + std::to_string(data.TID) + "','" + std::to_string(data.BankUseAmount) + "','" + std::to_string(data.BankFetchAmount) + "','" + data.LongCustomerName + "','" + std::to_string(data.DRIdentityID) + "','" + std::to_string(data.SecFutureSerial)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.AccountID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& AccountID) {
return "SELECT * FROM 'CThostFtdcRspQueryBankAccountBySecField' where BrokerID='" + BrokerID + "' and AccountID='" + AccountID + "';";
}
};
struct CThostFtdcReqTransferBySecFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcReqTransferBySecField data;
CThostFtdcReqTransferBySecFieldWrapper(const CThostFtdcReqTransferBySecField& _data = { 0 }) :data(_data) { }
CThostFtdcReqTransferBySecFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcReqTransferBySecField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.TradeCode, rowValue.at("TradeCode").c_str(), sizeof(TThostFtdcTradeCodeType));
strncpy(data.BankID, rowValue.at("BankID").c_str(), sizeof(TThostFtdcBankIDType));
strncpy(data.BankBranchID, rowValue.at("BankBranchID").c_str(), sizeof(TThostFtdcBankBrchIDType));
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.BrokerBranchID, rowValue.at("BrokerBranchID").c_str(), sizeof(TThostFtdcFutureBranchIDType));
strncpy(data.TradeDate, rowValue.at("TradeDate").c_str(), sizeof(TThostFtdcTradeDateType));
strncpy(data.TradeTime, rowValue.at("TradeTime").c_str(), sizeof(TThostFtdcTradeTimeType));
strncpy(data.BankSerial, rowValue.at("BankSerial").c_str(), sizeof(TThostFtdcBankSerialType));
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcTradeDateType));
data.PlateSerial = std::stoi(rowValue.at("PlateSerial"));
data.LastFragment = rowValue.at("LastFragment").empty() ? '0' : rowValue.at("LastFragment")[0];
data.SessionID = std::stoi(rowValue.at("SessionID"));
strncpy(data.CustomerName, rowValue.at("CustomerName").c_str(), sizeof(TThostFtdcIndividualNameType));
data.IdCardType = rowValue.at("IdCardType").empty() ? '0' : rowValue.at("IdCardType")[0];
strncpy(data.IdentifiedCardNo, rowValue.at("IdentifiedCardNo").c_str(), sizeof(TThostFtdcIdentifiedCardNoType));
data.CustType = rowValue.at("CustType").empty() ? '0' : rowValue.at("CustType")[0];
strncpy(data.BankAccount, rowValue.at("BankAccount").c_str(), sizeof(TThostFtdcBankAccountType));
strncpy(data.BankPassWord, rowValue.at("BankPassWord").c_str(), sizeof(TThostFtdcPasswordType));
strncpy(data.AccountID, rowValue.at("AccountID").c_str(), sizeof(TThostFtdcAccountIDType));
strncpy(data.Password, rowValue.at("Password").c_str(), sizeof(TThostFtdcPasswordType));
data.InstallID = std::stoi(rowValue.at("InstallID"));
data.FutureSerial = std::stoi(rowValue.at("FutureSerial"));
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
data.VerifyCertNoFlag = rowValue.at("VerifyCertNoFlag").empty() ? '0' : rowValue.at("VerifyCertNoFlag")[0];
strncpy(data.CurrencyID, rowValue.at("CurrencyID").c_str(), sizeof(TThostFtdcCurrencyIDType));
data.TradeAmount = std::stod(rowValue.at("TradeAmount"));
data.FutureFetchAmount = std::stod(rowValue.at("FutureFetchAmount"));
data.FeePayFlag = rowValue.at("FeePayFlag").empty() ? '0' : rowValue.at("FeePayFlag")[0];
data.CustFee = std::stod(rowValue.at("CustFee"));
data.BrokerFee = std::stod(rowValue.at("BrokerFee"));
strncpy(data.Message, rowValue.at("Message").c_str(), sizeof(TThostFtdcAddInfoType));
strncpy(data.Digest, rowValue.at("Digest").c_str(), sizeof(TThostFtdcDigestType));
data.BankAccType = rowValue.at("BankAccType").empty() ? '0' : rowValue.at("BankAccType")[0];
strncpy(data.DeviceID, rowValue.at("DeviceID").c_str(), sizeof(TThostFtdcDeviceIDType));
data.BankSecuAccType = rowValue.at("BankSecuAccType").empty() ? '0' : rowValue.at("BankSecuAccType")[0];
strncpy(data.BrokerIDByBank, rowValue.at("BrokerIDByBank").c_str(), sizeof(TThostFtdcBankCodingForFutureType));
strncpy(data.BankSecuAcc, rowValue.at("BankSecuAcc").c_str(), sizeof(TThostFtdcBankAccountType));
data.BankPwdFlag = rowValue.at("BankPwdFlag").empty() ? '0' : rowValue.at("BankPwdFlag")[0];
data.SecuPwdFlag = rowValue.at("SecuPwdFlag").empty() ? '0' : rowValue.at("SecuPwdFlag")[0];
strncpy(data.OperNo, rowValue.at("OperNo").c_str(), sizeof(TThostFtdcOperNoType));
data.RequestID = std::stoi(rowValue.at("RequestID"));
data.TID = std::stoi(rowValue.at("TID"));
data.TransferStatus = rowValue.at("TransferStatus").empty() ? '0' : rowValue.at("TransferStatus")[0];
strncpy(data.LongCustomerName, rowValue.at("LongCustomerName").c_str(), sizeof(TThostFtdcLongIndividualNameType));
data.DRIdentityID = std::stoi(rowValue.at("DRIdentityID"));
data.SecFutureSerial = std::stoi(rowValue.at("SecFutureSerial"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.TradeCode + "','" + data.BankID + "','" + data.BankBranchID + "','" + data.BrokerID + "','" + data.BrokerBranchID + "','" + data.TradeDate + "','" + data.TradeTime + "','" + data.BankSerial + "','" + data.TradingDay + "','" + std::to_string(data.PlateSerial) + "','" + (data.LastFragment == 0 ? '0' : data.LastFragment) + "','" + std::to_string(data.SessionID) + "','" + data.CustomerName + "','" + (data.IdCardType == 0 ? '0' : data.IdCardType) + "','" + data.IdentifiedCardNo + "','" + (data.CustType == 0 ? '0' : data.CustType) + "','" + data.BankAccount + "','" + data.BankPassWord + "','" + data.AccountID + "','" + data.Password + "','" + std::to_string(data.InstallID) + "','" + std::to_string(data.FutureSerial) + "','" + data.UserID + "','" + (data.VerifyCertNoFlag == 0 ? '0' : data.VerifyCertNoFlag) + "','" + data.CurrencyID + "','" + std::to_string(data.TradeAmount) + "','" + std::to_string(data.FutureFetchAmount) + "','" + (data.FeePayFlag == 0 ? '0' : data.FeePayFlag) + "','" + std::to_string(data.CustFee) + "','" + std::to_string(data.BrokerFee) + "','" + data.Message + "','" + data.Digest + "','" + (data.BankAccType == 0 ? '0' : data.BankAccType) + "','" + data.DeviceID + "','" + (data.BankSecuAccType == 0 ? '0' : data.BankSecuAccType) + "','" + data.BrokerIDByBank + "','" + data.BankSecuAcc + "','" + (data.BankPwdFlag == 0 ? '0' : data.BankPwdFlag) + "','" + (data.SecuPwdFlag == 0 ? '0' : data.SecuPwdFlag) + "','" + data.OperNo + "','" + std::to_string(data.RequestID) + "','" + std::to_string(data.TID) + "','" + (data.TransferStatus == 0 ? '0' : data.TransferStatus) + "','" + data.LongCustomerName + "','" + std::to_string(data.DRIdentityID) + "','" + std::to_string(data.SecFutureSerial)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.AccountID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& AccountID) {
return "SELECT * FROM 'CThostFtdcReqTransferBySecField' where BrokerID='" + BrokerID + "' and AccountID='" + AccountID + "';";
}
};
struct CThostFtdcRspTransferBySecFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcRspTransferBySecField data;
CThostFtdcRspTransferBySecFieldWrapper(const CThostFtdcRspTransferBySecField& _data = { 0 }) :data(_data) { }
CThostFtdcRspTransferBySecFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcRspTransferBySecField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.TradeCode, rowValue.at("TradeCode").c_str(), sizeof(TThostFtdcTradeCodeType));
strncpy(data.BankID, rowValue.at("BankID").c_str(), sizeof(TThostFtdcBankIDType));
strncpy(data.BankBranchID, rowValue.at("BankBranchID").c_str(), sizeof(TThostFtdcBankBrchIDType));
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.BrokerBranchID, rowValue.at("BrokerBranchID").c_str(), sizeof(TThostFtdcFutureBranchIDType));
strncpy(data.TradeDate, rowValue.at("TradeDate").c_str(), sizeof(TThostFtdcTradeDateType));
strncpy(data.TradeTime, rowValue.at("TradeTime").c_str(), sizeof(TThostFtdcTradeTimeType));
strncpy(data.BankSerial, rowValue.at("BankSerial").c_str(), sizeof(TThostFtdcBankSerialType));
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcTradeDateType));
data.PlateSerial = std::stoi(rowValue.at("PlateSerial"));
data.LastFragment = rowValue.at("LastFragment").empty() ? '0' : rowValue.at("LastFragment")[0];
data.SessionID = std::stoi(rowValue.at("SessionID"));
strncpy(data.CustomerName, rowValue.at("CustomerName").c_str(), sizeof(TThostFtdcIndividualNameType));
data.IdCardType = rowValue.at("IdCardType").empty() ? '0' : rowValue.at("IdCardType")[0];
strncpy(data.IdentifiedCardNo, rowValue.at("IdentifiedCardNo").c_str(), sizeof(TThostFtdcIdentifiedCardNoType));
data.CustType = rowValue.at("CustType").empty() ? '0' : rowValue.at("CustType")[0];
strncpy(data.BankAccount, rowValue.at("BankAccount").c_str(), sizeof(TThostFtdcBankAccountType));
strncpy(data.BankPassWord, rowValue.at("BankPassWord").c_str(), sizeof(TThostFtdcPasswordType));
strncpy(data.AccountID, rowValue.at("AccountID").c_str(), sizeof(TThostFtdcAccountIDType));
strncpy(data.Password, rowValue.at("Password").c_str(), sizeof(TThostFtdcPasswordType));
data.InstallID = std::stoi(rowValue.at("InstallID"));
data.FutureSerial = std::stoi(rowValue.at("FutureSerial"));
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
data.VerifyCertNoFlag = rowValue.at("VerifyCertNoFlag").empty() ? '0' : rowValue.at("VerifyCertNoFlag")[0];
strncpy(data.CurrencyID, rowValue.at("CurrencyID").c_str(), sizeof(TThostFtdcCurrencyIDType));
data.TradeAmount = std::stod(rowValue.at("TradeAmount"));
data.FutureFetchAmount = std::stod(rowValue.at("FutureFetchAmount"));
data.FeePayFlag = rowValue.at("FeePayFlag").empty() ? '0' : rowValue.at("FeePayFlag")[0];
data.CustFee = std::stod(rowValue.at("CustFee"));
data.BrokerFee = std::stod(rowValue.at("BrokerFee"));
strncpy(data.Message, rowValue.at("Message").c_str(), sizeof(TThostFtdcAddInfoType));
strncpy(data.Digest, rowValue.at("Digest").c_str(), sizeof(TThostFtdcDigestType));
data.BankAccType = rowValue.at("BankAccType").empty() ? '0' : rowValue.at("BankAccType")[0];
strncpy(data.DeviceID, rowValue.at("DeviceID").c_str(), sizeof(TThostFtdcDeviceIDType));
data.BankSecuAccType = rowValue.at("BankSecuAccType").empty() ? '0' : rowValue.at("BankSecuAccType")[0];
strncpy(data.BrokerIDByBank, rowValue.at("BrokerIDByBank").c_str(), sizeof(TThostFtdcBankCodingForFutureType));
strncpy(data.BankSecuAcc, rowValue.at("BankSecuAcc").c_str(), sizeof(TThostFtdcBankAccountType));
data.BankPwdFlag = rowValue.at("BankPwdFlag").empty() ? '0' : rowValue.at("BankPwdFlag")[0];
data.SecuPwdFlag = rowValue.at("SecuPwdFlag").empty() ? '0' : rowValue.at("SecuPwdFlag")[0];
strncpy(data.OperNo, rowValue.at("OperNo").c_str(), sizeof(TThostFtdcOperNoType));
data.RequestID = std::stoi(rowValue.at("RequestID"));
data.TID = std::stoi(rowValue.at("TID"));
data.TransferStatus = rowValue.at("TransferStatus").empty() ? '0' : rowValue.at("TransferStatus")[0];
data.ErrorID = std::stoi(rowValue.at("ErrorID"));
strncpy(data.ErrorMsg, utf8_to_gbk(rowValue.at("ErrorMsg")).c_str(), sizeof(TThostFtdcErrorMsgType));
strncpy(data.LongCustomerName, rowValue.at("LongCustomerName").c_str(), sizeof(TThostFtdcLongIndividualNameType));
data.DRIdentityID = std::stoi(rowValue.at("DRIdentityID"));
data.SecFutureSerial = std::stoi(rowValue.at("SecFutureSerial"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.TradeCode + "','" + data.BankID + "','" + data.BankBranchID + "','" + data.BrokerID + "','" + data.BrokerBranchID + "','" + data.TradeDate + "','" + data.TradeTime + "','" + data.BankSerial + "','" + data.TradingDay + "','" + std::to_string(data.PlateSerial) + "','" + (data.LastFragment == 0 ? '0' : data.LastFragment) + "','" + std::to_string(data.SessionID) + "','" + data.CustomerName + "','" + (data.IdCardType == 0 ? '0' : data.IdCardType) + "','" + data.IdentifiedCardNo + "','" + (data.CustType == 0 ? '0' : data.CustType) + "','" + data.BankAccount + "','" + data.BankPassWord + "','" + data.AccountID + "','" + data.Password + "','" + std::to_string(data.InstallID) + "','" + std::to_string(data.FutureSerial) + "','" + data.UserID + "','" + (data.VerifyCertNoFlag == 0 ? '0' : data.VerifyCertNoFlag) + "','" + data.CurrencyID + "','" + std::to_string(data.TradeAmount) + "','" + std::to_string(data.FutureFetchAmount) + "','" + (data.FeePayFlag == 0 ? '0' : data.FeePayFlag) + "','" + std::to_string(data.CustFee) + "','" + std::to_string(data.BrokerFee) + "','" + data.Message + "','" + data.Digest + "','" + (data.BankAccType == 0 ? '0' : data.BankAccType) + "','" + data.DeviceID + "','" + (data.BankSecuAccType == 0 ? '0' : data.BankSecuAccType) + "','" + data.BrokerIDByBank + "','" + data.BankSecuAcc + "','" + (data.BankPwdFlag == 0 ? '0' : data.BankPwdFlag) + "','" + (data.SecuPwdFlag == 0 ? '0' : data.SecuPwdFlag) + "','" + data.OperNo + "','" + std::to_string(data.RequestID) + "','" + std::to_string(data.TID) + "','" + (data.TransferStatus == 0 ? '0' : data.TransferStatus) + "','" + std::to_string(data.ErrorID) + "','" + gbk_to_utf8(data.ErrorMsg) + "','" + data.LongCustomerName + "','" + std::to_string(data.DRIdentityID) + "','" + std::to_string(data.SecFutureSerial)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.AccountID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& AccountID) {
return "SELECT * FROM 'CThostFtdcRspTransferBySecField' where BrokerID='" + BrokerID + "' and AccountID='" + AccountID + "';";
}
};
struct CThostFtdcNotifyQueryFutureAccountBySecFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcNotifyQueryFutureAccountBySecField data;
CThostFtdcNotifyQueryFutureAccountBySecFieldWrapper(const CThostFtdcNotifyQueryFutureAccountBySecField& _data = { 0 }) :data(_data) { }
CThostFtdcNotifyQueryFutureAccountBySecFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcNotifyQueryFutureAccountBySecField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.TradeCode, rowValue.at("TradeCode").c_str(), sizeof(TThostFtdcTradeCodeType));
strncpy(data.BankID, rowValue.at("BankID").c_str(), sizeof(TThostFtdcBankIDType));
strncpy(data.BankBranchID, rowValue.at("BankBranchID").c_str(), sizeof(TThostFtdcBankBrchIDType));
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.BrokerBranchID, rowValue.at("BrokerBranchID").c_str(), sizeof(TThostFtdcFutureBranchIDType));
strncpy(data.TradeDate, rowValue.at("TradeDate").c_str(), sizeof(TThostFtdcTradeDateType));
strncpy(data.TradeTime, rowValue.at("TradeTime").c_str(), sizeof(TThostFtdcTradeTimeType));
strncpy(data.BankSerial, rowValue.at("BankSerial").c_str(), sizeof(TThostFtdcBankSerialType));
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcTradeDateType));
data.PlateSerial = std::stoi(rowValue.at("PlateSerial"));
data.LastFragment = rowValue.at("LastFragment").empty() ? '0' : rowValue.at("LastFragment")[0];
data.SessionID = std::stoi(rowValue.at("SessionID"));
strncpy(data.CustomerName, rowValue.at("CustomerName").c_str(), sizeof(TThostFtdcIndividualNameType));
data.IdCardType = rowValue.at("IdCardType").empty() ? '0' : rowValue.at("IdCardType")[0];
strncpy(data.IdentifiedCardNo, rowValue.at("IdentifiedCardNo").c_str(), sizeof(TThostFtdcIdentifiedCardNoType));
data.CustType = rowValue.at("CustType").empty() ? '0' : rowValue.at("CustType")[0];
strncpy(data.BankAccount, rowValue.at("BankAccount").c_str(), sizeof(TThostFtdcBankAccountType));
strncpy(data.BankPassWord, rowValue.at("BankPassWord").c_str(), sizeof(TThostFtdcPasswordType));
strncpy(data.AccountID, rowValue.at("AccountID").c_str(), sizeof(TThostFtdcAccountIDType));
strncpy(data.Password, rowValue.at("Password").c_str(), sizeof(TThostFtdcPasswordType));
data.FutureSerial = std::stoi(rowValue.at("FutureSerial"));
data.InstallID = std::stoi(rowValue.at("InstallID"));
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
data.VerifyCertNoFlag = rowValue.at("VerifyCertNoFlag").empty() ? '0' : rowValue.at("VerifyCertNoFlag")[0];
strncpy(data.CurrencyID, rowValue.at("CurrencyID").c_str(), sizeof(TThostFtdcCurrencyIDType));
strncpy(data.Digest, rowValue.at("Digest").c_str(), sizeof(TThostFtdcDigestType));
data.BankAccType = rowValue.at("BankAccType").empty() ? '0' : rowValue.at("BankAccType")[0];
strncpy(data.DeviceID, rowValue.at("DeviceID").c_str(), sizeof(TThostFtdcDeviceIDType));
data.BankSecuAccType = rowValue.at("BankSecuAccType").empty() ? '0' : rowValue.at("BankSecuAccType")[0];
strncpy(data.BrokerIDByBank, rowValue.at("BrokerIDByBank").c_str(), sizeof(TThostFtdcBankCodingForFutureType));
strncpy(data.BankSecuAcc, rowValue.at("BankSecuAcc").c_str(), sizeof(TThostFtdcBankAccountType));
data.BankPwdFlag = rowValue.at("BankPwdFlag").empty() ? '0' : rowValue.at("BankPwdFlag")[0];
data.SecuPwdFlag = rowValue.at("SecuPwdFlag").empty() ? '0' : rowValue.at("SecuPwdFlag")[0];
strncpy(data.OperNo, rowValue.at("OperNo").c_str(), sizeof(TThostFtdcOperNoType));
data.RequestID = std::stoi(rowValue.at("RequestID"));
data.TID = std::stoi(rowValue.at("TID"));
data.BankUseAmount = std::stod(rowValue.at("BankUseAmount"));
data.BankFetchAmount = std::stod(rowValue.at("BankFetchAmount"));
data.ErrorID = std::stoi(rowValue.at("ErrorID"));
strncpy(data.ErrorMsg, utf8_to_gbk(rowValue.at("ErrorMsg")).c_str(), sizeof(TThostFtdcErrorMsgType));
strncpy(data.LongCustomerName, rowValue.at("LongCustomerName").c_str(), sizeof(TThostFtdcLongIndividualNameType));
data.DRIdentityID = std::stoi(rowValue.at("DRIdentityID"));
data.SecFutureSerial = std::stoi(rowValue.at("SecFutureSerial"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.TradeCode + "','" + data.BankID + "','" + data.BankBranchID + "','" + data.BrokerID + "','" + data.BrokerBranchID + "','" + data.TradeDate + "','" + data.TradeTime + "','" + data.BankSerial + "','" + data.TradingDay + "','" + std::to_string(data.PlateSerial) + "','" + (data.LastFragment == 0 ? '0' : data.LastFragment) + "','" + std::to_string(data.SessionID) + "','" + data.CustomerName + "','" + (data.IdCardType == 0 ? '0' : data.IdCardType) + "','" + data.IdentifiedCardNo + "','" + (data.CustType == 0 ? '0' : data.CustType) + "','" + data.BankAccount + "','" + data.BankPassWord + "','" + data.AccountID + "','" + data.Password + "','" + std::to_string(data.FutureSerial) + "','" + std::to_string(data.InstallID) + "','" + data.UserID + "','" + (data.VerifyCertNoFlag == 0 ? '0' : data.VerifyCertNoFlag) + "','" + data.CurrencyID + "','" + data.Digest + "','" + (data.BankAccType == 0 ? '0' : data.BankAccType) + "','" + data.DeviceID + "','" + (data.BankSecuAccType == 0 ? '0' : data.BankSecuAccType) + "','" + data.BrokerIDByBank + "','" + data.BankSecuAcc + "','" + (data.BankPwdFlag == 0 ? '0' : data.BankPwdFlag) + "','" + (data.SecuPwdFlag == 0 ? '0' : data.SecuPwdFlag) + "','" + data.OperNo + "','" + std::to_string(data.RequestID) + "','" + std::to_string(data.TID) + "','" + std::to_string(data.BankUseAmount) + "','" + std::to_string(data.BankFetchAmount) + "','" + std::to_string(data.ErrorID) + "','" + gbk_to_utf8(data.ErrorMsg) + "','" + data.LongCustomerName + "','" + std::to_string(data.DRIdentityID) + "','" + std::to_string(data.SecFutureSerial)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.AccountID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& AccountID) {
return "SELECT * FROM 'CThostFtdcNotifyQueryFutureAccountBySecField' where BrokerID='" + BrokerID + "' and AccountID='" + AccountID + "';";
}
};
struct CThostFtdcExitEmergencyFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcExitEmergencyField data;
CThostFtdcExitEmergencyFieldWrapper(const CThostFtdcExitEmergencyField& _data = { 0 }) :data(_data) { }
CThostFtdcExitEmergencyFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcExitEmergencyField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcInvestorPortfMarginModelFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcInvestorPortfMarginModelField data;
CThostFtdcInvestorPortfMarginModelFieldWrapper(const CThostFtdcInvestorPortfMarginModelField& _data = { 0 }) :data(_data) { }
CThostFtdcInvestorPortfMarginModelFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcInvestorPortfMarginModelField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.MarginModelID, rowValue.at("MarginModelID").c_str(), sizeof(TThostFtdcInvestorIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorID + "','" + data.MarginModelID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcInvestorPortfMarginModelField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcInvestorPortfSettingFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcInvestorPortfSettingField data;
CThostFtdcInvestorPortfSettingFieldWrapper(const CThostFtdcInvestorPortfSettingField& _data = { 0 }) :data(_data) { }
CThostFtdcInvestorPortfSettingFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcInvestorPortfSettingField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
data.HedgeFlag = rowValue.at("HedgeFlag").empty() ? '0' : rowValue.at("HedgeFlag")[0];
data.UsePortf = std::stoi(rowValue.at("UsePortf"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.ExchangeID + "','" + data.BrokerID + "','" + data.InvestorID + "','" + (data.HedgeFlag == 0 ? '0' : data.HedgeFlag) + "','" + std::to_string(data.UsePortf)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcInvestorPortfSettingField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcQryInvestorPortfSettingFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryInvestorPortfSettingField data;
CThostFtdcQryInvestorPortfSettingFieldWrapper(const CThostFtdcQryInvestorPortfSettingField& _data = { 0 }) :data(_data) { }
CThostFtdcQryInvestorPortfSettingFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryInvestorPortfSettingField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.ExchangeID + "','" + data.BrokerID + "','" + data.InvestorID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcQryInvestorPortfSettingField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcUserPasswordUpdateFromSecFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcUserPasswordUpdateFromSecField data;
CThostFtdcUserPasswordUpdateFromSecFieldWrapper(const CThostFtdcUserPasswordUpdateFromSecField& _data = { 0 }) :data(_data) { }
CThostFtdcUserPasswordUpdateFromSecFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcUserPasswordUpdateFromSecField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
strncpy(data.OldPassword, rowValue.at("OldPassword").c_str(), sizeof(TThostFtdcPasswordType));
strncpy(data.NewPassword, rowValue.at("NewPassword").c_str(), sizeof(TThostFtdcPasswordType));
data.FromSec = std::stoi(rowValue.at("FromSec"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.UserID + "','" + data.OldPassword + "','" + data.NewPassword + "','" + std::to_string(data.FromSec)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.UserID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& UserID) {
return "SELECT * FROM 'CThostFtdcUserPasswordUpdateFromSecField' where BrokerID='" + BrokerID + "' and UserID='" + UserID + "';";
}
};
struct CThostFtdcSettlementInfoConfirmFromSecFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcSettlementInfoConfirmFromSecField data;
CThostFtdcSettlementInfoConfirmFromSecFieldWrapper(const CThostFtdcSettlementInfoConfirmFromSecField& _data = { 0 }) :data(_data) { }
CThostFtdcSettlementInfoConfirmFromSecFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcSettlementInfoConfirmFromSecField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.ConfirmDate, rowValue.at("ConfirmDate").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.ConfirmTime, rowValue.at("ConfirmTime").c_str(), sizeof(TThostFtdcTimeType));
data.FromSec = std::stoi(rowValue.at("FromSec"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorID + "','" + data.ConfirmDate + "','" + data.ConfirmTime + "','" + std::to_string(data.FromSec)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcSettlementInfoConfirmFromSecField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcTradingAccountPasswordUpdateFromSecFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcTradingAccountPasswordUpdateFromSecField data;
CThostFtdcTradingAccountPasswordUpdateFromSecFieldWrapper(const CThostFtdcTradingAccountPasswordUpdateFromSecField& _data = { 0 }) :data(_data) { }
CThostFtdcTradingAccountPasswordUpdateFromSecFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcTradingAccountPasswordUpdateFromSecField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.AccountID, rowValue.at("AccountID").c_str(), sizeof(TThostFtdcAccountIDType));
strncpy(data.OldPassword, rowValue.at("OldPassword").c_str(), sizeof(TThostFtdcPasswordType));
strncpy(data.NewPassword, rowValue.at("NewPassword").c_str(), sizeof(TThostFtdcPasswordType));
strncpy(data.CurrencyID, rowValue.at("CurrencyID").c_str(), sizeof(TThostFtdcCurrencyIDType));
data.FromSec = std::stoi(rowValue.at("FromSec"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.AccountID + "','" + data.OldPassword + "','" + data.NewPassword + "','" + data.CurrencyID + "','" + std::to_string(data.FromSec)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.AccountID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& AccountID) {
return "SELECT * FROM 'CThostFtdcTradingAccountPasswordUpdateFromSecField' where BrokerID='" + BrokerID + "' and AccountID='" + AccountID + "';";
}
};
struct CThostFtdcRiskForbiddenRightFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcRiskForbiddenRightField data;
CThostFtdcRiskForbiddenRightFieldWrapper(const CThostFtdcRiskForbiddenRightField& _data = { 0 }) :data(_data) { }
CThostFtdcRiskForbiddenRightFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcRiskForbiddenRightField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorID + "','" + data.InstrumentID + "','" + data.UserID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcRiskForbiddenRightField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcInvestorInfoCommRecFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcInvestorInfoCommRecField data;
CThostFtdcInvestorInfoCommRecFieldWrapper(const CThostFtdcInvestorInfoCommRecField& _data = { 0 }) :data(_data) { }
CThostFtdcInvestorInfoCommRecFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcInvestorInfoCommRecField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
data.OrderCount = std::stoi(rowValue.at("OrderCount"));
data.OrderActionCount = std::stoi(rowValue.at("OrderActionCount"));
data.ForQuoteCnt = std::stoi(rowValue.at("ForQuoteCnt"));
data.InfoComm = std::stod(rowValue.at("InfoComm"));
data.IsOptSeries = std::stoi(rowValue.at("IsOptSeries"));
strncpy(data.ProductID, rowValue.at("ProductID").c_str(), sizeof(TThostFtdcProductIDType));
data.InfoCnt = std::stoi(rowValue.at("InfoCnt"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.ExchangeID + "','" + data.BrokerID + "','" + data.InvestorID + "','" + data.InstrumentID + "','" + std::to_string(data.OrderCount) + "','" + std::to_string(data.OrderActionCount) + "','" + std::to_string(data.ForQuoteCnt) + "','" + std::to_string(data.InfoComm) + "','" + std::to_string(data.IsOptSeries) + "','" + data.ProductID + "','" + std::to_string(data.InfoCnt)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcInvestorInfoCommRecField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcQryInvestorInfoCommRecFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryInvestorInfoCommRecField data;
CThostFtdcQryInvestorInfoCommRecFieldWrapper(const CThostFtdcQryInvestorInfoCommRecField& _data = { 0 }) :data(_data) { }
CThostFtdcQryInvestorInfoCommRecFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryInvestorInfoCommRecField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.InvestorID + "','" + data.InstrumentID + "','" + data.BrokerID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcQryInvestorInfoCommRecField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcCombLegFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcCombLegField data;
CThostFtdcCombLegFieldWrapper(const CThostFtdcCombLegField& _data = { 0 }) :data(_data) { }
CThostFtdcCombLegFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcCombLegField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.CombInstrumentID, rowValue.at("CombInstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
data.LegID = std::stoi(rowValue.at("LegID"));
strncpy(data.LegInstrumentID, rowValue.at("LegInstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
data.Direction = rowValue.at("Direction").empty() ? '0' : rowValue.at("Direction")[0];
data.LegMultiple = std::stoi(rowValue.at("LegMultiple"));
data.ImplyLevel = std::stoi(rowValue.at("ImplyLevel"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.CombInstrumentID + "','" + std::to_string(data.LegID) + "','" + data.LegInstrumentID + "','" + (data.Direction == 0 ? '0' : data.Direction) + "','" + std::to_string(data.LegMultiple) + "','" + std::to_string(data.ImplyLevel)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcQryCombLegFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryCombLegField data;
CThostFtdcQryCombLegFieldWrapper(const CThostFtdcQryCombLegField& _data = { 0 }) :data(_data) { }
CThostFtdcQryCombLegFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryCombLegField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.LegInstrumentID, rowValue.at("LegInstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.LegInstrumentID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcInputOffsetSettingFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcInputOffsetSettingField data;
CThostFtdcInputOffsetSettingFieldWrapper(const CThostFtdcInputOffsetSettingField& _data = { 0 }) :data(_data) { }
CThostFtdcInputOffsetSettingFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcInputOffsetSettingField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
strncpy(data.UnderlyingInstrID, rowValue.at("UnderlyingInstrID").c_str(), sizeof(TThostFtdcInstrumentIDType));
strncpy(data.ProductID, rowValue.at("ProductID").c_str(), sizeof(TThostFtdcProductIDType));
data.OffsetType = rowValue.at("OffsetType").empty() ? '0' : rowValue.at("OffsetType")[0];
data.Volume = std::stoi(rowValue.at("Volume"));
data.IsOffset = std::stoi(rowValue.at("IsOffset"));
data.RequestID = std::stoi(rowValue.at("RequestID"));
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.IPAddress, rowValue.at("IPAddress").c_str(), sizeof(TThostFtdcIPAddressType));
strncpy(data.MacAddress, rowValue.at("MacAddress").c_str(), sizeof(TThostFtdcMacAddressType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorID + "','" + data.InstrumentID + "','" + data.UnderlyingInstrID + "','" + data.ProductID + "','" + (data.OffsetType == 0 ? '0' : data.OffsetType) + "','" + std::to_string(data.Volume) + "','" + std::to_string(data.IsOffset) + "','" + std::to_string(data.RequestID) + "','" + data.UserID + "','" + data.ExchangeID + "','" + data.IPAddress + "','" + data.MacAddress
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcInputOffsetSettingField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcOffsetSettingFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcOffsetSettingField data;
CThostFtdcOffsetSettingFieldWrapper(const CThostFtdcOffsetSettingField& _data = { 0 }) :data(_data) { }
CThostFtdcOffsetSettingFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcOffsetSettingField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
strncpy(data.UnderlyingInstrID, rowValue.at("UnderlyingInstrID").c_str(), sizeof(TThostFtdcInstrumentIDType));
strncpy(data.ProductID, rowValue.at("ProductID").c_str(), sizeof(TThostFtdcProductIDType));
data.OffsetType = rowValue.at("OffsetType").empty() ? '0' : rowValue.at("OffsetType")[0];
data.Volume = std::stoi(rowValue.at("Volume"));
data.IsOffset = std::stoi(rowValue.at("IsOffset"));
data.RequestID = std::stoi(rowValue.at("RequestID"));
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.IPAddress, rowValue.at("IPAddress").c_str(), sizeof(TThostFtdcIPAddressType));
strncpy(data.MacAddress, rowValue.at("MacAddress").c_str(), sizeof(TThostFtdcMacAddressType));
strncpy(data.ExchangeInstID, rowValue.at("ExchangeInstID").c_str(), sizeof(TThostFtdcExchangeInstIDType));
strncpy(data.ExchangeSerialNo, rowValue.at("ExchangeSerialNo").c_str(), sizeof(TThostFtdcExchangeInstIDType));
strncpy(data.ExchangeProductID, rowValue.at("ExchangeProductID").c_str(), sizeof(TThostFtdcProductIDType));
strncpy(data.ParticipantID, rowValue.at("ParticipantID").c_str(), sizeof(TThostFtdcParticipantIDType));
strncpy(data.ClientID, rowValue.at("ClientID").c_str(), sizeof(TThostFtdcClientIDType));
strncpy(data.TraderID, rowValue.at("TraderID").c_str(), sizeof(TThostFtdcTraderIDType));
data.InstallID = std::stoi(rowValue.at("InstallID"));
data.OrderSubmitStatus = rowValue.at("OrderSubmitStatus").empty() ? '0' : rowValue.at("OrderSubmitStatus")[0];
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcDateType));
data.SettlementID = std::stoi(rowValue.at("SettlementID"));
strncpy(data.InsertDate, rowValue.at("InsertDate").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.InsertTime, rowValue.at("InsertTime").c_str(), sizeof(TThostFtdcTimeType));
strncpy(data.CancelTime, rowValue.at("CancelTime").c_str(), sizeof(TThostFtdcTimeType));
data.ExecResult = rowValue.at("ExecResult").empty() ? '0' : rowValue.at("ExecResult")[0];
data.SequenceNo = std::stoi(rowValue.at("SequenceNo"));
data.FrontID = std::stoi(rowValue.at("FrontID"));
data.SessionID = std::stoi(rowValue.at("SessionID"));
strncpy(data.StatusMsg, utf8_to_gbk(rowValue.at("StatusMsg")).c_str(), sizeof(TThostFtdcErrorMsgType));
strncpy(data.ActiveUserID, rowValue.at("ActiveUserID").c_str(), sizeof(TThostFtdcUserIDType));
data.BrokerOffsetSettingSeq = std::stoi(rowValue.at("BrokerOffsetSettingSeq"));
data.ApplySrc = rowValue.at("ApplySrc").empty() ? '0' : rowValue.at("ApplySrc")[0];
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorID + "','" + data.InstrumentID + "','" + data.UnderlyingInstrID + "','" + data.ProductID + "','" + (data.OffsetType == 0 ? '0' : data.OffsetType) + "','" + std::to_string(data.Volume) + "','" + std::to_string(data.IsOffset) + "','" + std::to_string(data.RequestID) + "','" + data.UserID + "','" + data.ExchangeID + "','" + data.IPAddress + "','" + data.MacAddress + "','" + data.ExchangeInstID + "','" + data.ExchangeSerialNo + "','" + data.ExchangeProductID + "','" + data.ParticipantID + "','" + data.ClientID + "','" + data.TraderID + "','" + std::to_string(data.InstallID) + "','" + (data.OrderSubmitStatus == 0 ? '0' : data.OrderSubmitStatus) + "','" + data.TradingDay + "','" + std::to_string(data.SettlementID) + "','" + data.InsertDate + "','" + data.InsertTime + "','" + data.CancelTime + "','" + (data.ExecResult == 0 ? '0' : data.ExecResult) + "','" + std::to_string(data.SequenceNo) + "','" + std::to_string(data.FrontID) + "','" + std::to_string(data.SessionID) + "','" + gbk_to_utf8(data.StatusMsg) + "','" + data.ActiveUserID + "','" + std::to_string(data.BrokerOffsetSettingSeq) + "','" + (data.ApplySrc == 0 ? '0' : data.ApplySrc)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcOffsetSettingField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcCancelOffsetSettingFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcCancelOffsetSettingField data;
CThostFtdcCancelOffsetSettingFieldWrapper(const CThostFtdcCancelOffsetSettingField& _data = { 0 }) :data(_data) { }
CThostFtdcCancelOffsetSettingFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcCancelOffsetSettingField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
strncpy(data.UnderlyingInstrID, rowValue.at("UnderlyingInstrID").c_str(), sizeof(TThostFtdcInstrumentIDType));
strncpy(data.ProductID, rowValue.at("ProductID").c_str(), sizeof(TThostFtdcProductIDType));
data.OffsetType = rowValue.at("OffsetType").empty() ? '0' : rowValue.at("OffsetType")[0];
data.Volume = std::stoi(rowValue.at("Volume"));
data.IsOffset = std::stoi(rowValue.at("IsOffset"));
data.RequestID = std::stoi(rowValue.at("RequestID"));
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.IPAddress, rowValue.at("IPAddress").c_str(), sizeof(TThostFtdcIPAddressType));
strncpy(data.MacAddress, rowValue.at("MacAddress").c_str(), sizeof(TThostFtdcMacAddressType));
strncpy(data.ExchangeInstID, rowValue.at("ExchangeInstID").c_str(), sizeof(TThostFtdcExchangeInstIDType));
strncpy(data.ExchangeSerialNo, rowValue.at("ExchangeSerialNo").c_str(), sizeof(TThostFtdcExchangeInstIDType));
strncpy(data.ExchangeProductID, rowValue.at("ExchangeProductID").c_str(), sizeof(TThostFtdcProductIDType));
strncpy(data.TraderID, rowValue.at("TraderID").c_str(), sizeof(TThostFtdcTraderIDType));
data.InstallID = std::stoi(rowValue.at("InstallID"));
strncpy(data.ParticipantID, rowValue.at("ParticipantID").c_str(), sizeof(TThostFtdcParticipantIDType));
strncpy(data.ClientID, rowValue.at("ClientID").c_str(), sizeof(TThostFtdcClientIDType));
data.OrderActionStatus = rowValue.at("OrderActionStatus").empty() ? '0' : rowValue.at("OrderActionStatus")[0];
strncpy(data.StatusMsg, utf8_to_gbk(rowValue.at("StatusMsg")).c_str(), sizeof(TThostFtdcErrorMsgType));
strncpy(data.ActionLocalID, rowValue.at("ActionLocalID").c_str(), sizeof(TThostFtdcOrderLocalIDType));
strncpy(data.ActionDate, rowValue.at("ActionDate").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.ActionTime, rowValue.at("ActionTime").c_str(), sizeof(TThostFtdcTimeType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorID + "','" + data.InstrumentID + "','" + data.UnderlyingInstrID + "','" + data.ProductID + "','" + (data.OffsetType == 0 ? '0' : data.OffsetType) + "','" + std::to_string(data.Volume) + "','" + std::to_string(data.IsOffset) + "','" + std::to_string(data.RequestID) + "','" + data.UserID + "','" + data.ExchangeID + "','" + data.IPAddress + "','" + data.MacAddress + "','" + data.ExchangeInstID + "','" + data.ExchangeSerialNo + "','" + data.ExchangeProductID + "','" + data.TraderID + "','" + std::to_string(data.InstallID) + "','" + data.ParticipantID + "','" + data.ClientID + "','" + (data.OrderActionStatus == 0 ? '0' : data.OrderActionStatus) + "','" + gbk_to_utf8(data.StatusMsg) + "','" + data.ActionLocalID + "','" + data.ActionDate + "','" + data.ActionTime
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcCancelOffsetSettingField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcQryOffsetSettingFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryOffsetSettingField data;
CThostFtdcQryOffsetSettingFieldWrapper(const CThostFtdcQryOffsetSettingField& _data = { 0 }) :data(_data) { }
CThostFtdcQryOffsetSettingFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryOffsetSettingField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.ProductID, rowValue.at("ProductID").c_str(), sizeof(TThostFtdcProductIDType));
data.OffsetType = rowValue.at("OffsetType").empty() ? '0' : rowValue.at("OffsetType")[0];
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorID + "','" + data.ProductID + "','" + (data.OffsetType == 0 ? '0' : data.OffsetType)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcQryOffsetSettingField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcAddrAppIDRelationFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcAddrAppIDRelationField data;
CThostFtdcAddrAppIDRelationFieldWrapper(const CThostFtdcAddrAppIDRelationField& _data = { 0 }) :data(_data) { }
CThostFtdcAddrAppIDRelationFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcAddrAppIDRelationField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.Address, rowValue.at("Address").c_str(), sizeof(TThostFtdcIpAddrType));
data.DRIdentityID = std::stoi(rowValue.at("DRIdentityID"));
strncpy(data.AppID, rowValue.at("AppID").c_str(), sizeof(TThostFtdcAppIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.Address + "','" + std::to_string(data.DRIdentityID) + "','" + data.AppID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcQryAddrAppIDRelationFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryAddrAppIDRelationField data;
CThostFtdcQryAddrAppIDRelationFieldWrapper(const CThostFtdcQryAddrAppIDRelationField& _data = { 0 }) :data(_data) { }
CThostFtdcQryAddrAppIDRelationFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryAddrAppIDRelationField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcWechatUserSystemInfoFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcWechatUserSystemInfoField data;
CThostFtdcWechatUserSystemInfoFieldWrapper(const CThostFtdcWechatUserSystemInfoField& _data = { 0 }) :data(_data) { }
CThostFtdcWechatUserSystemInfoFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcWechatUserSystemInfoField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
data.WechatCltSysInfoLen = std::stoi(rowValue.at("WechatCltSysInfoLen"));
strncpy(data.WechatCltSysInfo, rowValue.at("WechatCltSysInfo").c_str(), sizeof(TThostFtdcClientSystemInfoType));
data.ClientIPPort = std::stoi(rowValue.at("ClientIPPort"));
strncpy(data.ClientLoginTime, rowValue.at("ClientLoginTime").c_str(), sizeof(TThostFtdcTimeType));
strncpy(data.ClientAppID, rowValue.at("ClientAppID").c_str(), sizeof(TThostFtdcAppIDType));
strncpy(data.ClientPublicIP, rowValue.at("ClientPublicIP").c_str(), sizeof(TThostFtdcIPAddressType));
strncpy(data.ClientLoginRemark, rowValue.at("ClientLoginRemark").c_str(), sizeof(TThostFtdcClientLoginRemarkType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.UserID + "','" + std::to_string(data.WechatCltSysInfoLen) + "','" + data.WechatCltSysInfo + "','" + std::to_string(data.ClientIPPort) + "','" + data.ClientLoginTime + "','" + data.ClientAppID + "','" + data.ClientPublicIP + "','" + data.ClientLoginRemark
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.UserID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& UserID) {
return "SELECT * FROM 'CThostFtdcWechatUserSystemInfoField' where BrokerID='" + BrokerID + "' and UserID='" + UserID + "';";
}
};
struct CThostFtdcInvestorReserveInfoFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcInvestorReserveInfoField data;
CThostFtdcInvestorReserveInfoFieldWrapper(const CThostFtdcInvestorReserveInfoField& _data = { 0 }) :data(_data) { }
CThostFtdcInvestorReserveInfoFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcInvestorReserveInfoField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.UserID, rowValue.at("UserID").c_str(), sizeof(TThostFtdcUserIDType));
strncpy(data.ReserveInfo, rowValue.at("ReserveInfo").c_str(), sizeof(TThostFtdcReserveInfoType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.UserID + "','" + data.ReserveInfo
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.UserID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& UserID) {
return "SELECT * FROM 'CThostFtdcInvestorReserveInfoField' where BrokerID='" + BrokerID + "' and UserID='" + UserID + "';";
}
};
struct CThostFtdcQryInvestorDepartmentFlatFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryInvestorDepartmentFlatField data;
CThostFtdcQryInvestorDepartmentFlatFieldWrapper(const CThostFtdcQryInvestorDepartmentFlatField& _data = { 0 }) :data(_data) { }
CThostFtdcQryInvestorDepartmentFlatFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryInvestorDepartmentFlatField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcInvestorDepartmentFlatFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcInvestorDepartmentFlatField data;
CThostFtdcInvestorDepartmentFlatFieldWrapper(const CThostFtdcInvestorDepartmentFlatField& _data = { 0 }) :data(_data) { }
CThostFtdcInvestorDepartmentFlatFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcInvestorDepartmentFlatField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.DepartmentID, rowValue.at("DepartmentID").c_str(), sizeof(TThostFtdcInvestorIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorID + "','" + data.DepartmentID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CThostFtdcInvestorDepartmentFlatField' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct CThostFtdcQryDepartmentUserFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcQryDepartmentUserField data;
CThostFtdcQryDepartmentUserFieldWrapper(const CThostFtdcQryDepartmentUserField& _data = { 0 }) :data(_data) { }
CThostFtdcQryDepartmentUserFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcQryDepartmentUserField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CThostFtdcFrontInfoFieldWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CThostFtdcFrontInfoField data;
CThostFtdcFrontInfoFieldWrapper(const CThostFtdcFrontInfoField& _data = { 0 }) :data(_data) { }
CThostFtdcFrontInfoFieldWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CThostFtdcFrontInfoField() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.FrontAddr, rowValue.at("FrontAddr").c_str(), sizeof(TThostFtdcAddressType));
data.QryFreq = std::stoi(rowValue.at("QryFreq"));
data.FTDPkgFreq = std::stoi(rowValue.at("FTDPkgFreq"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.FrontAddr + "','" + std::to_string(data.QryFreq) + "','" + std::to_string(data.FTDPkgFreq)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
};
struct CloseDetailWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
CloseDetail data;
CloseDetailWrapper(const CloseDetail& _data = { 0 }) :data(_data) { }
CloseDetailWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator CloseDetail() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
strncpy(data.ExchangeID, rowValue.at("ExchangeID").c_str(), sizeof(TThostFtdcExchangeIDType));
strncpy(data.InstrumentID, rowValue.at("InstrumentID").c_str(), sizeof(TThostFtdcInstrumentIDType));
strncpy(data.OpenDate, rowValue.at("OpenDate").c_str(), sizeof(TThostFtdcDateType));
data.OpenPrice = std::stod(rowValue.at("OpenPrice"));
strncpy(data.OpenTradeID, rowValue.at("OpenTradeID").c_str(), sizeof(TThostFtdcTradeIDType));
strncpy(data.CloseDate, rowValue.at("CloseDate").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.CloseTime, rowValue.at("CloseTime").c_str(), sizeof(TThostFtdcTimeType));
data.ClosePrice = std::stod(rowValue.at("ClosePrice"));
strncpy(data.CloseTradeID, rowValue.at("CloseTradeID").c_str(), sizeof(TThostFtdcTradeIDType));
data.CloseVolume = std::stoi(rowValue.at("CloseVolume"));
data.Direction = rowValue.at("Direction").empty() ? '0' : rowValue.at("Direction")[0];
data.PreSettlementPrice = std::stod(rowValue.at("PreSettlementPrice"));
data.CloseProfit = std::stod(rowValue.at("CloseProfit"));
data.CloseFlag = rowValue.at("CloseFlag").empty() ? '0' : rowValue.at("CloseFlag")[0];
data.CashIn = std::stod(rowValue.at("CashIn"));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorID + "','" + data.ExchangeID + "','" + data.InstrumentID + "','" + data.OpenDate + "','" + std::to_string(data.OpenPrice) + "','" + data.OpenTradeID + "','" + data.CloseDate + "','" + data.CloseTime + "','" + std::to_string(data.ClosePrice) + "','" + data.CloseTradeID + "','" + std::to_string(data.CloseVolume) + "','" + (data.Direction == 0 ? '0' : data.Direction) + "','" + std::to_string(data.PreSettlementPrice) + "','" + std::to_string(data.CloseProfit) + "','" + (data.CloseFlag == 0 ? '0' : data.CloseFlag) + "','" + std::to_string(data.CashIn)
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'CloseDetail' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
struct SettlementDataWrapper
{
static const std::string CREATE_TABLE_SQL;
static const std::string SELECT_SQL;
static const std::string INSERT_SQL_PREFIX;
SettlementData data;
SettlementDataWrapper(const SettlementData& _data = { 0 }) :data(_data) { }
SettlementDataWrapper(const std::map<std::string, std::string>& rowValue) :data{ 0 } { parseFromSqlValue(rowValue); }
operator SettlementData() { return data; }
void parseFromSqlValue(const std::map<std::string, std::string>& rowValue) {
strncpy(data.BrokerID, rowValue.at("BrokerID").c_str(), sizeof(TThostFtdcBrokerIDType));
strncpy(data.InvestorID, rowValue.at("InvestorID").c_str(), sizeof(TThostFtdcInvestorIDType));
data.SettlementContent = rowValue.at("SettlementContent").c_str();
strncpy(data.TradingDay, rowValue.at("TradingDay").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.ConfirmDay, rowValue.at("ConfirmDay").c_str(), sizeof(TThostFtdcDateType));
strncpy(data.ConfirmTime, rowValue.at("ConfirmTime").c_str(), sizeof(TThostFtdcTimeType));
}
std::string generateInsertSql() const {
const auto insertSqlBody = std::string() + "'" +
data.BrokerID + "','" + data.InvestorID + "','" + data.SettlementContent + "','" + data.TradingDay + "','" + data.ConfirmDay + "','" + data.ConfirmTime
+ "'";
return INSERT_SQL_PREFIX + insertSqlBody + ");";
}
std::string generateSelectSqlByUserID() const {
return generateSelectSqlByUserID(data.BrokerID, data.InvestorID);
}
static std::string generateSelectSqlByUserID(const std::string& BrokerID, const std::string& InvestorID) {
return "SELECT * FROM 'SettlementData' where BrokerID='" + BrokerID + "' and InvestorID='" + InvestorID + "';";
}
};
} // end namespace localCTP