Delphi XE2 and MySql.
My previous question led to the recommendation that I should be using MySql's native TIMESTAMP
datatype to store date/time.
Unfornately, I can't seem to find any coding examples, and I am getting weird results.
Given this table:
mysql> describe test_runs;
+------------------+-------------+------+-----+---------------------+-------+
| Field | Type | Null | Key | Default | Extra |
+------------------+-------------+------+-----+---------------------+-------+
| start_time_stamp | timestamp | NO | PRI | 0000-00-00 00:00:00 | |
| end_time_stamp | timestamp | NO | | 0000-00-00 00:00:00 | |
| description | varchar(64) | NO | | NULL | |
+------------------+-------------+------+-----+---------------------+-------+
3 rows in set (0.02 sec)
I woudl like to :
- declare a variable into which I can store the result of
SELECT CURRENT_TIMESTAMP
- what type should it be?TSQLTimeStamp
? - insert a row at test start which has
start_time_stamp
= the variable above - and
end_time_stamp
= some "NULL" value ... "0000-00-00 00:00:00"? Can I use that directly, or do I need to declare aTSQLTimeStamp
and set each field to zero? (there doesn't seem to be aTSQLTimeStamp.Clear;
- it's a structure, not a class - upadte the
end_time_stamp
when the test completes - calcuate the test duration
Can somene please point me at a URL with some Delphi code whcich I can study to see how to do this sort of thing? GINMF.