예제 #1
0
void pgaStep::ShowTreeDetail(ctlTree *browser, frmMain *form, ctlListView *properties, ctlSQLBox *sqlPane)
{
	if (!expandedKids)
	{
		expandedKids = true;
	}

	if (properties)
	{
		CreateListColumns(properties);

		properties->AppendItem(_("Name"), GetName());
		properties->AppendItem(_("ID"), GetRecId());
		properties->AppendYesNoItem(_("Enabled"), GetEnabled());
		properties->AppendItem(_("Kind"), GetKind());
		if (GetConnStr().IsEmpty())
			properties->AppendItem(_("Database"), GetDbname());
		else
			properties->AppendItem(_("Connection String"), GetConnStr());
		properties->AppendItem(_("Code"), GetCode());
		properties->AppendItem(_("On error"), GetOnError());

		properties->AppendItem(_("Comment"), firstLineOnly(GetComment()));
	}
}
예제 #2
0
void pgaSchedule::ShowTreeDetail(ctlTree *browser, frmMain *form, ctlListView *properties, ctlSQLBox *sqlPane)
{
    if (!expandedKids)
    {
        expandedKids = true;
    }

    if (properties)
    {
        CreateListColumns(properties);

        properties->AppendItem(_("Name"), GetName());
        properties->AppendItem(_("ID"), GetRecId());
        properties->AppendYesNoItem(_("Enabled"), GetEnabled());

        properties->AppendItem(_("Start date"), GetStart());
        properties->AppendItem(_("End date"), GetEnd());
        properties->AppendItem(_("Minutes"), GetMinutesString());
        properties->AppendItem(_("Hours"), GetHoursString());
        properties->AppendItem(_("Weekdays"), GetWeekdaysString());
        properties->AppendItem(_("Monthdays"), GetMonthdaysString());
        properties->AppendItem(_("Months"), GetMonthsString());
        properties->AppendItem(_("Exceptions"), GetExceptionsString());

        properties->AppendItem(_("Comment"), firstLineOnly(GetComment()));
    }
}
예제 #3
0
pgObject *pgaStep::Refresh(ctlTree *browser, const wxTreeItemId item)
{
	pgObject *step = 0;

	pgCollection *coll = browser->GetParentCollection(item);
	if (coll)
		step = stepFactory.CreateObjects(coll, 0, wxT("\n   AND jstid=") + NumToStr(GetRecId()));

	return step;
}
예제 #4
0
void pgaJob::ShowTreeDetail(ctlTree *browser, frmMain *form, ctlListView *properties, ctlSQLBox *sqlPane)
{
	if (!expandedKids)
	{
		expandedKids = true;

		browser->RemoveDummyChild(this);

		// Log
		wxLogInfo(wxT("Adding child objects to Job."));

		browser->AppendCollection(this, scheduleFactory);
		browser->AppendCollection(this, stepFactory);
	}

	if (properties)
	{
		CreateListColumns(properties);

		properties->AppendItem(_("Name"), GetName());
		properties->AppendItem(_("ID"), GetRecId());
		properties->AppendYesNoItem(_("Enabled"), GetEnabled());
		properties->AppendItem(_("Host agent"), GetHostAgent());
		properties->AppendItem(_("Job class"), GetJobclass());
		properties->AppendItem(_("Created"), GetCreated());
		properties->AppendItem(_("Changed"), GetChanged());
		properties->AppendItem(_("Next run"), GetNextrun());
		properties->AppendItem(_("Last run"), GetLastrun());
		properties->AppendItem(_("Last result"), GetLastresult());
		if (!GetCurrentAgent().IsEmpty())
			properties->AppendItem(_("Running at"), GetCurrentAgent());
		else
			properties->AppendItem(_("Running at"), _("Not currently running"));

		properties->AppendItem(_("Comment"), firstLineOnly(GetComment()));
	}
}
예제 #5
0
bool pgaJob::DropObject(wxFrame *frame, ctlTree *browser, bool cascaded)
{
	return GetConnection()->ExecuteVoid(wxT("DELETE FROM pgagent.pga_job WHERE jobid=") + NumToStr(GetRecId()));
}
예제 #6
0
bool pgaJob::RunNow()
{
	if (!GetConnection()->ExecuteVoid(wxT("UPDATE pgagent.pga_job SET jobnextrun = now() WHERE jobid=") + NumToStr(GetRecId())))
		return false;

	return true;
}
예제 #7
0
void pgaJob::ShowStatistics(frmMain *form, ctlListView *statistics)
{
	wxString sql =
	    wxT("SELECT jlgid")
	    wxT(", jlgstatus")
	    wxT(", jlgstart")
	    wxT(", jlgduration")
	    wxT(", (jlgstart + jlgduration) AS endtime")
	    wxT("  FROM pgagent.pga_joblog\n")
	    wxT(" WHERE jlgjobid = ") + NumToStr(GetRecId()) +
	    wxT(" ORDER BY jlgstart DESC") +
	    wxT(" LIMIT ") + NumToStr(settings->GetMaxRows());

	if (statistics)
	{
		wxLogInfo(wxT("Displaying statistics for job %s"), GetFullIdentifier().c_str());

		// Add the statistics view columns
		statistics->ClearAll();
		statistics->AddColumn(_("Run"), 50);
		statistics->AddColumn(_("Status"), 60);
		statistics->AddColumn(_("Start time"), 95);
		statistics->AddColumn(_("End time"), 95);
		statistics->AddColumn(_("Duration"), 70);

		pgSet *stats = GetConnection()->ExecuteSet(sql);
		wxString status;
		wxDateTime startTime;
		wxDateTime endTime;

		if (stats)
		{
			while (!stats->Eof())
			{
				if (stats->GetVal(1) == wxT("r"))
					status = _("Running");
				else if (stats->GetVal(1) == wxT("s"))
					status = _("Successful");
				else if (stats->GetVal(1) == wxT("f"))
					status = _("Failed");
				else if (stats->GetVal(1) == wxT("d"))
					status = _("Aborted");
				else if (stats->GetVal(1) == wxT("i"))
					status = _("No steps");
				else
					status = _("Unknown");

				startTime.ParseDateTime(stats->GetVal(2));
				endTime.ParseDateTime(stats->GetVal(4));

				long pos = statistics->AppendItem(stats->GetVal(0), status, startTime.Format());
				if (stats->GetVal(4).Length() > 0)
					statistics->SetItem(pos, 3, endTime.Format());
				statistics->SetItem(pos, 4, stats->GetVal(3));

				stats->MoveNext();
			}
			delete stats;
		}
	}
}
예제 #8
0
pgObject *pgaJob::Refresh(ctlTree *browser, const wxTreeItemId item)
{
	pgObject *job = 0;

	pgObject *obj = browser->GetObject(browser->GetItemParent(item));
	if (obj && obj->IsCollection())
		job = jobFactory.CreateObjects((pgCollection *)obj, 0, wxT("\n   WHERE j.jobid=") + NumToStr(GetRecId()));

	return job;
}
예제 #9
0
bool pgaStep::IsUpToDate()
{
	wxString sql = wxT("SELECT xmin FROM pgagent.pga_jobstep WHERE jstid = ") + NumToStr(GetRecId());
	if (!GetConnection() || GetConnection()->ExecuteScalar(sql) != NumToStr(GetXid()))
		return false;
	else
		return true;
}
예제 #10
0
pgObject *pgaSchedule::Refresh(ctlTree *browser, const wxTreeItemId item)
{
    pgObject *schedule = 0;

    pgCollection *coll = browser->GetParentCollection(item);
    if (coll)
        schedule = scheduleFactory.CreateObjects(coll, 0, wxT("\n   AND jscid=") + NumToStr(GetRecId()));

    return schedule;
}