Book a Demo

Author Topic: SQLQuery and time stamp  (Read 5595 times)

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
SQLQuery and time stamp
« on: September 22, 2015, 07:03:06 pm »
I tried retrieving a time stamp like this
Code: [Select]
my $v = $rep->SQLQuery("SELECT ModifiedDate FROM t_diagram");
print $v;
but EA returned only the date and not the time. But ModifiedDate is a time stamp as you can see when running the query in the SQL pad.

Bug reported.

q.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: SQLQuery and time stamp
« Reply #1 on: September 22, 2015, 08:47:32 pm »
qwerty,

Just a wild guess, but have you tried
Code: [Select]
my $v = $rep->SQLQuery("SELECT ModifiedDate AS myValue FROM t_diagram");
print $v;
We know EA sometimes does funny stuff with the resultsets depending on the alias. I wouldn't be surprised if they somehow cast dates depending on the name of the column.

Geert

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: SQLQuery and time stamp
« Reply #2 on: September 22, 2015, 09:41:41 pm »
Yes. I tried that and it did not work either.

q.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: SQLQuery and time stamp
« Reply #3 on: September 22, 2015, 10:11:12 pm »
Hmm, too bad.

Maybe if you explicitly cast it to a string in a certain format (including time)?

Geert

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: SQLQuery and time stamp
« Reply #4 on: September 22, 2015, 10:36:11 pm »
No. The return value is already a (XML) string. And that does not contain the time part. Just the date.

q.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: SQLQuery and time stamp
« Reply #5 on: September 22, 2015, 11:20:52 pm »
Yes, but in your query I mean.
In most SQL dialects there are functions to format dates.
In that case the format would be applied before it would be serialized in an xml.

Geert

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: SQLQuery and time stamp
« Reply #6 on: September 23, 2015, 12:21:13 am »
Actually I'm doing this investigation on behalf of someone else on SO. Will have a look if Access has something to offer.

q.

 :) That did the trick:

Code: [Select]
my $dia = $rep->SQLQuery("SELECT Format (ModifiedDate, \"Short Time\") AS T FROM t_diagram");
print $dia;
« Last Edit: September 23, 2015, 12:24:47 am by qwerty »