Recent

Author Topic: Postprocessing SQL-request  (Read 529 times)

Vodnik

  • New member
  • *
  • Posts: 40
Postprocessing SQL-request
« on: March 02, 2018, 09:41:40 pm »
Hi, I'm using Lazarus 1.8.0 / FPC 3.0.4 to access Informix DB via ODBC driver.
DB contain records about telephone calls, I'm building specialized reports. Data is loaded to DBGrid.
Main request looks like
FormDB.DBquery.SQL.text:='select callid as Call_ID, (callstart + sitetzoffset units minute) as Call_Start,  callend as Duration, origin as Calling_Num, origindestination as Called_Num  from callrecord';
Call duration (callend field) is stored in seconds, I would like to get it in format HH:MM:SS (or even DD:HH:MM:SS).
This can be achieved by building appropriate SQL request with math functions, which is not very compact. Or data in DBGrid can be post-processed.
Question: what is a common approach for such case? Maybe it is possible to define a function that will process the data of defined field before placing it to DBGrid?