Xbrowse with field type time() in MYSQL

Post Reply
User avatar
Maurizio
Posts: 705
Joined: Mon Oct 10, 2005 1:29 pm
Contact:

Xbrowse with field type time() in MYSQL

Post by Maurizio »

Hello
I have a MySQL table with a field type time() ( I use Ado )

https://drive.google.com/file/d/1w85dTG ... sp=sharing



When I use with FW invece di avere 13:00:00 I have

https://drive.google.com/open?id=12yT0s ... ar-3BMxoM1

it is possible to use this field in GET / XBROWSE ?



Thanks

Maurizio
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: Xbrowse with field type time() in MYSQL

Post by nageswaragunupudi »

Can you please try this modification in fwh\source\function\adofuncs.prg and let us know the results?

Please locate the following lines in
function FWAdoFieldStruct( oRs, n, lExt, cDbms )
in
fwh\source\function\adofuncs.prg

Code: Select all

   if nType == adBoolean
      cType    := 'L'
      nLen     := 1
   elseif AScan( { adDate, adDBDate, adDBTime, adDBTimeStamp }, nType ) > 0
 
Please change the above as:

Code: Select all

   if nType == adBoolean
      cType    := 'L'
      nLen     := 1
   elseif nType == adDBTime
      cType    := "C"
      nLen     := 8
   elseif AScan( { adDate, adDBDate, adDBTimeStamp }, nType ) > 0
 
Can you please implement the change and let us know if we are getting the desired result?
Regards

G. N. Rao.
Hyderabad, India
User avatar
Maurizio
Posts: 705
Joined: Mon Oct 10, 2005 1:29 pm
Contact:

Re: Xbrowse with field type time() in MYSQL

Post by Maurizio »

Thanks Rao , but same problem

also now i have this error

Code: Select all

 Time from start: 0 hours 0 mins 5 secs 
   Error occurred at: 13/02/2020, 15:13:45
   Error description: Error BASE/1100  Parametro errato: TRIM
   Args:
     [   1] = T   13/02/2020 08:30:00.000

Stack Calls
===========
   Called from:  => XHB_TRIM( 0 )
   Called from: C:\FWH_19\my_fw\datarow.PRG => TDATAROW:READADO( 783 )
   Called from: C:\FWH_19\my_fw\datarow.PRG => TDATAROW:LOAD( 240 )
   Called from: C:\FWH_19\my_fw\datarow.PRG => TDATAROW:NEW( 197 )
   Called from: Calendario_new.prg => APPUNTA:DLGPRENOTA( 2052 )
   Called from: Calendario_new.prg => APPUNTA:PRESSBUTTON( 1852 )
   Called from: Calendario_new.prg => (b)APPUNTA_PAINTBOOK( 1481 )
 
https://drive.google.com/file/d/1ESXbh4 ... sp=sharing


Maurizio
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: Xbrowse with field type time() in MYSQL

Post by nageswaragunupudi »

Please discard the changes.
Keep the original program of FWH as it is.

For the purpose of testing, we created a table "timefield" on our FWH demo server in the cloud.

This is the creation SQL

Code: Select all

CREATE TABLE timefield (
  id INT AUTO_INCREMENT PRIMARY KEY,
  name VARCHAR(10),
  fdate DATE,
  fdatetime DATETIME,
  ftime TIME
 
When viewed with FWH built-in library the xbrowse is ok and is working as expected:

Image

But the problem is with ADO.
(x)Harbour ADO reads the value of a Time field of MySql as a date time value.
This is not the issue with xbrowse or datarow. This is the issue with (x)Harbour ADO functionality

? oRs:Fields( "ftime" ):Value --> datetime value with some unknown date
? ValType( oRs:Fields( "ftime" ):Value ) --> "T"

Now what should xbrowse and datarow classes do?

We are thinking.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: Xbrowse with field type time() in MYSQL

Post by nageswaragunupudi »

We have seen that (x)Harbour ADO reads and writes TIME type fields (adTime) as DateTime values but not as TimeStrings in the format HH:MM:SS.

But we prefer these values to be displayed, edited and saved as time strings as HH:MM:SS, in xbrowse, datarow and also with Gets.

For this purpose, we enhanced the classes TXBrowse, TDataRow and TGet, which will be available in the next version to be released.

Get:
Time-part of a datetime variable can be viewed and edited as a time string if the picture clause is specified as "HH:MM:SS".

Example:

Code: Select all

tDateTime := DateTime()
@ r, c GET tDateTime PICTURE "HH:MM:SS" <other clauses>
 
In the case of xbrowse and the default dialog of datarow, no extra coding is required. This behavior is automatic in case of adTime fields.

Test:

Code: Select all

   oCn   := FW_DemoDB( "ADO" )
   oRs   := FW_OpenRecordSet( oCn, "timefield" )
   XBROWSER oRs FASTEDIT
   oRs:Close()
   oCn:Close()
 

Image
Regards

G. N. Rao.
Hyderabad, India
User avatar
Maurizio
Posts: 705
Joined: Mon Oct 10, 2005 1:29 pm
Contact:

Re: Xbrowse with field type time() in MYSQL

Post by Maurizio »

Thanks Nages
I try it when the relese arrives
Maurizio
Post Reply