Page 1 of 1
Xbrowse with field type time() in MYSQL
Posted: Fri Feb 07, 2020 4:50 pm
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
Re: Xbrowse with field type time() in MYSQL
Posted: Thu Feb 13, 2020 3:21 am
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?
Re: Xbrowse with field type time() in MYSQL
Posted: Thu Feb 13, 2020 2:17 pm
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
Re: Xbrowse with field type time() in MYSQL
Posted: Sat Feb 15, 2020 3:57 pm
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:
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.
Re: Xbrowse with field type time() in MYSQL
Posted: Tue Feb 18, 2020 9:32 am
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()
Re: Xbrowse with field type time() in MYSQL
Posted: Tue Feb 18, 2020 11:27 am
by Maurizio
Thanks Nages
I try it when the relese arrives
Maurizio