Xbrowse with field type time() in MYSQL

Xbrowse with field type time() in MYSQL

Postby Maurizio » Fri Feb 07, 2020 4:50 pm

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

https://drive.google.com/file/d/1w85dTGdh8HasWiJfbggHCotneDcabXZH/view?usp=sharing



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

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

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



Thanks

Maurizio
User avatar
Maurizio
 
Posts: 824
Joined: Mon Oct 10, 2005 1:29 pm

Re: Xbrowse with field type time() in MYSQL

Postby nageswaragunupudi » Thu Feb 13, 2020 3:21 am

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  Expand view
  if nType == adBoolean
      cType    := 'L'
      nLen     := 1
   elseif AScan( { adDate, adDBDate, adDBTime, adDBTimeStamp }, nType ) > 0
 


Please change the above as:
Code: Select all  Expand view
  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
nageswaragunupudi
 
Posts: 10643
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Xbrowse with field type time() in MYSQL

Postby Maurizio » Thu Feb 13, 2020 2:17 pm

Thanks Rao , but same problem

also now i have this error

Code: Select all  Expand view
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/1ESXbh49FFrrukp6xAmc5qoBqXelNeAoN/view?usp=sharing


Maurizio
User avatar
Maurizio
 
Posts: 824
Joined: Mon Oct 10, 2005 1:29 pm

Re: Xbrowse with field type time() in MYSQL

Postby nageswaragunupudi » Sat Feb 15, 2020 3:57 pm

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  Expand view
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: 10643
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Xbrowse with field type time() in MYSQL

Postby nageswaragunupudi » Tue Feb 18, 2020 9:32 am

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  Expand view

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  Expand view

   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
nageswaragunupudi
 
Posts: 10643
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Xbrowse with field type time() in MYSQL

Postby Maurizio » Tue Feb 18, 2020 11:27 am

Thanks Nages
I try it when the relese arrives
Maurizio
User avatar
Maurizio
 
Posts: 824
Joined: Mon Oct 10, 2005 1:29 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 70 guests