Example #1
0
		std::vector<boost::shared_ptr<clsMAST_SWAP_TB>> create(nanodbc::result& results)
		{
			std::vector<boost::shared_ptr<clsMAST_SWAP_TB>> cls_results;
			try
			{
				while (results.next())
				{
					boost::shared_ptr<clsMAST_SWAP_TB> clstb =
						boost::shared_ptr<clsMAST_SWAP_TB>(new clsMAST_SWAP_TB());
					
					clstb->INSTRUMENT_ID = results.get<std::string>(0);
					clstb->INSTRUMENT_TYP = results.get<int>(1);
					clstb->NOTIONAL_PAY = results.get<Real>(2);
					clstb->PAY_CURR = results.get<std::string>(3);
					clstb->NOTIONAL_REC = results.get<Real>(4);
					clstb->REC_CURR = results.get<std::string>(5);
					clstb->EFFECTIVE_DT = results.get<std::string>(6);
					clstb->MATURITY_DT = results.get<std::string>(7);
					clstb->PAY_LEG_TYP = results.get<int>(8);
					clstb->PAY_LEG_TENOR = results.get<std::string>(9);
					clstb->PAY_LEG_BDC = results.get<int>(10);
					clstb->PAY_LEG_DC = results.get<int>(11);
					clstb->REC_LEG_TYP = results.get<int>(12);
					clstb->REC_LEG_TENOR = results.get<std::string>(13);
					clstb->REC_LEG_BDC = results.get<int>(14);
					clstb->REC_LEG_DC = results.get<int>(15);
					clstb->PAY_CALLABLE = results.get<int>(16);
					clstb->REC_CALLABLE = results.get<int>(17); 
				
					cls_results.push_back(clstb);
				}
				return cls_results;
			}
			catch (Error&) { return cls_results; }
		}
		std::vector<boost::shared_ptr<clsHITM_FP_PARTIALRHO_RESULT_TB>> create(nanodbc::result& results)
		{
			std::vector<boost::shared_ptr<clsHITM_FP_PARTIALRHO_RESULT_TB>> cls_results;
			try
			{
				while (results.next())
				{
					boost::shared_ptr<clsHITM_FP_PARTIALRHO_RESULT_TB> clstb =
						boost::shared_ptr<clsHITM_FP_PARTIALRHO_RESULT_TB>(new clsHITM_FP_PARTIALRHO_RESULT_TB());
					
					clstb->FP_PARTIALRHO_RESULT_ID = results.get<std::string>(0);
					clstb->CALC_DT = results.get<std::string>(1);
					clstb->INSTRUMENT_ID = results.get<std::string>(2);
					clstb->INSTRUMENT_TYP = results.get<int>(3);
					clstb->UNDERLYING_ID = results.get<std::string>(4);
					clstb->UNDERLYING_VALUE = results.get<Real>(5);
					clstb->SEQ = results.get<int>(6);
					clstb->TENOR = results.get<std::string>(7);
					clstb->RHO = results.get<Real>(8);
					clstb->CALC_PRICE = results.get<Real>(9);
					clstb->CALCULATED_FLAG = results.get<int>(10);
					clstb->CALCULATED_TIME = results.get<std::string>(11);
					clstb->CALCULATE_TYP = results.get<int>(12); 
				
					cls_results.push_back(clstb);
				}
				return cls_results;
			}
			catch (Error&) { return cls_results; }
		}
Example #3
0
		std::vector<boost::shared_ptr<clsHDAT_MARKETDATA_TB>> create(nanodbc::result& results)
		{
			std::vector<boost::shared_ptr<clsHDAT_MARKETDATA_TB>> cls_results;
			try
			{
				while (results.next())
				{
					boost::shared_ptr<clsHDAT_MARKETDATA_TB> clstb =
						boost::shared_ptr<clsHDAT_MARKETDATA_TB>(new clsHDAT_MARKETDATA_TB());
					
					clstb->REF_DT = results.get<std::string>(0);
					clstb->INDEX_CD = results.get<std::string>(1);
					clstb->LAST = results.get<Real>(2);
					clstb->LOW = results.get<Real>(3);
					clstb->HIGH = results.get<Real>(4); 
				
					cls_results.push_back(clstb);
				}
				return cls_results;
			}
			catch (Error&) { return cls_results; }
		}
void show(nanodbc::result& results)
{
    const short columns = results.columns();
    long rows_displayed = 0;

    cout << "\nDisplaying " << results.affected_rows() << " rows "
         << "(" << results.rowset_size() << " fetched at a time):" << endl;

    // show the column names
    cout << "row\t";
    for(short i = 0; i < columns; ++i)
        cout << results.column_name(i).c_str() << "\t";
    cout << endl;

    // show the column data for each row
    while(results.next())
    {
        cout << rows_displayed++ << "\t";
        for(short col = 0; col < columns; ++col)
			cout << "(" << results.get<nanodbc::string_type>(col, NANODBC_TEXT("null")).c_str() << ")\t";
        cout << endl;
    }
}
Example #5
0
void check_rows_equal(nanodbc::result results, std::size_t rows)
{
    BOOST_CHECK(results.next());
    BOOST_CHECK_EQUAL(results.get<int>(0), rows);
}