6 namespace Wv
.Schedulator
8 public class ResultSource
: Source
, IDisposable
10 string user
; // get the bugs for this username
14 public ResultSource(Schedulator s
, string name
,
15 string odbcstring
, string user
)
18 if (!wv
.isempty(user
))
22 log
= new WvLog(String
.Format("Result:{0}", name
));
23 log
.print("Initializing result plugin '{0}'.\n", name
);
24 log
.print("Connecting to: '{0}'\n", odbcstring
);
25 db
= WvDbi
.create(odbcstring
);
27 // db.try_execute("drop table Schedule");
28 db
.try_execute("create table Schedule ("
29 + "sUser varchar(40) not null, "
30 + "sProject varchar(40) not null, "
31 + "sFixFor varchar(40) not null, "
32 + "sTaskId varchar(40) not null, "
33 + "sTask varchar(80) not null, "
34 + "ixPriority int not null, "
35 + "fDone boolean not null, "
36 + "fHalfDone boolean not null, "
37 + "fEstimated boolean not null, "
38 + "dtStart datetime not null, "
39 + "dtEnd datetime not null "
52 public static Source
create(Schedulator s
, string name
,
53 string prefix
, string suffix
)
55 string[] points
= suffix
.Split(':');
56 string dsn
= points
[0];
57 string user
= points
.Length
>1 ? points
[1] : null;
58 return new ResultSource(s
, name
, dsn
, user
);
61 public override void post_schedule()
63 db
.execute("delete from Schedule where sUser=?", user
);
66 "insert into Schedule "
67 + "(sUser,sProject,sFixFor,sTaskId,sTask,"
68 + " ixPriority,fDone,fHalfDone,fEstimated,dtStart,dtEnd) "
69 + "values (?,?,?,?,?,?,?,?,?,?,?) ";
71 foreach (TimeSlot _ts
in s
.schedule
)
73 if (_ts
is TaskTimeSlot
)
75 TaskTimeSlot ts
= (TaskTimeSlot
)_ts
;
76 log
.print("Adding {0} - {1}\n", ts
.start
, ts
.end
);
77 FixFor ff
= ts
.task
.fixfor
;
79 ff
= s
.fixfors
.Add(s
.projects
.Add("UNKNOWN"),
81 db
.execute(q
, user
, ff
.project
.name
, ff
.name
,
82 ts
.task
.moniker
, ts
.name
, ts
.task
.priority
,
84 ts
.task
.halfdone
? 1 : 0,
85 ts
.task
.is_estimated() ? 1 : 0,