My code:
first I run query:
rowset<row> rs = (sql.prepare << "SELECT amount, type, tx_hash, usd_value,
block_time FROM "
                                      << dbParams.transactionsTabName
                                      << " WHERE address = '" + hash + "'
AND block_time >= '" << startTimeStr << "'");

next I try:

AddressData DatabaseConnector::GetDataFromRowset(const rowset<row> &rs)
const {
    AddressData data;

        for(auto it = rs.begin(); it != rs.end(); ++it)
        {
        if (it->get_indicator(0) == i_null) {
            cerr << "amount is equal null ! \n";
        } else if( it->get_indicator(1) == i_null) {
            cerr << "type is equal null ! \n";
        } else if(it->get_indicator(2) == i_null) {
            cerr << "tx_hash is equal null ! \n";
        } else if(it->get_indicator(3) == i_null) {
            cerr << "usd_value is equal null ! \n";
        } else if(it->get_indicator(4) == i_null) {
            cerr << "block_time is equal null ! \n";
        } else {
            string amountstr = it->get<string>(0);
            data.mBtcValues.push_back( converter.satoshiToDouble(
it->get<unsigned long long int>(0) ));
            data.mType.push_back(atoi(it->get<string>(1).c_str()));
            if(it->get<string>(1) == "0")
                data.mBtcValues.back() = -data.mBtcValues.back();
            data.mTranHashes.push_back( it->get<string>(2) );
            data.mUsdValues.push_back( it->get<double>(3) );
            data.mTimestamps.push_back( it->get<tm>(4) );
        }
    }

    return data;
}

even  string amountstr = it->get<string>(0) causes exception
it->get_indicator(0)is not null
error is in :
class holder
{
public:
    holder() {}
    virtual ~holder() {}

    template<typename T>
    T get()
    {
        type_holder<T>* p = dynamic_cast<type_holder<T> *>(this);
        if (p)
        {
            return p->template value<T>();
        }
        else
        {
            throw std::bad_cast();
        }
    }
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
soci-users mailing list
soci-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/soci-users

Reply via email to