Example #1
0
void StatDialog::ProgressFetch() {

    TimeIndex idx(m_period);

    DatabaseQuery* q = CreateDataQuery(m_draw, m_period);

    while (m_current_time <= m_end_time && m_pending < 200) {
        AddTimeToDataQuery(q, m_current_time.GetTime());

        m_pending++;
        m_current_time = m_current_time + idx.GetTimeRes() + idx.GetDateRes();
    }

    QueryDatabase(q);
}
Example #2
0
void DataMangler::ProgressFetch() {
	TimeIndex idx(m_period);

	std::vector<DatabaseQuery*> queries;
	for (size_t i = 0; i < m_di.size(); i++)
		queries.push_back(CreateDataQuery(m_di[i], m_period, i));

	while (m_pending < 200 && m_current_time <= m_end_time) {
		for (size_t i = 0; i < m_di.size(); i++)
			AddTimeToDataQuery(queries[i], m_current_time.GetTime().GetTicks());
		m_pending += m_di.size();
		m_current_time = m_current_time + idx.GetTimeRes() + idx.GetDateRes();
	}

	for (size_t i = 0; i < m_di.size(); i++)
		QueryDatabase(queries[i]);
}
Example #3
0
DatabaseQuery* Draw::GetDataToFetch() {
	const DTime& start_time = m_index.GetStartTime();
	assert(start_time.IsValid());

	PeriodType period = start_time.GetPeriod();

	int d = m_values.m_view.Start();

	DatabaseQuery* q = NULL;

	if (m_draw_info == NULL)
		return q;

	if (GetEnable() == false)
		return q;

	bool no_max_probes = !m_draw_info->IsValid() || m_draw_info->GetParam()->GetIPKParam()->GetFormulaType() == TParam::LUA_AV;
	for (size_t i = 0; i < m_values.len(); ++i) {
		ValueInfo &v = m_values.Get(i);

		if (v.state != ValueInfo::EMPTY) 
			continue;
		
		DTime pt = GetDTimeOfIndex(i - d);
		if (period == PERIOD_T_DAY)
			v.max_probes = 1;
		else if (no_max_probes)
			v.max_probes = 0;
		else {
			DTime ptn = pt + m_index.GetDateRes() + m_index.GetTimeRes();
			v.max_probes = (ptn.GetTime() - pt.GetTime()).GetMinutes() / 10;
		}

		v.state = ValueInfo::PENDING;
		
		if (q == NULL)
			q = CreateDataQuery(m_draw_info, period, m_draw_no);
		AddTimeToDataQuery(q, pt.GetTime().GetTicks());
	}

	return q;
}