Hello,
I am trying to do something similar to what is used in browser MMOs.
CREATE TABLE Processes (
Name varchar(255) NOT NULL UNIQUE,
StartTime TIMESTAMP,
DurationTime TIMESTAMP,
EndTime TIMESTAMP,
CurrentTime TIMESTAMP,
IsFinished int,
PRIMARY KEY (Name)
);
Specifically: I have a process, that has a StartTime and DurationTime. IsFinished starts as 0.
I need:
1) When I do INSERT:
Calculate the end time, the result is put into EndTime field
2) When I want to update (for now manually, not with timer):
Compare CurrentTime (should be taken automatically) to EndTime. If CurrentTime is past, IsFinished turns to '1'
How it can be achieved?
I have some basic knowledge, but not how to add or compare timestamps.
Thank you in advance,
Evgenie