Ejemplo n.º 1
0
void
Test::seedStocks(vector<O_Stock>& stocks)
{
    string testDB("graham_test");
    cout << "\n Switching to TEST DB--------------------" << endl;

    if (DBFace::instance()->switchDB( testDB ) )
        cout << "Switch to TEST db succeccful" << endl;
    // Ensure we switched to test DB
    bool rok(false);
    rok = db_setup();
    if(!rok)
    {
        LOG_ERROR << "Something wrong with TEST(probably with TEST DB setup)."
                  << "EXITING";
        cout << "An error uccored. exiting";
        exit(-1);
    }

    T_Stock ts;
    for(auto it = stocks.begin(); it != stocks.end();++it)
    {
        if ( ts.select( ts._ticker() == it->_ticker()).empty() )
        {
            O_Stock stock;            
            stock._ticker() = it->_ticker();
            stock._cik() = it->_cik();
            stock._fiscal_year_end() = it->_fiscal_year_end();
            stock._country() = it->_country();
            stock._listed() = it->_listed();
            stock._company_type() = it->_company_type();
            stock._name() = it->_name();
            stock.insert();
            LOG_INFO << "Seeded " <<stock._ticker() << " to TEST DB\n";
            cout << "Seeded " <<stock._ticker() << " to TEST DB\n";
        }else{
            LOG_INFO <<it->_ticker() << "Already in TEST DB\n";
            O_Stock stock = ts.select( ts._ticker() == it->_ticker()).front();
            stock._country() = it->_country();
            stock._listed() = it->_listed();
            stock._company_type() = it->_company_type();
            stock.update();
            cout <<it->_ticker() << "Already in TEST DB - UPDATED"<<endl;
        }
    }
}
Ejemplo n.º 2
0
y::ldap::account & y::ldap::account::country(const COUNTRY & value) {
  _country(value);
  return *this;
}
Ejemplo n.º 3
0
const COUNTRY & y::ldap::account::country() const {
  return _country();
}