Index: pgaSchedule.cpp =================================================================== RCS file: /projects/pgadmin3/src/agent/pgaSchedule.cpp,v retrieving revision 1.22 retrieving revision 1.23 diff -Lsrc/agent/pgaSchedule.cpp -Lsrc/agent/pgaSchedule.cpp -u -w -r1.22 -r1.23 --- src/agent/pgaSchedule.cpp +++ src/agent/pgaSchedule.cpp @@ -96,7 +96,7 @@ wxT("SELECT * FROM pgagent.pga_schedule\n") wxT(" WHERE jscjobid=") + NumToStr(collection->GetJob()->GetRecId()) + wxT("\n") + restriction + - wxT(" ORDER BY jscid")); + wxT(" ORDER BY jscname")); if (schedules) { Index: dlgStep.cpp =================================================================== RCS file: /projects/pgadmin3/src/agent/dlgStep.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -Lsrc/agent/dlgStep.cpp -Lsrc/agent/dlgStep.cpp -u -w -r1.16 -r1.17 --- src/agent/dlgStep.cpp +++ src/agent/dlgStep.cpp @@ -175,8 +175,8 @@ else db = qtString(cbDatabase->GetValue()); - sql = wxT("INSERT INTO pgagent.pga_jobstep (jstjobid, jstname, jstdesc, jstenabled, jstkind, jstonerror, jstcode, jstdbname)\n") - wxT("SELECT ") + jstjobid + wxT(", ") + qtString(name) + wxT(", ") + qtString(txtComment->GetValue()) + wxT(", ") + sql = wxT("INSERT INTO pgagent.pga_jobstep (jstid, jstjobid, jstname, jstdesc, jstenabled, jstkind, jstonerror, jstcode, jstdbname)\n") + wxT("SELECT , ") + jstjobid + wxT(", ") + qtString(name) + wxT(", ") + qtString(txtComment->GetValue()) + wxT(", ") + BoolToStr(chkEnabled->GetValue()) + wxT(", ") + qtString(kind) + wxT(", ") + qtString(onerror) + wxT(", ") + qtString(sqlBox->GetText()) + wxT(", ") + db; } Index: pgaStep.cpp =================================================================== RCS file: /projects/pgadmin3/src/agent/pgaStep.cpp,v retrieving revision 1.18 retrieving revision 1.19 diff -Lsrc/agent/pgaStep.cpp -Lsrc/agent/pgaStep.cpp -u -w -r1.18 -r1.19 --- src/agent/pgaStep.cpp +++ src/agent/pgaStep.cpp @@ -89,7 +89,7 @@ wxT("SELECT * FROM pgagent.pga_jobstep\n") wxT(" WHERE jstjobid=") + NumToStr(collection->GetJob()->GetRecId()) + wxT("\n") + restriction + - wxT(" ORDER BY jstid")); + wxT(" ORDER BY jstname")); if (steps) { Index: dlgSchedule.cpp =================================================================== RCS file: /projects/pgadmin3/src/agent/dlgSchedule.cpp,v retrieving revision 1.19 retrieving revision 1.20 diff -Lsrc/agent/dlgSchedule.cpp -Lsrc/agent/dlgSchedule.cpp -u -w -r1.19 -r1.20 --- src/agent/dlgSchedule.cpp +++ src/agent/dlgSchedule.cpp @@ -213,8 +213,8 @@ jscjobid = wxT(""); // Build the various arrays of values - sql = wxT("INSERT INTO pgagent.pga_schedule (jscjobid, jscname, jscdesc, jscminutes, jschours, jscweekdays, jscmonthdays, jscmonths, jscenabled, jscstart, jscend)\n") - wxT("VALUES(") + jscjobid + wxT(", ") + qtString(name) + wxT(", ") + qtString(txtComment->GetValue()) + wxT(", ") + sql = wxT("INSERT INTO pgagent.pga_schedule (jscid, jscjobid, jscname, jscdesc, jscminutes, jschours, jscweekdays, jscmonthdays, jscmonths, jscenabled, jscstart, jscend)\n") + wxT("VALUES(, ") + jscjobid + wxT(", ") + qtString(name) + wxT(", ") + qtString(txtComment->GetValue()) + wxT(", ") + wxT("'") + ChkListBox2PgArray(chkMinutes) + wxT("', ") + wxT("'") + ChkListBox2PgArray(chkHours) + wxT("', ") + wxT("'") + ChkListBox2PgArray(chkWeekdays) + wxT("', ") Index: dlgJob.cpp =================================================================== RCS file: /projects/pgadmin3/src/agent/dlgJob.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -Lsrc/agent/dlgJob.cpp -Lsrc/agent/dlgJob.cpp -u -w -r1.16 -r1.17 --- src/agent/dlgJob.cpp +++ src/agent/dlgJob.cpp @@ -60,7 +60,7 @@ EVT_LIST_ITEM_SELECTED(XRCID("lstSchedules"), dlgJob::OnSelChangeSchedule) EVT_BUTTON(XRCID("btnChangeSchedule"), dlgJob::OnChangeSchedule) EVT_BUTTON(XRCID("btnAddSchedule"), dlgJob::OnAddSchedule) - EVT_BUTTON(XRCID("btnRemoveStedule"), dlgJob::OnRemoveSchedule) + EVT_BUTTON(XRCID("btnRemoveSchedule"), dlgJob::OnRemoveSchedule) END_EVENT_TABLE(); @@ -202,7 +202,7 @@ pgObject *dlgJob::CreateObject(pgCollection *collection) { - pgObject *obj=pgaJob::ReadObjects(collection, 0, wxT(" AND jobid=") + NumToStr(recId) + wxT("\n")); + pgObject *obj=pgaJob::ReadObjects(collection, 0, wxT(" WHERE jobid=") + NumToStr(recId) + wxT("\n")); return obj; } @@ -423,7 +423,7 @@ for (index = 0 ; index < (int)tmpSteps.GetCount() ; index++) { - sql += wxT("DELETE FROM pgagent.pga_jobstep WHERE jobid=") + sql += wxT("DELETE FROM pgagent.pga_jobstep WHERE jstid=") + NumToStr(((pgaStep*)StrToLong(tmpSteps.Item(index)))->GetRecId()) + wxT(";\n"); } @@ -444,7 +444,7 @@ for (index = 0 ; index < (int)tmpSchedules.GetCount() ; index++) { - sql += wxT("DELETE FROM pgagent.pga_jobschedule WHERE jobid=") + sql += wxT("DELETE FROM pgagent.pga_schedule WHERE jscid=") + NumToStr(((pgaStep*)StrToLong(tmpSchedules.Item(index)))->GetRecId()) + wxT(";\n"); } Index: dlgProperty.cpp =================================================================== RCS file: /projects/pgadmin3/src/ui/dlgProperty.cpp,v retrieving revision 1.117 retrieving revision 1.118 diff -Lsrc/ui/dlgProperty.cpp -Lsrc/ui/dlgProperty.cpp -u -w -r1.117 -r1.118 --- src/ui/dlgProperty.cpp +++ src/ui/dlgProperty.cpp @@ -1312,15 +1312,21 @@ sql=GetInsertSql(); if (!sql.IsEmpty()) { - if (sql.Contains(wxT("")) && sql.StartsWith(wxT("INSERT INTO pgagent.pga_job"))) + if (sql.Contains(wxT(""))) { + if (sql.StartsWith(wxT("INSERT INTO pgagent.pga_job"))) recId=StrToLong(connection->ExecuteScalar(wxT("SELECT nextval('pgagent.pga_job_jobid_seq');"))); + else if (sql.StartsWith(wxT("INSERT INTO pgagent.pga_schedule"))) + recId=StrToLong(connection->ExecuteScalar(wxT("SELECT nextval('pgagent.pga_schedule_jscid_seq');"))); + else if (sql.StartsWith(wxT("INSERT INTO pgagent.pga_jobstep"))) + recId=StrToLong(connection->ExecuteScalar(wxT("SELECT nextval('pgagent.pga_jobstep_jstid_seq');"))); int pos; while ((pos=sql.Find(wxT(""))) >= 0) sql = sql.Left(pos) + NumToStr(recId) + sql.Mid(pos+4); } + pgSet *set=connection->ExecuteSet(sql); if (set) {