Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8868213
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T17:12:57+00:00 2026-06-14T17:12:57+00:00

Delphi XE2 and MySql. My previous question led to the recommendation that I should

  • 0

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 a TSQLTimeStamp and set each field to zero? (there doesn’t seem to be a TSQLTimeStamp.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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T17:12:59+00:00Added an answer on June 14, 2026 at 5:12 pm

    I don’t know why you want to hassle around with that TIMESTAMP and why you want to retrieve the CURRENT_TIMESTAMP just to put it back.

    And as already stated, it is not a good advice to use a TIMESTAMP field as PRIMARY KEY.

    So my suggestion is to use this TABLE SCHEMA

    CREATE TABLE `test_runs` (
        `id` int(11) NOT NULL AUTO_INCREMENT,
        `start_time_stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
        `end_time_stamp` timestamp NULL DEFAULT NULL,
        `description` varchar(64) NOT NULL,
        PRIMARY KEY (`id`)
    );
    

    Starting a test run is handled by

    INSERT INTO test_runs ( description ) VALUES ( :description );
    SELECT LAST_INSERT_ID() AS id;
    

    and to finalize the record you simply call

    UPDATE test_runs SET end_time_stamp = CURRENT_TIMESTAMP WHERE id = :id
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using Embarcadero Delphi XE2 and I've got a project that I want
I'm using Delphi XE2 and a TSQLQuery object. It works the first time that
I am working on DataSnap project in Delphi XE2 using TCP/IP protocol that needs
This code should work in Delphi XE2, but it gives not a valid date
Using Delphi XE2, Indy 10 that ships with it and OpenSSL dll's version 1.0.1c.
Delphi XE2, so I guess that is Indy 10(?). One server, 10 clients. I
Using Delphi XE2 on Win 7 64 bit creating a 32 bit app... In
I am using Delphi XE2 and attempting to upgrade our usb comms dll to
I'm currently using delphi xe2. well the firemonkey part of it. I use to
I am using Delphi XE2 to communicate with a fairly large SOAP service. I've

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.